-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update to support makepot logic run against JavaScript files #6
Comments
Further investigation indicated that the .js files that we need to scan are those in the
The semi-automatic process for localization into
For the sb-breadcrumbs-block plugin the target JSON files are:
where Using this process means I don't need to rename the
where
|
For the Update 2020/09/04
Additional functions are needed to copy the plugin's Note: In the plugin's |
I believe this can now be closed. |
The WordPress block editor ( Gutenberg ) allows plugins and themes to be developed in JavaScript. Text strings written in the JavaScript (REACT) files should be translatable. WP-cli provides an
i18n make-pot
subcommand that enables the PHP and JavaScript strings used in the WordPress approved internationalization functions to be extracted to the main.pot
file.It also provides the
i18n make-json
subcommand to extract the Javascript strings from translated.po
files into'json
files.See notes to documentation below.
Requirement
l10n
routine to extract translatable text strings from JavaScript files so that the translated versions can be delivered to the end user's browser and displayed in their preferred language.wp_set_script_translations
. See Prototype a Breadcrumbs block supporting internationalization sb-breadcrumbs-block#1Proposed solution
There are a couple of alternative
do_makeoik()
function to call the same logic as wp-clido_makeoik()
function to not bother to rebuild the .pot file that was generated using the wp-cli method.Notes:
npm run makepot
command to build the main .pot filepackage.json would include a line like this
See also https://developer.wordpress.org/cli/commands/i18n/make-json/
to find out if we can use the
i18n make-json
subcommand instead.....We only need to enqueue the strings that are needed in the editor.
and https://getwithgutenberg.com/2019/04/how-to-internationalize-your-block/
Original documentation which talks about md5... but which I don't understand...
https://make.wordpress.org/core/2018/11/09/new-javascript-i18n-support-in-wordpress/
The text was updated successfully, but these errors were encountered: