diff --git a/src/pendulum/locales/locale.py b/src/pendulum/locales/locale.py index 951ba8be..1e4ea6bb 100644 --- a/src/pendulum/locales/locale.py +++ b/src/pendulum/locales/locale.py @@ -5,7 +5,6 @@ from pathlib import Path from typing import Any from typing import ClassVar -from typing import Dict from typing import cast @@ -23,12 +22,15 @@ def __init__(self, locale: str, data: Any) -> None: @classmethod def load(cls, locale: str | Locale) -> Locale: - from importlib import import_module, resources + from importlib import import_module + from importlib import resources if isinstance(locale, Locale): return locale locale = cls.normalize_locale(locale) + if locale == "uk": + locale = "ua" if locale in cls._cache: return cls._cache[locale] @@ -93,7 +95,7 @@ def match_translation(self, key: str, value: Any) -> dict[str, str] | None: if value not in translations.values(): return None - return cast(Dict[str, str], {v: k for k, v in translations.items()}[value]) + return cast(dict[str, str], {v: k for k, v in translations.items()}[value]) def __repr__(self) -> str: return f"{self.__class__.__name__}('{self._locale}')"