[Sugar-devel] [FEATURE] Enhanced Gettext

Sascha Silbe sascha-ml-ui-sugar-devel at silbe.org
Tue Jan 5 12:58:57 EST 2010


On Tue, Jan 05, 2010 at 12:33:31PM -0500, Benjamin M. Schwartz wrote:

>> Can't we do this with unmodified gettext by setting the LOCALEDIR 
>> envvar?
> s/LOCALEDIR/TEXTDOMAINDIR/
No because the default is hardcoded in Python (so no environment 
variable would get used unless explicitly passed by the activity):

sascha.silbe at twin:~$ grep prefix /usr/lib/python2.5/gettext.py
_default_localedir = os.path.join(sys.prefix, 'share', 'locale')


Actually it looks like gettext.py doesn't even support multiple 
directories, so either the site-specific directory must contain _all_ 
translations (including those that are unmodified) or we need to wrap 
some of the gettext code:

def find(domain, localedir=None, languages=None, all=0):
[...]
      if localedir is None:
          localedir = _default_localedir
[...]
     for lang in nelangs:
[...]
          mofile = os.path.join(localedir, lang, 'LC_MESSAGES', '%s.mo' % 
domain)


CU Sascha

-- 
http://sascha.silbe.org/
http://www.infra-silbe.de/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 489 bytes
Desc: Digital signature
Url : http://lists.sugarlabs.org/archive/sugar-devel/attachments/20100105/02594062/attachment.pgp 


More information about the Sugar-devel mailing list