Title: Localize js
Author: kamiel79
Published: <strong>Kerzu 11, 2014</strong>
Last modified: Kerzu 11, 2014

---

Search plugins

This plugin **hasn’t been tested with the latest 3 major releases of WordPress**.
It may no longer be maintained or supported and may have compatibility issues when
used with more recent versions of WordPress.

![](https://ps.w.org/localize-js/assets/icon-128x128.png?rev=1042825)

# Localize js

 By [kamiel79](https://profiles.wordpress.org/kamiel79/)

[Download](https://downloads.wordpress.org/plugin/localize-js.zip)

 * [Details](https://bre.wordpress.org/plugins/localize-js/#description)
 * [Reviews](https://bre.wordpress.org/plugins/localize-js/#reviews)
 *  [Installation](https://bre.wordpress.org/plugins/localize-js/#installation)
 * [Development](https://bre.wordpress.org/plugins/localize-js/#developers)

 [Support](https://wordpress.org/support/plugin/localize-js/)

## Description

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.

## Installation

 1. Unzip the plugin in your plugin directory.
 2. Activate the plugin in WordPress.
 3. Make sure your .po-file is in your /languages directory and contains the translations
    from the .js-files.
 4. Place the following code in your javascript file:

    ```
    function _e(s) {     return ccb_e_ccb_HANDLE[s]; } 
    ```

where you replace HANDLE with the handle for your script (you use the handle to 
enqueue the script in functions.php.) 5. Translate your javascripts! You can now
use `alert ( _e("Error! Try again in your language"))`. Note that there is no text-
domain here as that is taken care of by PHP when it fills the array dynamically.

## FAQ

None for the moment.

## Reviews

There are no reviews for this plugin.

## Contributors & Developers

“Localize js” is open source software. The following people have contributed to 
this plugin.

Contributors

 *   [ kamiel79 ](https://profiles.wordpress.org/kamiel79/)

[Translate “Localize js” into your language.](https://translate.wordpress.org/projects/wp-plugins/localize-js)

### Interested in development?

[Browse the code](https://plugins.trac.wordpress.org/browser/localize-js/), check
out the [SVN repository](https://plugins.svn.wordpress.org/localize-js/), or subscribe
to the [development log](https://plugins.trac.wordpress.org/log/localize-js/) by
[RSS](https://plugins.trac.wordpress.org/log/localize-js/?limit=100&mode=stop_on_copy&format=rss).

## Changelog

#### December 11, 2014

 * First release.

## Meta

 *  Version **1.0**
 *  Last updated **12 years ago**
 *  Active installations **Fewer than 10**
 *  WordPress version ** 3.0 or higher **
 *  Tested up to **4.01**
 *  Language
 * [English (US)](https://wordpress.org/plugins/localize-js/)
 * Tags
 * [i18n](https://bre.wordpress.org/plugins/tags/i18n/)[javascript](https://bre.wordpress.org/plugins/tags/javascript/)
   [l10n](https://bre.wordpress.org/plugins/tags/l10n/)[multilingual](https://bre.wordpress.org/plugins/tags/multilingual/)
   [po](https://bre.wordpress.org/plugins/tags/po/)[translation](https://bre.wordpress.org/plugins/tags/translation/)
   [wordpress.org](https://bre.wordpress.org/plugins/tags/wordpress-org/)
 *  [Advanced View](https://bre.wordpress.org/plugins/localize-js/advanced/)

## Ratings

No reviews have been submitted yet.

[Your review](https://wordpress.org/support/plugin/localize-js/reviews/#new-post)

[See all reviews](https://wordpress.org/support/plugin/localize-js/reviews/)

## Contributors

 *   [ kamiel79 ](https://profiles.wordpress.org/kamiel79/)

## Support

Got something to say? Need help?

 [View support forum](https://wordpress.org/support/plugin/localize-js/)

## Donate

Would you like to support the advancement of this plugin?

 [ Donate to this plugin ](http://code.creativechoice.org/localize-js/)