diff options
author | Wojtek Kosior <koszko@koszko.org> | 2022-10-11 10:26:55 +0200 |
---|---|---|
committer | Wojtek Kosior <koszko@koszko.org> | 2022-10-11 13:12:11 +0200 |
commit | 0c8d70daae4c4dfc989edad465db94ffc665416d (patch) | |
tree | 86f1b23e863b2dae1efd00686d46890b4b72ccb2 /src/hydrilla/translations.py | |
parent | 9074d98f711b6ccc099df8bccb1ed28390bcf0da (diff) | |
download | haketilo-hydrilla-0c8d70daae4c4dfc989edad465db94ffc665416d.tar.gz haketilo-hydrilla-0c8d70daae4c4dfc989edad465db94ffc665416d.zip |
[builder][server] restore compatibility with python 3.7
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) |