iamai.i18n module

class iamai.i18n.TranslationManager(src_dir='iamai', locale_dir='locale', pot_file='i18n.pot')[source]

Bases: object

clean()[source]
compile_mo()[source]
generate_po(languages=None)[source]
generate_pot()[source]
update_po()[source]
iamai.i18n.compile_mo_files(localedir: str, domain: str) None[source]

Compile .po files to .mo files

Parameters:
  • localedir (str) – locale directory

  • domain (str) – locale domain

iamai.i18n.setup_gettext(domain: str = 'i18n', localedir: str = '/home/docs/checkouts/readthedocs.org/user_builds/iamai/envs/latest/lib/python3.10/site-packages/iamai/locale', languages: List[str] = ['en']) GNUTranslations[source]

Setup gettext

Parameters:
  • domain (str, optional) – Defaults to os.path.basename(__file__).strip(“.py”).

  • localedir (str, optional) – Defaults to localedir.

  • languages (List[str], optional) – Defaults to [“en”].

Returns:

The translation object

Return type:

GNUTranslations