-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
I18N Package: Improve documentation / deprecate tools #12502
Comments
Another important thing: The WordPress i18n Babel plugin can be used to generate a .pot file containing all your localized strings. The only legit use case for this is when you aren't developing a WordPress plugin/theme, but something entirely out of WordPress. If you're developing a WordPress plugin hosted on WordPress.org, there's no need for either the Babel plugin or pot-to-php. This is all done automatically by the WordPress.org infrastructure. See https://make.wordpress.org/core/2018/11/09/new-javascript-i18n-support-in-wordpress/ If you're developing a private WordPress plugin, you'll want to extract all strings of your project — PHP and JavaScript. For this, the Babel plugin and pot-to-php are less than ideal because it basically duplicates your work:
Not only does it duplicate your work, it also is pretty pointless because the WP-CLI command scans JavaScript files just fine. If you use pot-to-php, however, you will loose important context. Your POT file from step 3 will add references to the generated PHP file instead of the actual JavaScript files. This is bad for translators. My suggestion:
|
Also brought up in #13132 |
During WordCamp London contributor day I was looking at the process to internationalize my own plugin and @swissspidy said the docs were out of date. Rather than use |
This seems fixed. |
The i18n package's readme currently says:
This might be true if you do the string extraction yourself, but it sets false expectations for developers trying to use the package.
I suggest replacing this paragraph with an information that the text domain should match the plugin slug.
I've written a lengthy blog post about the importance of the text domain in WordPress internationalization here: https://pascalbirchler.com/text-domain-wordpress-internationalization/
Also, there's this part:
Which is totally out of date now. See https://make.wordpress.org/core/2018/11/09/new-javascript-i18n-support-in-wordpress/
The text was updated successfully, but these errors were encountered: