Package i18n :: Module i18nmanager
[hide private]
[frames] | no frames]

Module i18nmanager

source code

Classes [hide private]
  I18nManager
  I18nException
  I18nFileSystemHandler
  I18nLocale
Functions [hide private]
 
wxIsAvailable() source code
 
getPyICULocale()
Returns the current PyICU Locale object of None
source code
 
setPyICULocale(locale)
Sets the c{PyICU.Locale} to the value passed in c{str} locale argument.
source code
 
isValidPyICULocale(locale)
Returns True if the locale string passed is in the list of available PyICU locales otherwise false.
source code
 
convertPyICULocale(iculocale)
Converts a c{PyICU.Locale} to a ISO c{str} representation of the locale.
source code
 
setPythonLocale(lc)
Sets the Python locale object to the value in lc.
source code
 
setEnvironmentLocale(locale)
Sets the Operating System environmental variables LANG, LC_ALL, LC_MESSAGES, and LANGUAGE to the value contained in locale
source code
 
getWxLocale()
Returns the current wxPython Locale object or None
source code
 
setWxLocale(locale, i18nMan)
Sets the c{wx.Locale} to the value passed in c{str} locale argument.
source code
 
findWxLocale(locale, i18nMan)
Looks up the wx Language integer code.
source code
Variables [hide private]
  _PYICU_LOCALE = <Locale: en_US>
  _WX_LOCALE = <Locale: en_US>
  _WX_AVAILABLE = True
Function Details [hide private]

getPyICULocale()

source code 
Returns the current PyICU Locale object of None
Returns:
a c{PyICU.Locale} object or None

setPyICULocale(locale)

source code 

Sets the c{PyICU.Locale} to the value passed in c{str} locale argument.

If the locale passed in not a valid / supported PyICU locale a c{I18nException} is raised.
Parameters:
  • locale (ASCII c{str}) - a c{str} locale

isValidPyICULocale(locale)

source code 
Returns True if the locale string passed is in the list of available PyICU locales otherwise false.
Parameters:
  • locale (ASCII c{str}) - a c{str} locale
Returns:
c{boolean} True if a valid PyICU locale otherwise False

convertPyICULocale(iculocale)

source code 
Converts a c{PyICU.Locale} to a ISO c{str} representation of the locale.
Parameters:
  • iculocale (c{PyICU.Locale}) - A PyICU locale instance
Returns:
c{str} ISO locale code

setPythonLocale(lc)

source code 
Sets the Python locale object to the value in lc.
Parameters:
  • locale (ASCII c{str}) - a c{str} locale

setEnvironmentLocale(locale)

source code 
Sets the Operating System environmental variables LANG, LC_ALL, LC_MESSAGES, and LANGUAGE to the value contained in locale
Parameters:
  • locale (ASCII c{str}) - a c{str} locale

getWxLocale()

source code 
Returns the current wxPython Locale object or None
Returns:
a c{wx.Locale} object or None

setWxLocale(locale, i18nMan)

source code 

Sets the c{wx.Locale} to the value passed in c{str} locale argument.

If the locale passed is not a valid wx locale and and that locale consists of a lang and country code, the country code is stripped and the lang code is set as the c{wx.Locale}.

This logic is employed in the cases such as "es_UY" where wxPython does not have a translation for 'es_UY' but does have one for 'es'.

If the locale is still not valid after attempting to use just the lang code a c{I18nException} is raised.
Parameters:
  • locale (ASCII c{str}) - a c{str} locale

findWxLocale(locale, i18nMan)

source code 

Looks up the wx Language integer code. The code is needed to create a c{wx.Locale} object.

For example the code for "en_US" is 58.

If c{wx.FindLanguageInfo(locale)} returns None then wx does not support the requested locale or the lang / country codes are invalid.

the findWxLocale method can raise the following exceptions:
  1. c{I18nException}
Parameters:
  • locale (c{str}) - a c{str} locale
Returns:
a c{wx.Locale} object