Skip to content
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

Ignore 'Language' header in PO-templates #666

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sinoroc
Copy link

@sinoroc sinoroc commented Oct 7, 2019

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 #665

@sinoroc sinoroc force-pushed the language-header-in-template branch from e769fd2 to d3a1b1c Compare March 26, 2020 16:28
@codecov-io
Copy link

codecov-io commented Mar 26, 2020

Codecov Report

Merging #666 (d3a1b1c) into master (134c792) will increase coverage by 0.06%.
The diff coverage is 100.00%.

❗ Current head d3a1b1c differs from pull request most recent head 2e86b47. Consider uploading reports for the commit 2e86b47 to get more accurate results

@@            Coverage Diff             @@
##           master     #666      +/-   ##
==========================================
+ Coverage   90.90%   90.97%   +0.06%     
==========================================
  Files          25       24       -1     
  Lines        4356     4177     -179     
==========================================
- Hits         3960     3800     -160     
+ Misses        396      377      -19     
Impacted Files Coverage Δ
babel/messages/catalog.py 95.65% <100.00%> (-0.07%) ⬇️
babel/messages/frontend.py 87.03% <100.00%> (-0.35%) ⬇️
babel/messages/pofile.py 95.52% <100.00%> (+0.02%) ⬆️

... and 23 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@sinoroc
Copy link
Author

sinoroc commented Nov 11, 2020

Anything I can do to get this moving?

@sinoroc sinoroc force-pushed the language-header-in-template branch from d3a1b1c to 05393ba Compare March 20, 2023 16:10
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
@sinoroc sinoroc force-pushed the language-header-in-template branch from 05393ba to 2e86b47 Compare March 29, 2023 12:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can not initialize a catalog from a template with an empty string value for "Language" header
2 participants