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

Enable updating languages for individual plugins and themes #40

Merged
merged 17 commits into from Aug 5, 2018

Conversation

2 participants
@swissspidy
Contributor

swissspidy commented Aug 2, 2018

Fixes #39.

This means that for updating all translations on a site, one has to run the following commands

wp language core update
wp language plugin update --all
wp language theme update --all

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_DE is installed for core, but only ja and en_GB for akismet. The update command (and perhaps even the list command?) might show false information in that case, indicating that no update for ja and en_GB is available, because only de_DE is 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 is default).

This is something we might want to explore in a separate issue.

swissspidy added some commits Aug 2, 2018

swissspidy added some commits Aug 2, 2018

Make sure the correct theme/plugin version is passed to the WordPress…
….org translation API

When version 1.0 of a plugin is installed, it should download the translations for version 1.0, nothing else.
@swissspidy

This comment has been minimized.

Show comment
Hide comment
@swissspidy

swissspidy Aug 2, 2018

Contributor

The tests for wp language core update --dry-run don't seem to want to pass anymore, but otherwise we're getting there...

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.

Contributor

swissspidy commented Aug 2, 2018

The tests for wp language core update --dry-run don't seem to want to pass anymore, but otherwise we're getting there...

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.

swissspidy added some commits Aug 2, 2018

@swissspidy swissspidy changed the title from [WIP] Enable updating languages for individual plugins and themes to Enable updating languages for individual plugins and themes Aug 5, 2018

swissspidy added some commits Aug 5, 2018

@swissspidy

This comment has been minimized.

Show comment
Hide comment
@swissspidy

swissspidy Aug 5, 2018

Contributor

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.

Contributor

swissspidy commented Aug 5, 2018

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 schlessera added this to the 1.0.8 milestone Aug 5, 2018

@schlessera schlessera merged commit c74a781 into master Aug 5, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@schlessera schlessera deleted the 39-update-individual branch Aug 5, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment