ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> i18n-sig
i18n-sig
[I18n-sig] Strange gettext.find results
by Michael Scheper other posts by this author
Sep 25 2009 6:53PM messages near this date
Pre-confirmation | [I18n-sig] Looking to buy Mannatech Ambrotose & Glyconutrients products?
Hi everyone,

The documentation is a little sketchy, but I'm not sure that 
gettext.find is behaving the way it should. It's definitely not behaving 
how I want it to.

To illustrate, I've created two directories in /tmp/gettext called 
'en_US' and just 'en'. Each contains an LC_MESSAGES directory, which in 
turn contain test.mo and test.po.

When I run this:

    gettext.find('test', '/tmp/gettext', ['en','en_US'], True)


the results I get are this:

    ['/tmp/gettext/en_US/LC_MESSAGES/test.mo',
    '/tmp/gettext/en/LC_MESSAGES/test.mo']


The documentation states that it should return 'a list of all file 
names, in the order in which they appear in the languages list', but 
it's actually doing the exact opposite. The upshot is that when I 
specify just 'en', I'm still getting en_US translations.

I think one of three things is happening:

   1. I'm misunderstanding something, despite searching this forum and
      doing a lot of Googling
   2. When searching for the 'en' locale, find just grabs the first
      English locale it comes across, regardless of the territory---it
      probably depends on their order in the file system
   3. When searching for the 'en' locale, find defaults to U.S. English,
      a poor choice because U.S. English has far more spelling and
      formatting variations than any other version of English (there are
      far fewer differences between, say, en_AU and en_GB, or even en_ZA
      and en_CA, than en_US and any other)

If it's number 1, could somebody help me out? If it's number 2 or 3, 
does anybody know of an elegant workaround, and should it be considered 
a bug?

What I want is for U.S. English users to see messages from en_US, and 
users who prefer other forms of English (Australian English, Canadian 
English, British English, etc.) to see just en. Creating separate 
locales for each of them---there are a dozen or so---seems impractical.

Advice?

Thanks,
Michael Scheper.

P.S: Changing the system locale doesn't seem to make any difference.

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved