Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions features/language-plugin.feature
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ Feature: Manage translation files for a WordPress install
| language | english_name | status |
| cs_CZ | Czech | uninstalled |
| de_DE | German | uninstalled |
| en_US | English (United States) | active |
| en_GB | English (UK) | uninstalled |

When I try `wp language plugin list not-a-plugin --format=json`
Expand Down Expand Up @@ -85,15 +84,13 @@ Feature: Manage translation files for a WordPress install
| language | english_name | status |
| cs_CZ | Czech | installed |
| de_DE | German | installed |
| en_US | English (United States) | active |
| en_GB | English (UK) | installed |

When I run `wp language plugin list hello-dolly --fields=language,english_name,update`
Then STDOUT should be a table containing rows:
| language | english_name | update |
| cs_CZ | Czech | none |
| de_DE | German | none |
| en_US | English (United States) | none |
| en_GB | English (UK) | none |

When I run `wp language plugin list hello-dolly --status=installed --format=count`
Expand Down
3 changes: 0 additions & 3 deletions features/language-theme.feature
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ Feature: Manage translation files for a WordPress install
| language | english_name | status |
| cs_CZ | Czech | uninstalled |
| de_DE | German | uninstalled |
| en_US | English (United States) | active |
| en_GB | English (UK) | uninstalled |

When I try `wp language theme list not-a-theme --format=json`
Expand Down Expand Up @@ -85,7 +84,6 @@ Feature: Manage translation files for a WordPress install
| cs_CZ | Czech | installed |
| de_DE | German | installed |
| en_GB | English (UK) | installed |
| en_US | English (United States) | active |

When I run `wp language theme list twentyten --fields=language,english_name,update`
Then STDOUT should be a table containing rows:
Expand Down Expand Up @@ -119,7 +117,6 @@ Feature: Manage translation files for a WordPress install
| language | english_name | status |
| cs_CZ | Czech | installed |
| de_DE | German | installed |
| en_US | English (United States) | installed |
| en_GB | English (UK) | active |

When I run `wp language theme uninstall twentyten cs_CZ de_DE`
Expand Down
8 changes: 5 additions & 3 deletions src/WP_CLI/CommandWithTranslation.php
Original file line number Diff line number Diff line change
Expand Up @@ -249,9 +249,11 @@ protected function download_language_pack( $download, $slug = null ) {
* @return array
*/
protected function get_installed_languages( $slug = 'default' ) {
$available = wp_get_installed_translations( $this->obj_type );
$available = ! empty( $available[ $slug ] ) ? array_keys( $available[ $slug ] ) : array();
$available[] = 'en_US';
$available = wp_get_installed_translations( $this->obj_type );
$available = ! empty( $available[ $slug ] ) ? array_keys( $available[ $slug ] ) : array();
if ( 'core' === $this->obj_type ) {
$available[] = 'en_US';
}

return $available;
}
Expand Down