-
Notifications
You must be signed in to change notification settings - Fork 384
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 i18n to make use of updated WP-CLI command #1329
Conversation
@swissspidy feel more than free to amend this PR with additional commits as necessary. |
In these cases, WordPress downloads translations from translate.wordpress.org to
Looking at the readme (https://github.com/Automattic/amp-wp/blob/d2ad9d61fc0607334b6f282e7c14844330c8e1b2/readme.txt#L4) and the translation platform (https://translate.wordpress.org/projects/wp-plugins/amp), the criteria is met and the call to
Unfortunately, it's a bit more complicated than that. At least at the moment, as the necessary work in WordPress core and WordPress.org hasn't began yet. So yeah, Here's a quick rundown of what's needed for plugins: Plugin hosted solely on GitHub or other platform
Plugin hosted on WordPress.org
That's quite a difference in steps needed. The reason is this: Right now, WordPress.org only supports extracting strings from PHP files. JavaScript is ignored entirely. That's why we need to cheat a bit and use As mentioned above, necessary work in WordPress core and WordPress.org to change this hasn't began yet. In the future, a) Use WP-CLI instead of the current library to extract strings from JavaScript files (see http://meta.trac.wordpress.org/ticket/3748) tl;dr: I'll try to find some time on Sunday/Monday to make the necessary changes to this PR, unless someone beats me to it :-) |
@swissspidy thank you. So it looks like most of what I did in 74f5f77 should be reverted. Also when calling |
Two non-blocking things I noticed:
|
I just noticed that the plugin uses core's While I get the intent to re-use existing translations in WordPress core, especially for things like AMP-enabled widgets, it's generally considered a bad practice. Plugins should not rely on the default WordPress text domain as it's not guaranteed that these strings will exist in core all the time. Also, it makes it harder for users to fully translate the plugin as they don't have control over these strings. |
Thank you. That is good to keep in mind. So if we keep the Your changes here look great. You can approve the PR (since I opened it originally) and then I'll merge it. |
That sounds like way more work than just using the correct text domain in the first place. Given that only around a dozen or so strings are affected, this is not worth it IMO. The AMP plugin has around 120 strings and is only fully translated in a handful of languages. Assuming that the strings are unlikely to change soon, one could always export the translations from the WordPress core project and import them for the AMP plugin so that there's no additional burden for the translators. |
load_plugin_textdomain( 'amp', false, 'languages/amp.pot' );
? Or is that unnecessary because of theDomain Path
meta?pot-to-php
anymore because the POT file now has all JS and PHP strings?Fixes #1327