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

Support installing translations for all installed plugins/themes #64

Merged
merged 8 commits into from Dec 4, 2018

Conversation

@ocean90
Copy link
Contributor

ocean90 commented Oct 10, 2018

See #59.

@ocean90

This comment has been minimized.

Copy link
Contributor

ocean90 commented on src/Plugin_Language_Command.php in 33c0986 Oct 12, 2018

The message would be correct for wp language plugin install de_DE but not for wp language plugin install akismet. To fix this we could check if the plugin slug exists/is installed.

@ocean90

This comment has been minimized.

Copy link
Contributor

ocean90 commented Nov 20, 2018

@schlessera provided some feedback on Slack for this: https://wordpress.slack.com/archives/C02RP4T41/p1539759949000100

tldr; Consider using a table for the output which should make it easier to parse the result of each installation.

@ocean90

This comment has been minimized.

Copy link
Contributor

ocean90 commented Dec 2, 2018

Current output is inspired by wp plugin update --all:

wp language plugin install --all de_DE de_CH
Warning: Language 'de_DE' not available.
Language 'de_DE' for 'Airplane Mode' not installed.
Warning: Language 'de_CH' not available.
Language 'de_CH' for 'Airplane Mode' not installed.
Downloading translation from https://downloads.wordpress.org/translation/plugin/akismet/4.0.3/de_DE.zip...
Unpacking the update...
Installing the latest version...
Translation updated successfully.
Language 'de_DE' for 'Akismet Anti-Spam' installed.
Downloading translation from https://downloads.wordpress.org/translation/plugin/akismet/3.1.11/de_CH.zip...
Unpacking the update...
Installing the latest version...
Translation updated successfully.
Language 'de_CH' for 'Akismet Anti-Spam' installed.
Language 'de_DE' for 'Classic Editor' already installed.
....
Warning: Language 'de_CH' not available.
Language 'de_CH' for 'WP Team List' not installed.
Language 'de_DE' for 'WP Team List' already installed.
Language 'de_CH' for 'WP Team List' already installed.
Language 'de_DE' for 'WP Widget Disable' already installed.
Language 'de_CH' for 'WP Widget Disable' already installed.
+---------------------------------+--------+-------------------+
| name                            | locale | status            |
+---------------------------------+--------+-------------------+
| airplane-mode-master            | de_DE  | not available     |
| airplane-mode-master            | de_CH  | not available     |
| akismet                         | de_DE  | installed         |
| akismet                         | de_CH  | installed         |
| classic-editor                  | de_DE  | already installed |
| classic-editor                  | de_CH  | not available     |
....
| rplus-wp-team-list-git          | de_DE  | not available     |
| rplus-wp-team-list-git          | de_CH  | not available     |
| wp-team-list                    | de_DE  | already installed |
| wp-team-list                    | de_CH  | already installed |
| wp-widget-disable               | de_DE  | already installed |
| wp-widget-disable               | de_CH  | already installed |
+---------------------------------+--------+-------------------+
Success: Installed 2 of 86 languages (84 skipped).
wp language plugin install --all de_DE --format=summary
Warning: Language 'de_DE' not available.
Language 'de_DE' for 'Airplane Mode' not installed.
Language 'de_DE' for 'Akismet Anti-Spam' already installed.
Language 'de_DE' for 'Classic Editor' already installed.
Warning: Language 'de_DE' not available.
Language 'de_DE' for 'Core Control' not installed.
Warning: Language 'de_DE' not available.
Language 'de_DE' for 'CSS' not installed.
....
Language 'de_DE' for 'WP Team List' not installed.
Language 'de_DE' for 'WP Team List' already installed.
Language 'de_DE' for 'WP Widget Disable' already installed.
Success: Installed 0 of 43 languages (43 skipped).
wp language plugin install --all de_DE --format=json
[{"name":"airplane-mode-master","locale":"de_DE","status":"not available"},{"name":"akismet","locale":"de_DE","status":"already installed"},{"name":"classic-editor","locale":"de_DE","status":"already installed"},{"name":"core-control","locale":"de_DE","status":"not available"},{"name":"css","locale":"de_DE","status":"not available"},{"name":"debug-bar","locale":"de_DE","status":"not available"},{"name":"debug-bar-console","locale":"de_DE","status":"not available"},{"name":"debug-bar-transients","locale":"de_DE","status":"already installed"},{"name":"disable-privacy-tools","locale":"de_DE","status":"already installed"},{"name":"drafts-of-post-revisions","locale":"de_DE","status":"not available"},{"name":"dynamic-hostname","locale":"de_DE","status":"not available"},{"name":"genericond","locale":"de_DE","status":"not available"},{"name":"gutenberg-git","locale":"de_DE","status":"not available"},{"name":"gutenberg","locale":"de_DE","status":"already installed"},{"name":"gutenberg-testing","locale":"de_DE","status":"not available"},{"name":"test-plugin","locale":"de_DE","status":"not available"},{"name":"h2push","locale":"de_DE","status":"not available"},{"name":"members","locale":"de_DE","status":"already installed"},{"name":"ms-global-media","locale":"de_DE","status":"not available"},{"name":"o2-git","locale":"de_DE","status":"not available"},{"name":"parent-term-toggler","locale":"de_DE","status":"not available"},{"name":"polylang","locale":"de_DE","status":"already installed"},{"name":"preserve-editor-scroll-position","locale":"de_DE","status":"not available"},{"name":"public-post-preview-git","locale":"de_DE","status":"not available"},{"name":"public-post-preview","locale":"de_DE","status":"already installed"},{"name":"query-monitor","locale":"de_DE","status":"already installed"},{"name":"relax-comment-filters","locale":"de_DE","status":"not available"},{"name":"rest-post-likes","locale":"de_DE","status":"not available"},{"name":"rewrite-rules-inspector","locale":"de_DE","status":"not available"},{"name":"shiny-updates","locale":"de_DE","status":"not available"},{"name":"shortcode-ui","locale":"de_DE","status":"already installed"},{"name":"slack","locale":"de_DE","status":"not available"},{"name":"solr-power","locale":"de_DE","status":"not available"},{"name":"user-switching","locale":"de_DE","status":"already installed"},{"name":"woocommerce","locale":"de_DE","status":"already installed"},{"name":"wordpress-importer","locale":"de_DE","status":"already installed"},{"name":"wordpress-importer-git","locale":"de_DE","status":"not available"},{"name":"wp-feed-post-thumbnail","locale":"de_DE","status":"already installed"},{"name":"rest-api","locale":"de_DE","status":"not available"},{"name":"rest-api-oauth1","locale":"de_DE","status":"not available"},{"name":"rplus-wp-team-list-git","locale":"de_DE","status":"not available"},{"name":"wp-team-list","locale":"de_DE","status":"already installed"},{"name":"wp-widget-disable","locale":"de_DE","status":"already installed"}]%

