Opened 14 years ago
Closed 14 years ago
#15495 closed Bug (fixed)
makemessages excludes all strings from Javascript after a comment
Reported by: | Łukasz Rekucki | Owned by: | Ned Batchelder |
---|---|---|---|
Component: | Internationalization | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | yes |
Easy pickings: | no | UI/UX: | no |
Description
A sample code (shortened as much as possible, the original comment was something like "get/set doesn't ...", so it's not synthetic):
/* / ' */ gettext("TEXT");
xgettext
doesn't find any translations after the shown comment. Removing either /
or '
fixes the problem. This is a bit related to #4695.
Attachments (1)
Change History (10)
comment:1 by , 14 years ago
Summary: | {{{makemessages}}} excludes all strings from Javascript after a comment → makemessages excludes all strings from Javascript after a comment |
---|
comment:2 by , 14 years ago
Triage Stage: | Unreviewed → Accepted |
---|
by , 14 years ago
Attachment: | ticket15495.diff added |
---|
comment:3 by , 14 years ago
Has patch: | set |
---|
The patch fixes this particular problem (and some similar to it), but it's not too hard to construct a valid JavaScript that gets omited or improperly mangled by regexps. Just a few examples:
gettext("String"); // This comment won't be caught by pythonize_re and it contains "'" which is a string start in Perl /* * This one will be removed by the patch */ gettext("/* but this one will be too */ 'cause there is no way of telling..."); f(/* ... if it's different from this one */);
The only real fix is having a JavaScript lexer and (probaly simplified) parser instead of a bunch of hacky regexps. No time to do it right now, so maybe someone else wants to do it.
comment:4 by , 14 years ago
Severity: | → Normal |
---|---|
Type: | → Bug |
comment:5 by , 14 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:6 by , 14 years ago
Patch needs improvement: | set |
---|
Patch needs improvement as per Łukasz's comment above.
A bit naive patch with tests.