gettext.translation(domain, localedir=None, languages=None, class_=None, fallback=False, codeset=None)
Return a Translations
instance based on the domain, localedir, and languages, which are first passed to find()
to get a list of the associated .mo
file paths. Instances with identical .mo
file names are cached. The actual class instantiated is either class_ if provided, otherwise GNUTranslations
. The class’s constructor must take a single file object argument. If provided, codeset will change the charset used to encode translated strings in the lgettext()
and lngettext()
methods.
If multiple files are found, later files are used as fallbacks for earlier ones. To allow setting the fallback, copy.copy()
is used to clone each translation object from the cache; the actual instance data is still shared with the cache.
If no .mo
file is found, this function raises OSError
if fallback is false (which is the default), and returns a NullTranslations
instance if fallback is true.
Please login to continue.