Enable updating languages for individual plugins and themes#40
Merged
schlessera merged 17 commits intomasterfrom Aug 5, 2018
Merged
Enable updating languages for individual plugins and themes#40schlessera merged 17 commits intomasterfrom
schlessera merged 17 commits intomasterfrom
Conversation
….org translation API When version 1.0 of a plugin is installed, it should download the translations for version 1.0, nothing else.
Member
Author
|
The tests for 1f917fc was basically the biggest needed change so far. I'm a bit unsure about my note regarding the available locales above as I don't have proof of that yet. |
schlessera
reviewed
Aug 2, 2018
| $translation = (object) reset( $translation ); | ||
| // Only preview which translations would be updated. | ||
| if ( Utils\get_flag_value( $assoc_args, 'dry-run' ) ) { | ||
| WP_CLI::line( sprintf( 'Found %d translation updates that would be processed:', count( $updates ) ) ); |
Member
There was a problem hiding this comment.
Shouldn't this be a count per type?
This would mean the --dry-run check and early return needs to happen after the foreach loop that builds the $updates_per_type array.
Member
Author
There was a problem hiding this comment.
Hmm yeah I somehow moved this from after the loop to before 🤦♀️ ☕️
Member
Author
|
I think this is good to go for now. I want to test this a bit in the wild in order to better determine what doesn't work, what needs tests, etc. |
schlessera
added a commit
that referenced
this pull request
Jan 5, 2022
Enable updating languages for individual plugins and themes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #39.
This means that for updating all translations on a site, one has to run the following commands
Additional thoughts:
\WP_CLI\CommandWithTranslation::get_translation_updates()uses the list of available locales for the the plugin and theme update checks to tell WordPress.org which locales are already installed.An example scenario can be that
de_DEis installed for core, but onlyjaanden_GBforakismet. The update command (and perhaps even the list command?) might show false information in that case, indicating that no update forjaanden_GBis available, because onlyde_DEis checked. I haven't properly tested that though.To fix this, instead of passing all installed locales we could try passing all possible locales that can be installed (using
\WP_CLI\CommandWithTranslation::get_all_languages()).Background:
\WP_CLI\CommandWithTranslation::update()calls\WP_CLI\CommandWithTranslation::get_translation_updates()which in turn calls\WP_CLI\CommandWithTranslation::get_installed_languages(). It does so without passing the plugin/theme slug (relying on the default instead, which isdefault).This is something we might want to explore in a separate issue.