[Freeipa-devel] [PATCH] 698 Translate exception messages

Pavel Zuna pzuna at redhat.com
Wed Feb 2 15:31:02 UTC 2011


On 02/01/2011 11:36 PM, Rob Crittenden wrote:
> Pavel mentioned this morning that translations didn't seem to be
> working. I remembered that I did some things on the cli so I re-tested.
> Turned out that exceptions aren't being translated.
>
> I'm not at all sure this patch does the right thing, so take it with a
> grain of salt. What it does is translates the message before stuffing it
> into the exception.
>
> Note that this will also translate messages returned via XML-RPC so I
> wonder if we need to force LANG to en_US.UTF-8 there.
>
> In any case, this seems to fix the client side anyway. I'm open to
> criticism on this one.
>
> To test do something like:
>
> $ kinit admin
> $ export LANG=es_US.UTF-8
> $ ipa user-add --first=Kermit --last=Frog kfrog
> $ ipa user-add --first=Kermit --last=Frog kfrog
>
> You should get a DuplicateEntry() response in Spanish.
>
> rob
>

nack.

While this patch works, it doesn't solve the problem at its root.

After some investigation I figured out, that functions initializing translations 
in ipalib/request.py are not called from anywhere. All the translation code in 
ipalib/request.py is currently deprecated in favor of ipalib/text.py. I'm 
preparing a patch, that removes the unused code and replaces references to it.

Pavel




More information about the Freeipa-devel mailing list