Opened 14 years ago
Closed 14 years ago
#14045 closed Bug (fixed)
makemessage miss some gettext in javascript
Reported by: | Shao Hao | Owned by: | Ned Batchelder |
---|---|---|---|
Component: | Internationalization | Version: | 1.2 |
Severity: | Normal | Keywords: | xgettext |
Cc: | ramusus@…, ned@… | Triage Stage: | Accepted |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Here is a simple javascript code for testing:
function mfunc() { var val = 0; return val ? 1 : 0; } gettext('okkkk'); print mysub();
save it as 'result.pl'
Now run:
xgettext -d out -L Perl --keyword=gettext_noop --keyword=gettext_lazy --keyword=ngettext_lazy:1,2 --from-code UTF-8 -o - "result.pl"
Ouput nothing
Change History (13)
comment:1 by , 14 years ago
comment:2 by , 14 years ago
Resolution: | → worksforme |
---|---|
Status: | new → closed |
I cannot reproduce this failure:
$ xgettext -d out -L Perl --keyword=gettext_noop --keyword=gettext_lazy --keyword=ngettext_lazy:1,2 --from-code UTF-8 -o - "result.pl" # SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2010-10-05 12:32+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" #: result.pl:5 msgid "okkkk" msgstr ""
Even if this would happen this would not be a Django but a gettext bug.
comment:3 by , 14 years ago
Cc: | added |
---|
The same occured to me. After my last Ubuntu update from 9.4 to 10.10 version, makemessages command for javascripts starts to process my files incompletely. I investigate this problem deeper and come to conclusion the main reason is gettext package. It was the version 0.18.1.1-1ubuntu2. After downgrading gettext to 0.17-8ubuntu3 the problem disappeared.
I don't know is it a normal behavior of gettext or bug. I understand gettext doesn't support straight Javasript language support, but nevertheless setting "-L Perl" worried me. Is there no any other parsers for javascripts?
comment:4 by , 14 years ago
Resolution: | worksforme |
---|---|
Status: | closed → reopened |
I reopen ticket because. this problem may occur on some system distributions, I noticed above the reason and specification. Also I understand the problem is not inside Django. The problem inside gettext package or the way how Django use it.
comment:5 by , 14 years ago
Triage Stage: | Unreviewed → Accepted |
---|
Accepting on the basis someone has reproduced the issue on Ubuntu 10.10. Open to any suggestions on whether this is a local configuration issue, an Ubuntu packaging stuff up, or a Django usage problem.
comment:6 by , 14 years ago
Yeah, I was able to reproduce this myself, and I first thought it would be able to be fixed by changing from using "Perl" to "Python". Guess we need to limit the use of gettext to 0.17 for now.
follow-up: 8 comment:7 by , 14 years ago
And as jezdez told us on IRC, the middle-term solution would be to use a real Javascript parser (not available in xgettext) to extract strings from js files (like the one in Babel: http://svn.edgewall.org/repos/babel/trunk/babel/messages/jslexer.py).
comment:8 by , 14 years ago
Replying to claudep:
And as jezdez told us on IRC, the middle-term solution would be to use a real Javascript parser (not available in xgettext) to extract strings from js files (like the one in Babel: http://svn.edgewall.org/repos/babel/trunk/babel/messages/jslexer.py).
+Inf on using a real lexer/parser. See #15495 for another weird bug.
comment:9 by , 14 years ago
Owner: | changed from | to
---|---|
Severity: | → Normal |
Status: | reopened → new |
Type: | → Uncategorized |
comment:10 by , 14 years ago
Type: | Uncategorized → Bug |
---|
comment:12 by , 14 years ago
Easy pickings: | unset |
---|
See also #15832 (which covers switching to Babel).
If i change:
to {{{
return $val ? 1 : 0;
}}}
xgettext works.