Hi

I just wrote a little piece of code that read the locale in order to determine 
which language tux should speak.

Here it is :

def find_language():
    env=os.environ['LANG']
    dict1={ 'en_US':'US',   #American English
            'nl_BE':'B'}    #Belgian Dutch
    dict2={ 'fr':'FR',      #French
            'de':'D',       #Deutsch
            'en':'GB',      #British English
            'ar':'AR',      #Arabic
            'da':'DK',      #Danish
            'es':'E',       #Spanish
            'it':'I',       #Italian
            'nl':'NL',      #Dutch
            'nb':'NO',      #Norwegian
            'pt':'P',       #Portuguese
            'sv':'S'}       #Swedish
    if dict1.has_key(env[:5]):
        return dict1[env[:5]]
    elif dict2.has_key(env[:2]):
        return dict2[env[:2]]
    else:
        return 'US'

I think it can be useful. Maybe even in the svn (in order to determine default 
language, and advice about downloading languages).

What do you think about it ?

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
tux-droid-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-user

Reply via email to