diff options
Diffstat (limited to 'src/hydrilla/translations.py')
-rw-r--r-- | src/hydrilla/translations.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/hydrilla/translations.py b/src/hydrilla/translations.py index 79b9128..ce6e779 100644 --- a/src/hydrilla/translations.py +++ b/src/hydrilla/translations.py @@ -30,9 +30,9 @@ from __future__ import annotations import locale as lcl import gettext +import typing as t from pathlib import Path -from typing import Optional here = Path(__file__).resolve().parent @@ -68,7 +68,7 @@ def select_best_locale() -> str: # https://stackoverflow.com/questions/3425294/how-to-detect-the-os-default-language-in-python # I am not going to surrender to Microbugs' nonfree, crappy OS to test it, # so the lines inside try: block may actually fail. - locale: Optional[str] = lcl.getdefaultlocale()[0] + locale: t.Optional[str] = lcl.getdefaultlocale()[0] try: from ctypes.windll import kernel32 as windll # type: ignore locale = lcl.windows_locale[windll.GetUserDefaultUILanguage()] @@ -77,9 +77,9 @@ def select_best_locale() -> str: return locale if locale in supported_locales else default_locale -translations: dict[str, gettext.NullTranslations] = {} +translations: t.Dict[str, gettext.NullTranslations] = {} -def translation(locale: Optional[str] = None) -> gettext.NullTranslations: +def translation(locale: t.Optional[str] = None) -> gettext.NullTranslations: """ Configure translations for domain 'messages' and return the object that represents them. If the requested locale is not available, fall back to @@ -100,7 +100,7 @@ def translation(locale: Optional[str] = None) -> gettext.NullTranslations: return translations[locale] -def smart_gettext(msg: str, locale: Optional[str] = None) -> str: +def smart_gettext(msg: str, locale: t.Optional[str] = None) -> str: """....""" return translation(locale).gettext(msg) |