Let me know what you think. If it's good I'm going to do the same for themes and add some tests.

@ocean90

This comment has been minimized.

Copy link
Contributor

ocean90 commented Dec 3, 2018

(The command:language-core-install label should probably be removed as the PR only touches plugins and themes.)

@schlessera

This comment has been minimized.

Copy link
Member

schlessera commented Dec 3, 2018

@ocean90 What do you think about combining these two in the "live status messages" (not the table):

Warning: Language 'de_CH' not available.
Language 'de_CH' for 'WP Team List' not installed.

This would then turn into this instead:

Warning: Language 'de_CH' for 'WP Team List' not available.

This already implies that it will not be installed.

Would this make it clearer, or does it worsen overall consistency?

@schlessera

This comment has been minimized.

Copy link
Member

schlessera commented Dec 3, 2018

Otherwise, I like the current version and think this is good to go.

@ocean90

This comment has been minimized.

Copy link
Contributor

ocean90 commented Dec 3, 2018

What do you think about combining these two in the "live status messages"

The output next to "Warning" is just one of the WP_Error messages which download_language_pack() can return. We could extend the changes from #69 to also adjust the logging but not sure if it's really worth since it would only cover one case. Maybe worth it's own issue/PR.

Fix typo
Co-Authored-By: ocean90 <dominikschilling+git@gmail.com>

@schlessera schlessera added this to the 2.0.2 milestone Dec 4, 2018

@schlessera schlessera merged commit d0c7859 into wp-cli:master Dec 4, 2018

1 check passed

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

@ocean90 ocean90 deleted the ocean90:install-all branch Dec 19, 2018

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