Pavel Zuna wrote:
This patch makes the ipa client send the Accept-Language header, so that
the server can translate things like exceptions, that cannot be
translated on the client.

It also fixes the language recognition for the webUI. The values in
Accept-Language header are a bit different than what is accepted by the
LANG variable as a valid locale - some additional parsing was needed.
For example:
 >>> Accept-Language: es-es;q=1
needs to translate to
 >>> es_ES
otherwise it won't be recognized by gettext

Fix #904
Fix #917

Pavel

nack.

ast is imported but not used

Why are you calling locale.setlocale() instead of locale.getlocale()?

If extra_headers is passed in as a string this will drop it:

+        if not isinstance(extra_headers, list):
+            extra_headers = []

Multiple Authorization is actually legal though it may be a good idea to remove any others found, so I'll let this part go. I don't know that it is really needed though.

Some formatting is changed to make it less readable IMHO:

-        else:
-            scheme = "http"
+        else: scheme = "http"

The code to break HTTP_ACCEPT_LANGUAGE into language and region is broken. Passing in en-gb returns en_EN. (I think you want [1] not [0]).

Ideally we would loop through all acceptable languages until we find one that we actually provide.

So if we are passed in da, en-gb;q=0.8, en;q=0.7 we would first look for Danish but fall back to British English or any other English (preferring British English).

rob

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to