Language

babelfish.language.LANGUAGES

Available language codes

babelfish.language.LANGUAGE_MATRIX

List of languages in the ISO-639-3 as namedtuple of alpha3, alpha3b, alpha3t, alpha2, scope, type, name and comment

class babelfish.language.LanguageConverterManager

ConverterManager for language converters

babelfish.language.LANGUAGE_CONVERTERS

Instance of LanguageConverterManager

class babelfish.language.LanguageMeta

The Language metaclass

Dynamically redirect Language.frommycode() to Language.fromcode() with the mycode converter

class babelfish.language.Language(language, country=None, script=None, unknown=None)

A human language

A human language is composed of a language part following the ISO-639 standard and can be country-specific when a Country is specified.

The Language is extensible with custom converters (see Custom Converters)

Parameters:
  • language (string) – the language as a 3-letter ISO-639-3 code
  • country (string or Country or None) – the country (if any) as a 2-letter ISO-3166 code or Country instance
  • script (string or Script or None) – the script (if any) as a 4-letter ISO-15924 code or Script instance
  • unknown (string or None) – the unknown language as a three-letters ISO-639-3 code to use as fallback
Raise:

ValueError if the language could not be recognized and unknown is None

classmethod fromcode(code, converter)

Create a Language by its code using converter to reverse() it

Parameters:
Returns:

the corresponding Language instance

Return type:

Language

classmethod fromietf(ietf)

Create a Language by from an IETF language code

Parameters:ietf (string) – the ietf code
Returns:the corresponding Language instance
Return type:Language