[Grok-dev] Internationalisation, is the howto current?
Vincent Fretin
vincent.fretin at gmail.com
Thu Mar 26 11:27:37 EDT 2009
I don't know very well how to use zope.i18n.translate.
Try something like that as said in the howto:
from zope.i18nmessageid import MessageFactory
MyDomainMessageFactory = MessageFactory('MyDomain')
_ = MyDomainMessageFactory
print _(u'my_msgid')
You should have locales/en/LC_MESSAGES/MyDomain.po with
msgid "my_msgid"
msgstr "something"
On Thu, Mar 26, 2009 at 4:16 PM, Sebastian Ware <sebastian at urbantalk.se> wrote:
> I am not sure if my translations are registring properly. I am dropping into
> a debugging prompt and trying
>
> from zope.i18n import translate
> translate('my_msgid', 'MyDomain', target_language="en")
>
> but it only returns "my_msgid". How can I test if my translation domain has
> been registered and what msgids have been loaded?
>
> Mvh Sebastian
>
> 26 mar 2009 kl. 15.22 skrev Vincent Fretin:
>
>> On Thu, Mar 26, 2009 at 3:16 PM, Sebastian Ware <sebastian at urbantalk.se>
>> wrote:
>>>
>>> If the prefered language is 'en-us' should it find translations in the
>>> directory
>>>
>>> locales/en
>>>
>>> or do I have to call it
>>>
>>> locales/en-us
>>>
>>> Mvh Sebastian
>>>
>> I think the default zope3 implementation of IUserPreferredLanguage
>> don't use combined language language-country. I think it only take the
>> first part. So locales/en is the way to go. Or if the default zope3
>> implementation supports combined languages, I think it search for
>> locales/en_us (the underscore is important here, and maybe the case is
>> important too, so en_US) first and if not found, fallback to
>> locales/en.
>>
>> --
>> Vincent Fretin
>> _______________________________________________
>> Grok-dev mailing list
>> Grok-dev at zope.org
>> http://mail.zope.org/mailman/listinfo/grok-dev
>
>
--
Vincent Fretin
More information about the Grok-dev
mailing list