locale is now Union[str, None]

This commit is contained in:
Profitroll 2023-08-06 12:50:34 +02:00
parent 7c756d7065
commit bc5be37ff1
Signed by: profitroll
GPG Key ID: FA35CAB49DACD3B2
2 changed files with 4 additions and 4 deletions

View File

@ -10,7 +10,7 @@ from libbot.i18n.classes.bot_locale import BotLocale
async def _( async def _(
key: str, key: str,
*args: str, *args: str,
locale: str = "en", locale: Union[str, None] = "en",
locales_root: Union[str, Path] = Path("locale"), locales_root: Union[str, Path] = Path("locale"),
) -> Any: ) -> Any:
"""Get value of locale string """Get value of locale string
@ -18,7 +18,7 @@ async def _(
### Args: ### Args:
* key (`str`): The last key of the locale's keys path. * key (`str`): The last key of the locale's keys path.
* *args (`list`): Path to key like: `dict[args][key]`. * *args (`list`): Path to key like: `dict[args][key]`.
* locale (`str`): Locale to looked up in. Defaults to `"en"`. * locale (`Union[str, None]`): Locale to looked up in. Defaults to `"en"`.
* locales_root (`Union[str, Path]`, *optional*): Folder where locales are located. Defaults to `Path("locale")`. * locales_root (`Union[str, Path]`, *optional*): Folder where locales are located. Defaults to `Path("locale")`.
### Returns: ### Returns:

View File

@ -8,7 +8,7 @@ import libbot
def _( def _(
key: str, key: str,
*args: str, *args: str,
locale: str = "en", locale: Union[str, None] = "en",
locales_root: Union[str, Path] = Path("locale"), locales_root: Union[str, Path] = Path("locale"),
) -> Any: ) -> Any:
"""Get value of locale string """Get value of locale string
@ -16,7 +16,7 @@ def _(
### Args: ### Args:
* key (`str`): The last key of the locale's keys path. * key (`str`): The last key of the locale's keys path.
* *args (`list`): Path to key like: `dict[args][key]`. * *args (`list`): Path to key like: `dict[args][key]`.
* locale (`str`): Locale to looked up in. Defaults to `"en"`. * locale (`Union[str, None]`): Locale to looked up in. Defaults to `"en"`.
* locales_root (`Union[str, Path]`, *optional*): Folder where locales are located. Defaults to `Path("locale")`. * locales_root (`Union[str, Path]`, *optional*): Folder where locales are located. Defaults to `Path("locale")`.
### Returns: ### Returns: