mozilla/browserid — Issue #1132: Improve string extraction for JavaScript and EJS
Author: ozten
Created: 2012-02-16 05:17:05+00:00
State: open
Labels: good first bug

As part of localization, we have to pull all of the "strings" out of the code and templates. Strings are just copy, labels, and other words shown to users.

Our current script ``scripts/extract_po.sh`` is okay, but lacks the following features:

* Robust JS support
* Gettext Comments in JS
* Robust EJS support
* Gettext Comments in EJS

If you read ``extract_po.sh`` you'll be horrified to find that we parse JS files via ``xgettext`` in Perl mode. Similarly, we EJS files are parsed via ``xgettext`` in PHP mode.

Ideally we'd either use [Translate Toolkit](http://translate.sourceforge.net/wiki/), patch Translate Toolkit with Node.js support, patch GNU Gettext (good luck with that) or ... maybe you have some ideas.

Gettext comments mean that I can do this

/* l10n: This %s will be the user's name */
var msg = "Hello %s, welcome back!";

After string extraction, the po file has not only our string, but a special comment, so the localizer knows what ``%s`` is supposed to mean.

@ozten is happy to mentor first time contributors on this issue.