From b67a57eb04973074fe049f5deaf13cf34533c3ba Mon Sep 17 00:00:00 2001 From: Alex Root Junior Date: Mon, 14 Feb 2022 00:57:25 +0200 Subject: [PATCH] Disabled cache for I18n LazyProxy --- aiogram/utils/i18n/context.py | 2 +- aiogram/utils/i18n/core.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/aiogram/utils/i18n/context.py b/aiogram/utils/i18n/context.py index 13de4d9c..245fee34 100644 --- a/aiogram/utils/i18n/context.py +++ b/aiogram/utils/i18n/context.py @@ -16,7 +16,7 @@ def gettext(*args: Any, **kwargs: Any) -> str: def lazy_gettext(*args: Any, **kwargs: Any) -> LazyProxy: - return LazyProxy(gettext, *args, **kwargs) + return LazyProxy(gettext, *args, **kwargs, enable_cache=False) ngettext = gettext diff --git a/aiogram/utils/i18n/core.py b/aiogram/utils/i18n/core.py index d564fdb3..830ead54 100644 --- a/aiogram/utils/i18n/core.py +++ b/aiogram/utils/i18n/core.py @@ -118,4 +118,6 @@ class I18n(ContextInstanceMixin["I18n"]): def lazy_gettext( self, singular: str, plural: Optional[str] = None, n: int = 1, locale: Optional[str] = None ) -> LazyProxy: - return LazyProxy(self.gettext, singular=singular, plural=plural, n=n, locale=locale) + return LazyProxy( + self.gettext, singular=singular, plural=plural, n=n, locale=locale, enable_cache=False + )