mkv2cast.i18n

Internationalization (i18n) support for mkv2cast.

Uses Python’s gettext module for translations. Supports: English (en), French (fr), Spanish (es), Italian (it), German (de)

Functions

detect_system_language()

Detect the system language from environment.

get_current_language()

Get the currently configured language code.

get_locales_dir()

Get the locales directory path.

ngettext(singular, plural, n)

Translate a message with singular/plural forms.

setup_i18n([lang])

Configure internationalization and return the translation function.

mkv2cast.i18n.get_locales_dir() Path[source]

Get the locales directory path.

mkv2cast.i18n.detect_system_language() str[source]

Detect the system language from environment. Returns language code (e.g., ‘fr’, ‘en’, ‘es’).

mkv2cast.i18n.setup_i18n(lang: str | None = None) Callable[[str], str][source]

Configure internationalization and return the translation function.

Parameters:

lang – Language code (e.g., ‘fr’, ‘en’). If None, auto-detect from system.

Returns:

Translation function that takes a string and returns translated string.

mkv2cast.i18n.get_current_language() str[source]

Get the currently configured language code.

mkv2cast.i18n.ngettext(singular: str, plural: str, n: int) str[source]

Translate a message with singular/plural forms.

Parameters:
  • singular – Singular form of the message.

  • plural – Plural form of the message.

  • n – Count to determine which form to use.

Returns:

Appropriate translated form based on count.