Closed DI84 closed 8 months ago
@akx: This is an important bug for us in the current version 2.13.0. Would it be possible to release a 2.13.1 as soon as a fix for this is available?
This PR would fix it: #1038
Oops, great catch. Will release a patch version soon...
Fixed in https://github.com/python-babel/babel/releases/tag/v2.13.1. Sorry for the inconvenience and thanks for spotting and fixing the issue.
Description
The method "_locales_to_names()" from the "Translations" class (babel/support.py) does not correctly convert a given Locale to a List of language names.
Instead of calling
str()
on the parameter variablelocales
(note the -s), it is called on the module objectlocale
(without -s) if the parameter variablelocales
is an instance ofLocale
(see code below) .The 4th lowest line should read
return [str(locales)]
instead ofreturn [str(locale)]
(as inlocale
the module object).As a result, the
gettext.find()
call in theload
method of theTranslations
class does not return a valid .mo file path and therefore the translations cannot be loaded.