babel icon indicating copy to clipboard operation
babel copied to clipboard

Ignore 'Language' header in PO-templates

Open sinoroc opened this issue 6 years ago • 2 comments

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 https://github.com/python-babel/babel/issues/665

sinoroc avatar Oct 07 '19 18:10 sinoroc

Codecov Report

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

:exclamation: 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%) :arrow_down:
babel/messages/frontend.py 87.03% <100.00%> (-0.35%) :arrow_down:
babel/messages/pofile.py 95.52% <100.00%> (+0.02%) :arrow_up:

... and 23 files with indirect coverage changes

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

codecov-io avatar Mar 26 '20 16:03 codecov-io

Anything I can do to get this moving?

sinoroc avatar Nov 11 '20 12:11 sinoroc