Module egg_translations
[hide private]

Module egg_translations

source code

Egg Translations Management Package


Authors:
Brian Kirsch - bkirsch@osafoundation.org, Markku Mielityinen - mmmm@osafoundation.org

Contact: Grant Baillie - grant@osafoundation.org

Copyright: Copyright (c) 2006-2009 Open Source Applications Foundation

License: Apache License, Version 2.0

Classes [hide private]
  INIParsingException
  DefaultTranslations
  EggTranslations
Functions [hide private]
 
stripCountryCode(locale)
Removes the country code from a language / country code locale.
source code
 
hasCountryCode(locale)
Returns True if the locale passed contains a country code such as "es_UY" otherwise False.
source code
 
stripEncodingCode(locale)
Strips additional information off of a locale definition
source code
Variables [hide private]
  logger = logging.getLogger(__name__)
Function Details [hide private]

stripCountryCode(locale)

source code 
Removes the country code from a language / country code locale. If passed "es_UY" would return "es"
Parameters:
  • locale (ASCII str) - a valid str language / country code locale
Returns:
str with country code removed

hasCountryCode(locale)

source code 
Returns True if the locale passed contains a country code such as "es_UY" otherwise False.
Parameters:
  • locale (ASCII str) - a str locale
Returns:
boolean True if locale contains country code otherwise False

stripEncodingCode(locale)

source code 

Strips additional information off of a locale definition

A locale can contain additional information beyond the two digit language and country codes.

For example an encoding can be specified: such as "en_US.UTF-8"

If passed "en_US.UTF-8" this method would return "en_US"
Parameters:
  • locale (ASCII str) - a str locale
Returns:
str stripped version of locale or original locale str if no stripping was required.