1
votes

I need to localize a Javascript source file, and after looking for a bit, I decided to use Jed (side question: you can use it without having to use node.js, right? It wasn't clear to me reading the docs). I went through my JS files and changed all the strings that needed localizing from:

 var title = "Bla bla bla";

To:

var title = i18n.translate("Bla bla bla").fetch();

Then I opened poEdit (version 1.7.4), created a new catalog, and in the keywords section, added:

translate(
i18n.translate

I then ran "Update from sources"... and poEdit doesn't find anything.

What am I doing wrong?

1

1 Answers

1
votes

Add just translate to the keywords, it works fine.

There's no reason to add ( to it (translate( is not a valid JavaScript function name!) and there's even less reason to do it inconsistently for only some of the keywords, but not others. Finally, xgettext's parser won't recognize i18n. namespacing, so adding that has no effect.

You may want to reconsider the use of Jed, though, unless you have very simple needs. Looking at the crazy (in Jed terminology: “sane”) API, there's no way xgettext could parse its way of doing contexts and plurals. There's no custom tool included with Jed to deal with it, so it seems you'd be reduced to create PO(T)s manually if you wanted contexts/plurals — something that goes against the entire concept of gettext.