betty.locale package - Betty 0.4.0a4 documentation

Hide navigation sidebar
Hide table of contents sidebar
Skip to content
Back to top
View this page
Toggle table of contents sidebar

# betty.locale package

## Submodules

- betty.locale.babel module
  - `run_babel()`
- betty.locale.date module
  - `Date`
    - `Date.__init__()`
    - `Date.comparable`
    - `Date.complete`
    - `Date.datey_dump_linked_data()`
    - `Date.day`
    - `Date.dump_linked_data()`
    - `Date.fuzzy`
    - `Date.linked_data_schema()`
    - `Date.month`
    - `Date.parts`
    - `Date.to_range()`
    - `Date.year`
  - `DateRange`
    - `DateRange.__init__()`
    - `DateRange.comparable`
    - `DateRange.datey_dump_linked_data()`
    - `DateRange.dump_linked_data()`
    - `DateRange.end`
    - `DateRange.end_is_boundary`
    - `DateRange.linked_data_schema()`
    - `DateRange.start`
    - `DateRange.start_is_boundary`
  - `IncompleteDateError`
  - `ref_date()`
  - `ref_date_range()`
  - `ref_datey()`
- betty.locale.localizable module
  - `Localizable`
    - `Localizable.localize()`
  - `call()`
  - `format()`
  - `gettext()`
  - `ngettext()`
  - `npgettext()`
  - `pgettext()`
  - `plain()`
- betty.locale.localized module
  - `Localized`
    - `Localized.__init__()`
    - `Localized.dump_linked_data()`
    - `Localized.linked_data_schema()`
    - `Localized.locale`
  - `negotiate_localizeds()`
- betty.locale.localizer module
  - `Localizer`
    - `Localizer.__init__()`
    - `Localizer.format_date()`
    - `Localizer.format_date_range()`
    - `Localizer.format_datetime_datetime()`
    - `Localizer.format_datey()`
    - `Localizer.gettext()`
    - `Localizer.locale`
    - `Localizer.ngettext()`
    - `Localizer.npgettext()`
    - `Localizer.pgettext()`
  - `LocalizerRepository`
    - `LocalizerRepository.__init__()`
    - `LocalizerRepository.coverage()`
    - `LocalizerRepository.get()`
    - `LocalizerRepository.get_negotiated()`
    - `LocalizerRepository.locales`
- betty.locale.translation module
  - `init_translation()`
  - `update_translations()`

## Module contents

Provide the Locale API.

exception betty.locale.LocaleNotFoundError

  Bases: `RuntimeError`

  Raise when a locale could not be found.

  __init__(locale: str) → None

betty.locale.get_data(locale: str | Locale) → Locale

  Get locale metadata.

  Raises:

    betty.locale.LocaleNotFoundError – Raised if the given locale cannot be found.

betty.locale.get_display_name(locale: str | Locale, display_locale: str | Locale | None = None) → str | None

  Return a locale’s human-readable display name.

betty.locale.negotiate_locale(preferred_locales: str | Locale | Sequence[str | Locale], available_locales: Sequence[str | Locale]) → Locale | None

  Negotiate the preferred locale from a sequence.

betty.locale.to_babel_identifier(locale: str | Locale) → str

  Convert a locale or locale metadata to a Babel locale identifier.

betty.locale.to_locale(locale: str | Locale) → str

  Ensure that a locale or locale metadata is a locale.