Closed ztane closed 8 years ago
Can you provide a small example that shows this problem, so I have something to test with?
You just need pgettext('Context', 'The real msgid')
in a javascript file, then use babel-javascript
to extract messages from that file. Babel 2.0.
% cat lingua.cfg
[extensions]
.js = babel-javascript
% cat foo.js
pgettext('Context', 'The real msgid')
% pot-create -c lingua.cfg .
You can also verify this by python source, by trying pybabel
vs babel-python
on the pgettext (could not make pybabel
extract javascript correctly on command-line, but setup.py extract_messages
works).
I've pushed a set of changes that should fix this. Can you check if babel plugins work correctly for you now?
Thanks, both python and javascript seem to be working (npgettext does not work but it seems it is not supported by Babel)
npgettext
is not in the default keyword list for either, but you can just register that as an extra keyword to look for.
I have released lingua 4.4 with the fix for this issue.
I am using
babel-javascript
which readily scanspgettext
, and correctly if I use it withpybabel/setup.py extract_messages
. However if used viapot-create
, thepgettext
contents are interpreted as if they werengettext
.pgettext('Task', 'Type')
in a.js
file and processed withbabel-javascript
should result inBut currently results in