In our JS files we use the following format for Gettext translation:
var str1 = '!t[The text that should be translated]';
var str2 = '!t[Some more text]';
This JS files will be parsed using PHP and the parsed strings get translated via Zend Framework Zend_Translate. The generated JS looks like this:
var str1 = 'The text that should be translated';
var str2 = 'Some more text';
For extracting the strings to be translated and for translating our PHP files we use Poedit, it works very well.
Is there a way to parse the strings to be translated out of '!t[...]'
using Poedit?
What would solve the problem is some sort of a Poedit parser that is regex based. Is there any such parser?
As an alternative, we could define a source code parser based on xgettext with the language PHP as parameter(you have to do it because xgettext doesn't know about .js files and it treats them a C files). Then we use the following format in our JS files:
var str1 = '<?=_t("The text that should be translated")?>';
var str2 = '<?=_t("Some more text")?>';
Needless to say, it's really uncool to use code that looks like php all over the place just to be able to parse the strings with Poedit.