linkcheck.i18n

Application internationalization support.

Functions

get_encoded_writer([out, encoding, errors])

Get wrapped output writer with given encoding and error handling.

get_headers_lang(headers)

Return preferred supported language in given HTTP headers.

get_lang(lang)

Return lang if it is supported, or the default language.

get_locale()

Search the default platform locale and norm it.

get_translator(domain, directory[, …])

Search the appropriate GNUTranslations class.

init(domain, directory[, loc])

Initialize this gettext i18n module.

install_builtin(translator, do_unicode)

Install _() and _n() gettext methods into default namespace.

install_language(language)

Install translation service routines into default namespace.

lang_name(lang)

Return full name of given language.

lang_trans(lang, curlang)

Return translated full name of given language.

norm_locale(loc)

Normalize a locale.

Classes

NullTranslator([fp])

A dummy translation class always installing its gettext methods into the default namespace.

Translator([fp])

A translation class always installing its gettext methods into the default namespace.

class linkcheck.i18n.NullTranslator(fp=None)[source]

Bases: gettext.NullTranslations

A dummy translation class always installing its gettext methods into the default namespace.

install(do_unicode)[source]

Install gettext methods into the default namespace.

class linkcheck.i18n.Translator(fp=None)[source]

Bases: gettext.GNUTranslations

A translation class always installing its gettext methods into the default namespace.

install(do_unicode)[source]

Install gettext methods into the default namespace.

linkcheck.i18n.get_encoded_writer(out=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>, encoding=None, errors='replace')[source]

Get wrapped output writer with given encoding and error handling.

linkcheck.i18n.get_headers_lang(headers)[source]

Return preferred supported language in given HTTP headers.

linkcheck.i18n.get_lang(lang)[source]

Return lang if it is supported, or the default language.

linkcheck.i18n.get_locale()[source]

Search the default platform locale and norm it. :returns (locale, encoding) :rtype (string, string)

linkcheck.i18n.get_translator(domain, directory, languages=None, translatorklass=<class 'linkcheck.i18n.Translator'>, fallback=False, fallbackklass=<class 'linkcheck.i18n.NullTranslator'>)[source]

Search the appropriate GNUTranslations class.

linkcheck.i18n.init(domain, directory, loc=None)[source]

Initialize this gettext i18n module. Searches for supported languages and installs the gettext translator class.

linkcheck.i18n.install_builtin(translator, do_unicode)[source]

Install _() and _n() gettext methods into default namespace.

linkcheck.i18n.install_language(language)[source]

Install translation service routines into default namespace.

linkcheck.i18n.lang_name(lang)[source]

Return full name of given language.

linkcheck.i18n.lang_trans(lang, curlang)[source]

Return translated full name of given language.

linkcheck.i18n.norm_locale(loc)[source]

Normalize a locale.