37 lines
1.3 KiB
Python
37 lines
1.3 KiB
Python
class i18n:
|
|
@staticmethod
|
|
def set_lang(lang, encoding=None) -> None:
|
|
"""
|
|
Set the language and encoding for the locale file.
|
|
:param lang: Use the language file with the given language.
|
|
:param encoding: Encoding of the language file.
|
|
:return: None
|
|
"""
|
|
@staticmethod
|
|
def get_phrase(key: str, **kwargs) -> str:
|
|
"""
|
|
Get the phrase from the locale file. If the phrase is not found, return the key in uppercase.
|
|
|
|
:param key: Key to search in the locale file.
|
|
:param kwargs: Arguments to format the phrase.
|
|
:return: The phrase from the locale file.
|
|
"""
|
|
@staticmethod
|
|
def __call__(key: str, **kwargs) -> str:
|
|
"""
|
|
Get the phrase from the locale file. If the phrase is not found, return the key in uppercase.
|
|
|
|
:param key: Key to search in the locale file.
|
|
:param kwargs: Arguments to format the phrase.
|
|
:return: The phrase from the locale file.
|
|
"""
|
|
@staticmethod
|
|
def __getitem__(key: str) -> str:
|
|
"""
|
|
Get the phrase from the locale file. If the phrase is not found, return the key in uppercase.
|
|
|
|
:param key: Key to search in the locale file.
|
|
:return: The phrase from the locale file.
|
|
"""
|
|
class i10n(i18n): ...
|