Start a new topic

How to translate js?

How to translate JavaScript ?

Well, this obviously isn't as straight forward as the simple looking JS file made me expect. I'm currently investigating this task (for another CafeTran user).


If you have any info on this subject, please don't hesitate to share.

I've received a reply from Yves from Okapi:


Hi Hans,

 

JavaScript files are not directly supported by Okapi. So you get no filter configuration associated with your file. Just like most source code files they would be fairly complex to parse and even then it would be difficult to make distinction between strings to translate and string that are part of the code.

 

Web applications are usually internationalized so the translatable UI is isolated in some form of properties files, or use some variation of Gettext.

 

To work directly with JS files you can try to use the RegEx filter to come up with rules that would extract the strings you want to extract. But it’s likely to be difficult. See the filter’s details here:http://www.opentag.com/okapi/wiki/index.php?title=Regex_Filter

 

Cheers,

-ys

Login to post a comment