BotLocale¶
Small addon that can be used by bot clients' classes in order to minimize I/O
_(key, *args, locale=None)
¶
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 config's |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
Any |
Any
|
Value of provided locale key. Is usually |
__init__(default_locale='en', locales_root=Path('locale'))
¶
in_all_locales(key, *args)
¶
in_every_locale(key, *args)
¶
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: |
()
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
dict[str, Any]: Locale is a key, and it's value from locale file is a value. |