diff --git a/features/language-core.feature b/features/language-core.feature index e861a237..ad13b2c2 100644 --- a/features/language-core.feature +++ b/features/language-core.feature @@ -535,3 +535,16 @@ Feature: Manage translation files for a WordPress install """ en_US """ + + @require-wp-4.0 + Scenario: List languages by multiple statuses + Given a WP install + And an empty cache + And I run `wp language core install nl_NL` + + When I run `wp language core list --fields=language,status --status=active,installed` + Then STDOUT should be a table containing rows: + | language | status | + | en_US | active | + | nl_NL | installed | + And STDERR should be empty diff --git a/features/language-plugin.feature b/features/language-plugin.feature index c55a6647..b48a510f 100644 --- a/features/language-plugin.feature +++ b/features/language-plugin.feature @@ -439,3 +439,16 @@ Feature: Manage translation files for a WordPress install jetpack,invalid_lang,"not available" """ And STDERR should be empty + + @require-wp-4.0 + Scenario: List languages by multiple statuses + Given a WP install + And an empty cache + And I run `wp language plugin install akismet nl_NL` + + When I run `wp language plugin list --all --fields=plugin,language,status --status=active,installed` + Then STDOUT should be a table containing rows: + | plugin | language | status | + | akismet | en_US | active | + | akismet | nl_NL | installed | + And STDERR should be empty diff --git a/features/language-theme.feature b/features/language-theme.feature index b210ae8e..8b7935e8 100644 --- a/features/language-theme.feature +++ b/features/language-theme.feature @@ -314,3 +314,17 @@ Feature: Manage translation files for a WordPress install twentysixteen,de_DE,"not installed" """ And STDERR should be empty + + @require-wp-4.0 + Scenario: List languages by multiple statuses + Given a WP install + And an empty cache + And I run `wp theme install twentyten --force` + And I run `wp language theme install twentyten nl_NL` + + When I run `wp language theme list twentyten --fields=language,status --status=active,installed` + Then STDOUT should be a table containing rows: + | language | status | + | en_US | active | + | nl_NL | installed | + And STDERR should be empty diff --git a/src/Core_Language_Command.php b/src/Core_Language_Command.php index 81ac2a98..4b6fb77a 100644 --- a/src/Core_Language_Command.php +++ b/src/Core_Language_Command.php @@ -126,7 +126,7 @@ function ( $translation ) use ( $available, $current_locale, $updates ) { foreach ( $translations as $key => $translation ) { foreach ( array_keys( $translation ) as $field ) { - if ( isset( $assoc_args[ $field ] ) && $assoc_args[ $field ] !== $translation[ $field ] ) { + if ( isset( $assoc_args[ $field ] ) && ! in_array( $translation[ $field ], array_map( 'trim', explode( ',', $assoc_args[ $field ] ) ), true ) ) { unset( $translations[ $key ] ); } } diff --git a/src/Plugin_Language_Command.php b/src/Plugin_Language_Command.php index 96364061..24f2c644 100644 --- a/src/Plugin_Language_Command.php +++ b/src/Plugin_Language_Command.php @@ -154,7 +154,7 @@ public function list_( $args, $assoc_args ) { // Support features like --status=active. foreach ( array_keys( $translation ) as $field ) { - if ( isset( $assoc_args[ $field ] ) && $assoc_args[ $field ] !== $translation[ $field ] ) { + if ( isset( $assoc_args[ $field ] ) && ! in_array( $translation[ $field ], array_map( 'trim', explode( ',', $assoc_args[ $field ] ) ), true ) ) { continue 2; } } diff --git a/src/Theme_Language_Command.php b/src/Theme_Language_Command.php index aaf173e0..f3e67b33 100644 --- a/src/Theme_Language_Command.php +++ b/src/Theme_Language_Command.php @@ -160,7 +160,7 @@ function ( $file ) { // Support features like --status=active. foreach ( array_keys( $translation ) as $field ) { - if ( isset( $assoc_args[ $field ] ) && $assoc_args[ $field ] !== $translation[ $field ] ) { + if ( isset( $assoc_args[ $field ] ) && ! in_array( $translation[ $field ], array_map( 'trim', explode( ',', $assoc_args[ $field ] ) ), true ) ) { continue 2; } }