Classes
LanguageInfo
TypedDict for language information returned by _languages().
All fields except baseurl are require…
LanguageInfo
TypedDict for language information returned by _languages().
All fields except baseurl are required. baseurl is optional.
Inherits from
TypedDictAttributes
| Name | Type | Description |
|---|---|---|
code |
str |
|
name |
str |
|
hreflang |
str |
|
baseurl |
str |
|
weight |
int |
Functions
_warn_missing_translation
Log a debug warning when a translation key is missing.
Only warns once per key/lang combination pe…
_warn_missing_translation
def _warn_missing_translation(key: str, lang: str) -> None
Log a debug warning when a translation key is missing.
Only warns once per key/lang combination per build to avoid log spam.
Parameters 2
| Name | Type | Default | Description |
|---|---|---|---|
key |
str |
— | The missing translation key |
lang |
str |
— | The language that was checked |
reset_translation_warnings
Reset the set of warned translation keys.
Useful for testing or when starting a new build.
reset_translation_warnings
def reset_translation_warnings() -> None
Reset the set of warned translation keys.
Useful for testing or when starting a new build.
register
Register i18n helpers into Jinja2 environment.
Globals:
- t
- current_lang
- languages
- a…
register
def register(env: Environment, site: Site) -> None
Register i18n helpers into Jinja2 environment.
Globals:
- t
- current_lang
- languages
- alternate_links
- locale_date
Parameters 2
| Name | Type | Default | Description |
|---|---|---|---|
env |
Environment |
— | |
site |
Site |
— |
_languages
Get normalized list of configured languages.
_languages
def _languages(site: Site) -> list[LanguageInfo]
Get normalized list of configured languages.
Parameters 1
| Name | Type | Default | Description |
|---|---|---|---|
site |
Site |
— |
Returns
List of LanguageInfo dictionaries with code, name, hreflang, and optional baseurl/weight.list[LanguageInfo]
—