Skip to content

Commit ab6cb0d

Browse files
authored
Merge pull request #154 from dottxado/fix/84
Remove default available translation for plugins and themes
2 parents 31226ee + 7faddef commit ab6cb0d

3 files changed

Lines changed: 6 additions & 8 deletions

File tree

features/language-plugin.feature

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ Feature: Manage plugin translation files for a WordPress install
1919
| language | english_name | status |
2020
| cs_CZ | Czech | uninstalled |
2121
| de_DE | German | uninstalled |
22-
| en_US | English (United States) | active |
2322
| en_GB | English (UK) | uninstalled |
2423

2524
When I try `wp language plugin list not-a-plugin --format=json`
@@ -87,15 +86,13 @@ Feature: Manage plugin translation files for a WordPress install
8786
| language | english_name | status |
8887
| cs_CZ | Czech | installed |
8988
| de_DE | German | installed |
90-
| en_US | English (United States) | active |
9189
| en_GB | English (UK) | installed |
9290

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

10198
When I run `wp language plugin list hello-dolly --status=installed --format=count`

features/language-theme.feature

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ Feature: Manage theme translation files for a WordPress install
1616
| language | english_name | status |
1717
| cs_CZ | Czech | uninstalled |
1818
| de_DE | German | uninstalled |
19-
| en_US | English (United States) | active |
2019
| en_GB | English (UK) | uninstalled |
2120

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

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

125122
When I run `wp language theme uninstall twentyten cs_CZ de_DE`

src/WP_CLI/CommandWithTranslation.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -324,8 +324,12 @@ protected function get_installed_languages( $slug = 'default' ) {
324324
}
325325
}
326326

327-
$available = ! empty( $available[ $text_domain ] ) ? array_keys( $available[ $text_domain ] ) : array();
328-
$available[] = 'en_US';
327+
$available = ! empty( $available[ $text_domain ] ) ? array_keys( $available[ $text_domain ] ) : array();
328+
// en_US is always installed for core, but may not be available for plugins/themes,
329+
// especially when custom translation sources are used.
330+
if ( 'core' === $this->obj_type ) {
331+
$available[] = 'en_US';
332+
}
329333

330334
return $available;
331335
}

0 commit comments

Comments
 (0)