Fix unused default locale in I18nMiddleware (#562) (#563)

Co-authored-by: Alex Root Junior <jroot.junior@gmail.com>
This commit is contained in:
alfred richardsn 2021-07-05 22:12:52 +00:00 committed by GitHub
parent 2e207c636c
commit 899228904a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -132,11 +132,11 @@ class I18nMiddleware(BaseMiddleware):
user: Optional[types.User] = types.User.get_current()
locale: Optional[Locale] = user.locale if user else None
if locale:
if locale and locale.language in self.locales:
*_, data = args
language = data['locale'] = locale.language
return language
return None
return self.default
async def trigger(self, action, args):
"""