Localize js

Provide translation function _e("") in javascript files.

Author:Kamiel Choi (profile at wordpress.org)
WordPress version required:3.0
WordPress version tested:4.01
Plugin version:1.0
Added to WordPress repository:11-12-2014
Last updated:11-12-2014
Warning! This plugin has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.
Rating, %:0
Rated by:0
Plugin URI:http://code.creativechoice.org/
Total downloads:427
plugin download
Click to start download

WordPress has the function wp_localize_scripts for translation, but the strings passed to it have to be hard-coded. Until you parse the .js-files and scan for occurrences of _e() with a fast regexp, and localize them with the data using the WordPress _e-function to localize from a .po file. *Note*. Your po-file has to include strings from javascript files. To do this in Poedit, see http://stackoverflow.com/questions/16557327/how-to-generate-po-file-from-js-file-using-poedit.