Replying on myself :-)
First of all, removing the not translated msgstr/msgid from the .po
file is the solution to the fallback problem (as mentioned earlier).
I think this is should be solved, but this is more a python gettext problem.
Now to make the fallback actually work i had to do what all pylons
documention (including the new pylonsbook) explicitly told me not to:
call set_lang() before calling add_fallback()
See this example
In [1]: from pylons.i18n.translation import set_lang, add_fallback, get_lang
In [2]: from pylons.i18n.translation import _ as i
# The way all the documentation tells me
In [3]: get_lang()
In [4]: add_fallback('de')
In [5]: set_lang('ru')
In [6]: i('photo')
Out[6]: u'photo' # Should have returned 'foto'
# The way it seems to work fine:
In [7]: get_lang()
Out[7]: ['ru']
In [9]: set_lang(None)
In [9]: get_lang()
In [10]: set_lang('ru')
In [11]: add_fallback('de')
In [12]: i('photo')
Out[12]: u'foto'
Regards,
Michael
On Fri, Nov 21, 2008 at 14:26, Michael van Tellingen
<[EMAIL PROTECTED]> wrote:
> Hello all,
>
> Although this is a rather old mail on which i'm replying i'm running
> in the exact same problem. This method is also mentioned in the
> pylonsbook but doesn't seem to work at all.
>
> Any hints or clues?
>
> Thanks,
> Michael
>
>
> On Sun, Mar 16, 2008 at 17:00, Parijat <[EMAIL PROTECTED]> wrote:
>>
>> I have the same problem. I am following the pylons
>> internationalization tutorial (http://wiki.pylonshq.com/display/
>> pylonsdocs/Internationalization+and+Localization). I cannot make
>> 'World' fall back to 'es' while the entry for 'World' exists in the
>> fr .po file.
>>
>>
>> My software:
>> * Babel-0.9.2-py2.5.egg
>> * Beaker-0.7.5-py2.5.egg
>> * decorator-2.2.0-py2.5.egg
>> * FormEncode-0.7.1-py2.5.egg
>> * Mako-0.1.8-py2.5.egg
>> * nose-0.10.1-py2.5.egg
>> * Paste-1.4.2-py2.5.egg
>> * PasteDeploy-1.3.1-py2.5.egg
>> * PasteScript-1.3.6-py2.5.egg
>> * Pylons-0.9.6.1-py2.5.egg
>> * Routes-1.7.1-py2.5.egg
>> * simplejson-1.7.1-py2.5.egg
>> * WebHelpers-0.3.2-py2.5.egg
>>
>> On Ubuntu 7.10 with gettext 0.16.1-2ubuntu
>>
>> So, is this intended gettext bahviour? Perhaps Babel is to blame?
>>
>>
>>
>> On Mar 11, 2:12 am, mickolka <[EMAIL PROTECTED]> wrote:
>>> Hi all
>>> I have a following problem and think it is a bug rather than normal
>>> behaviour
>>> I want to make two versions of sites on russian language one for
>>> Ukraine another for Russia, the i18n is mostly the same but I need to
>>> e able to do some custom translations.
>>>
>>> I created 2 sets ru and ru_UA,
>>> ru set should have default values and values specific for ru_RU
>>> version of site
>>> ru_UA has only small subset of items, the rest left as blank strings
>>>
>>> Then when I do in base controller
>>> def __before__(self):
>>> add_fallback('ru')
>>> set_lang('ru_UA')
>>> it does not fallback to ru locale for item "Agriculture" if I have it
>>> set to blank in ru_UA version like:
>>> #: uaprom/setup/product_categories.py:11 uaprom/templates/site/
>>> main_page.mako:6
>>> msgid "Agriculture"
>>> msgstr ""
>>>
>>> Once I remove it - it start works and fallback as intended
>>> Why not fallback if item is blank? Maybe it is not a pylons problem
>>> but it might need to be corrected.
>>>
>>> As a workaround I can write a script that will be run before
>>> python setup.py compile_catalog
>>> and do the cleanup of blank items, but I'd like to know if there exist
>>> a better solution for this problem
>>>
>>> Thanks in advance
>>>
>>> Mykola
>>
>> >>
>>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---