r8-forks / webapp-improved

Automatically exported from code.google.com/p/webapp-improved
Other
0 stars 0 forks source link

Only one gettext domain is loadad, others get ignored #85

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.

import i18n

# add multiple domain catalogs for gettext
i18n.default_config['domains'] = ['messages1', 'messages2']

What is the expected output? What do you see instead?
It only loads messages from the last domain in the 'domains' list instead of 
merging them.

What version of the product are you using? On what operating system?
Webapp2 2.5.2 on Google App Engine

Please provide any additional information below.
In the 'I18nStore.load_translations' method there is an if _trans is an 
instance of NullTranslations, but python gettext documentation 
(http://docs.python.org/2/library/gettext.html#the-nulltranslations-class) 
states that all translations objects inherit from NullTranslations, so this 
always returns True and sets 'trans_null' instead of merging all provided 
domains translations into 'trans'.

A possible fix is to replace:
    if isinstance(_trans, NullTranslations):
with this:
    if isinstance(_trans, i18n.NullTranslations) and \
            not isinstance(_trans, babel.support.Translations):

Original issue reported on code.google.com by mytix.m...@gmail.com on 3 Oct 2013 at 4:53