mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-14 19:00:23 +00:00
Merge pull request #168 from Birdi7/add_cache_enable_lazygettext
Add enable_cache parameter to lazy_gettext
This commit is contained in:
commit
2627a51f79
1 changed files with 3 additions and 2 deletions
|
|
@ -107,7 +107,7 @@ class I18nMiddleware(BaseMiddleware):
|
|||
else:
|
||||
return translator.ngettext(singular, plural, n)
|
||||
|
||||
def lazy_gettext(self, singular, plural=None, n=1, locale=None) -> LazyProxy:
|
||||
def lazy_gettext(self, singular, plural=None, n=1, locale=None, enable_cache=True) -> LazyProxy:
|
||||
"""
|
||||
Lazy get text
|
||||
|
||||
|
|
@ -115,9 +115,10 @@ class I18nMiddleware(BaseMiddleware):
|
|||
:param plural:
|
||||
:param n:
|
||||
:param locale:
|
||||
:param enable_cache:
|
||||
:return:
|
||||
"""
|
||||
return LazyProxy(self.gettext, singular, plural, n, locale)
|
||||
return LazyProxy(self.gettext, singular, plural, n, locale, enable_cache=enable_cache)
|
||||
|
||||
# noinspection PyMethodMayBeStatic,PyUnusedLocal
|
||||
async def get_user_locale(self, action: str, args: Tuple[Any]) -> str:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue