Functions¶
_(key, *args, locale='en', locales_root=Path('locale'))
async
¶
Get value of locale string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
str
|
The last key of the locale's keys path. |
required |
*args
|
str
|
Path to key like: |
()
|
locale
|
str | None
|
Locale to looked up in. Defaults to "en". |
'en'
|
locales_root
|
str | Path
|
Folder where locales are located. Defaults to Path("locale"). |
Path('locale')
|
Returns:
| Name | Type | Description |
|---|---|---|
Any |
Any
|
Value of provided locale key. Is usually |
in_all_locales(key, *args, locales_root=Path('locale'))
async
¶
Get value of the provided key and path in all available locales.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
str
|
The last key of the locale's keys path. |
required |
*args
|
str
|
Path to key like: |
()
|
locales_root
|
str | Path
|
Folder where locales are located. Defaults to Path("locale"). |
Path('locale')
|
Returns:
| Type | Description |
|---|---|
list[Any]
|
list[Any]: List of values in all locales. |
in_every_locale(key, *args, locales_root=Path('locale'))
async
¶
Get value of the provided key and path in every available locale with locale tag.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
str
|
The last key of the locale's keys path. |
required |
*args
|
str
|
Path to key like: |
()
|
locales_root
|
str | Path
|
Folder where locales are located. Defaults to Path("locale"). |
Path('locale')
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
dict[str, Any]: Locale is a key, and it's value from locale file is a value. |