
Note: Every string displayed to the user should be wrapped in an i18n function.Īfter all strings in your code is wrapped, the final step is to tell WordPress your JavaScript contains translations, using the wp_set_script_translations() function.
#Json editor javascript plugin full
Return el( 'p', blockProps, _( 'Hello World', 'myguten' ) ) Įxpand full source code Collapse full source code WordPress 5.0 introduced the wp-i18n JavaScript package that provides the functions needed to add translatable strings as you would in PHP.įirst, add wp-i18n as a dependency when registering your script:Ĭonst ) The release of WordPress 5.0 brings a similar process for translation to JavaScript code.

#Json editor javascript plugin how to
Any detected translation strings are added to to allow the community to translate, ensuring WordPress plugins and themes are available in as many languages as possible.įor PHP, WordPress has a long established process, see How to Internationalize Your Plugin. When you upload your software to, all JS and PHP files will automatically be parsed.

Providing i18n support to your plugin and theme allows it to reach the largest possible audience, even without requiring you to provide the additional language translations. Internationalization is often abbreviated as i18n, where 18 stands for the number of letters between the first i and the last n. Internationalization is the process to provide multiple language support to software, in this case WordPress. Browse: Home / Block Editor Handbook / How-to Guides / Internationalization Internationalization Edit What is Internationalization?
