-
Notifications
You must be signed in to change notification settings - Fork 438
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can not initialize a catalog from a template with an empty string value for "Language" header #665
Comments
Looks like the |
This is a bit puzzling... On one side: babel/babel/messages/frontend.py Lines 619 to 622 in 2abad80
On the other: babel/babel/messages/pofile.py Lines 328 to 369 in 2abad80
and babel/babel/messages/catalog.py Lines 242 to 254 in 2abad80
|
The tools 'xgettext' from GNU gettext and 'pot-create' from lingua both produce PO-template files containing a 'Language' header with an empty string as value. Babel has issues creating catalogs out of such templates. It wants to parse the PO-template as a normal PO-catalog using the locale of the target catalog, because it helps producing the correct plurals. But it overwrites this locale when parsing the 'Language' header and then it can not produce a valid catalog. Ignoring the 'Language' header when it is known that the file being processed is a template avoids this issue. GitHub: python-babel#665
The tools 'xgettext' from GNU gettext and 'pot-create' from lingua both produce PO-template files containing a 'Language' header with an empty string as value. Babel has issues creating catalogs out of such templates. It wants to parse the PO-template as a normal PO-catalog using the locale of the target catalog, because it helps producing the correct plurals. But it overwrites this locale when parsing the 'Language' header and then it can not produce a valid catalog. Ignoring the 'Language' header when it is known that the file being processed is a template avoids this issue. GitHub: python-babel#665
The tools 'xgettext' from GNU gettext and 'pot-create' from lingua both produce PO-template files containing a 'Language' header with an empty string as value. Babel has issues creating catalogs out of such templates. It wants to parse the PO-template as a normal PO-catalog using the locale of the target catalog, because it helps producing the correct plurals. But it overwrites this locale when parsing the 'Language' header and then it can not produce a valid catalog. Ignoring the 'Language' header when it is known that the file being processed is a template avoids this issue. GitHub: python-babel#665
The tools 'xgettext' from GNU gettext and 'pot-create' from lingua both produce PO-template files containing a 'Language' header with an empty string as value. Babel has issues creating catalogs out of such templates. It wants to parse the PO-template as a normal PO-catalog using the locale of the target catalog, because it helps producing the correct plurals. But it overwrites this locale when parsing the 'Language' header and then it can not produce a valid catalog. Ignoring the 'Language' header when it is known that the file being processed is a template avoids this issue. GitHub: fixes python-babel#665
GNU gettext's
xgettext
and lingua'spot-create
both create PO-template files containing aLanguage
header with an empty string as its value ("Language: \n"
).Babel does not seem to be able to handle this empty header and produces the error and stacktrace below.
Removing the
Language
header from the template file allows Babel to initialize the catalogs without issue.The text was updated successfully, but these errors were encountered: