Fix i18n relative path + reformat using pre-commit (#1740)

* fix: i18n relative path + reformat using `pre-commit`

* chore: changes

---------

Co-authored-by: Katant <katantdev@mail.ru>
This commit is contained in:
Artem Kushnerov 2026-01-02 08:01:02 +10:00 committed by GitHub
parent b27ca9a45d
commit 7201e82238
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 9 additions and 10 deletions

View file

@ -21,7 +21,7 @@ class I18n(ContextInstanceMixin["I18n"]):
default_locale: str = "en",
domain: str = "messages",
) -> None:
self.path = Path(path)
self.path = Path(path).resolve()
self.default_locale = default_locale
self.domain = domain
self.ctx_locale = ContextVar("aiogram_ctx_locale", default=default_locale)
@ -66,9 +66,9 @@ class I18n(ContextInstanceMixin["I18n"]):
translations: dict[str, gettext.GNUTranslations] = {}
for name in self.path.iterdir():
if not (self.path / name).is_dir():
if not name.is_dir():
continue
mo_path = self.path / name / "LC_MESSAGES" / (self.domain + ".mo")
mo_path = name / "LC_MESSAGES" / (self.domain + ".mo")
if mo_path.exists():
with mo_path.open("rb") as fp: