I18N: Introduce unit tests for the Japanese language in order to facilitate future improvements.
Props ryotsun Fixes #43829 git-svn-id: https://develop.svn.wordpress.org/trunk@43359 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
4d5b00da46
commit
5aa5e5c131
BIN
tests/phpunit/data/languages/ja_JP.mo
Normal file
BIN
tests/phpunit/data/languages/ja_JP.mo
Normal file
Binary file not shown.
42
tests/phpunit/data/languages/ja_JP.po
Normal file
42
tests/phpunit/data/languages/ja_JP.po
Normal file
@ -0,0 +1,42 @@
|
||||
# Translation of 5.0.x in Japanese
|
||||
# This file is distributed under the same license as the 4.6.x package.
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"PO-Revision-Date: 2018-04-21 18:27+0900\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
||||
"X-Generator: Poedit 1.8.10\n"
|
||||
"Project-Id-Version: 5.0.x\n"
|
||||
"Language: ja_JP\n"
|
||||
|
||||
#. translators: Translate this to the correct language tag for your locale, see
|
||||
#. https://www.w3.org/International/articles/language-tags/ for reference. Do
|
||||
#. not translate into your own language.
|
||||
#: wp-includes/general-template.php:716
|
||||
msgid "html_lang_attribute"
|
||||
msgstr "ja"
|
||||
|
||||
#. translators: 'rtl' or 'ltr'. This sets the text direction for WordPress.
|
||||
#: wp-includes/class-wp-locale.php:223
|
||||
msgctxt "text direction"
|
||||
msgid "ltr"
|
||||
msgstr "ltr"
|
||||
|
||||
#. translators: $dec_point argument for https://secure.php.net/number_format,
|
||||
#. default is .
|
||||
#: wp-includes/class-wp-locale.php:215
|
||||
msgid "number_format_decimal_point"
|
||||
msgstr "number_format_decimal_point"
|
||||
|
||||
#. translators: $thousands_sep argument for
|
||||
#. https://secure.php.net/number_format, default is ,
|
||||
#: wp-includes/class-wp-locale.php:202
|
||||
msgid "number_format_thousands_sep"
|
||||
msgstr "number_format_thousands_sep"
|
||||
|
||||
#. translators: %s: Plugin name and version
|
||||
#: wp-includes/script-loader.php:620
|
||||
msgid "Update %s now"
|
||||
msgstr "今すぐ %s を更新"
|
@ -90,7 +90,7 @@ class Tests_DB extends WP_UnitTestCase {
|
||||
$current_locales = explode( ';', setlocale( LC_ALL, 0 ) );
|
||||
|
||||
// Switch to Russian
|
||||
$flag = setlocale( LC_ALL, 'ru_RU.utf8', 'rus', 'fr_FR.utf8', 'fr_FR', 'de_DE.utf8', 'de_DE', 'es_ES.utf8', 'es_ES' );
|
||||
$flag = setlocale( LC_ALL, 'ru_RU.utf8', 'rus', 'fr_FR.utf8', 'fr_FR', 'de_DE.utf8', 'de_DE', 'es_ES.utf8', 'es_ES', 'ja_JP.utf8', 'ja_JP' );
|
||||
if ( false === $flag ) {
|
||||
$this->markTestSkipped( 'No European languages available for testing' );
|
||||
}
|
||||
|
@ -29,6 +29,7 @@ class Tests_Formatting_BlogInfo extends WP_UnitTestCase {
|
||||
array( 'de_DE_formal', 'de-DE-formal' ),
|
||||
array( 'oci', 'oci' ),
|
||||
array( 'pt_PT_ao1990', 'pt-PT-ao1990' ),
|
||||
array( 'ja_JP', 'ja-JP' ),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -53,7 +53,7 @@ class Tests_L10n extends WP_UnitTestCase {
|
||||
$this->assertEmpty( $array );
|
||||
|
||||
$array = get_available_languages( DIR_TESTDATA . '/languages/' );
|
||||
$this->assertEquals( array( 'de_DE', 'en_GB', 'es_ES' ), $array );
|
||||
$this->assertEquals( array( 'de_DE', 'en_GB', 'es_ES', 'ja_JP' ), $array );
|
||||
}
|
||||
|
||||
/**
|
||||
@ -97,6 +97,7 @@ class Tests_L10n extends WP_UnitTestCase {
|
||||
$this->assertContains( '<option value="" lang="en" data-installed="1">English (United States)</option>', $actual );
|
||||
$this->assertContains( '<option value="de_DE" lang="de" selected=\'selected\' data-installed="1">Deutsch</option>', $actual );
|
||||
$this->assertContains( '<option value="it_IT" lang="it">Italiano</option>', $actual );
|
||||
$this->assertContains( '<option value="ja_JP" lang="ja">日本語</option>', $actual );
|
||||
}
|
||||
|
||||
/**
|
||||
@ -120,6 +121,7 @@ class Tests_L10n extends WP_UnitTestCase {
|
||||
$this->assertContains( '<option value="" lang="en" data-installed="1">English (United States)</option>', $actual );
|
||||
$this->assertContains( '<option value="de_DE" lang="de" selected=\'selected\' data-installed="1">Deutsch</option>', $actual );
|
||||
$this->assertContains( '<option value="it_IT" lang="it">Italiano</option>', $actual );
|
||||
$this->assertContains( '<option value="ja_JP" lang="ja">日本語</option>', $actual );
|
||||
}
|
||||
|
||||
/**
|
||||
@ -141,6 +143,53 @@ class Tests_L10n extends WP_UnitTestCase {
|
||||
$this->assertContains( '<option value="" lang="en" data-installed="1" selected=\'selected\'>English (United States)</option>', $actual );
|
||||
$this->assertContains( '<option value="de_DE" lang="de" data-installed="1">Deutsch</option>', $actual );
|
||||
$this->assertContains( '<option value="it_IT" lang="it">Italiano</option>', $actual );
|
||||
$this->assertContains( '<option value="ja_JP" lang="ja">日本語</option>', $actual );
|
||||
}
|
||||
|
||||
/**
|
||||
* Add site default language to ja_JP in dropdown
|
||||
*/
|
||||
function test_wp_dropdown_languages_site_default_ja_JP() {
|
||||
$args = array(
|
||||
'id' => 'foo',
|
||||
'name' => 'bar',
|
||||
'languages' => array( 'ja_JP' ),
|
||||
'translations' => $this->wp_dropdown_languages_filter(),
|
||||
'selected' => 'ja_JP',
|
||||
'echo' => false,
|
||||
'show_option_site_default' => true,
|
||||
);
|
||||
$actual = wp_dropdown_languages( $args );
|
||||
|
||||
$this->assertContains( 'id="foo"', $actual );
|
||||
$this->assertContains( 'name="bar"', $actual );
|
||||
$this->assertContains( '<option value="site-default" data-installed="1">Site Default</option>', $actual );
|
||||
$this->assertContains( '<option value="" lang="en" data-installed="1">English (United States)</option>', $actual );
|
||||
$this->assertContains( '<option value="de_DE" lang="de">Deutsch</option>', $actual );
|
||||
$this->assertContains( '<option value="it_IT" lang="it">Italiano</option>', $actual );
|
||||
$this->assertContains( '<option value="ja_JP" lang="ja" selected=\'selected\' data-installed="1">日本語</option>', $actual );
|
||||
}
|
||||
|
||||
/**
|
||||
* Select dropdown language from de_DE to ja_JP
|
||||
*/
|
||||
function test_wp_dropdown_languages_ja_JP_selected() {
|
||||
$args = array(
|
||||
'id' => 'foo',
|
||||
'name' => 'bar',
|
||||
'languages' => array( 'de_DE' ),
|
||||
'translations' => $this->wp_dropdown_languages_filter(),
|
||||
'selected' => 'ja_JP',
|
||||
'echo' => false,
|
||||
);
|
||||
$actual = wp_dropdown_languages( $args );
|
||||
|
||||
$this->assertContains( 'id="foo"', $actual );
|
||||
$this->assertContains( 'name="bar"', $actual );
|
||||
$this->assertContains( '<option value="" lang="en" data-installed="1">English (United States)</option>', $actual );
|
||||
$this->assertContains( '<option value="de_DE" lang="de" data-installed="1">Deutsch</option>', $actual );
|
||||
$this->assertContains( '<option value="it_IT" lang="it">Italiano</option>', $actual );
|
||||
$this->assertContains( '<option value="ja_JP" lang="ja" selected=\'selected\'>日本語</option>', $actual );
|
||||
}
|
||||
|
||||
/**
|
||||
@ -160,6 +209,11 @@ class Tests_L10n extends WP_UnitTestCase {
|
||||
'native_name' => 'Italiano',
|
||||
'iso' => array( 'it', 'ita' ),
|
||||
),
|
||||
'ja_JP' => array(
|
||||
'language' => 'ja_JP',
|
||||
'native_name' => '日本語',
|
||||
'iso' => array( 'ja' ),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -2570,7 +2570,8 @@ mockedApiResponse.Schema = {
|
||||
"en_US",
|
||||
"de_DE",
|
||||
"en_GB",
|
||||
"es_ES"
|
||||
"es_ES",
|
||||
"ja_JP"
|
||||
],
|
||||
"description": "Locale for the user.",
|
||||
"type": "string"
|
||||
@ -2697,7 +2698,8 @@ mockedApiResponse.Schema = {
|
||||
"en_US",
|
||||
"de_DE",
|
||||
"en_GB",
|
||||
"es_ES"
|
||||
"es_ES",
|
||||
"ja_JP"
|
||||
],
|
||||
"description": "Locale for the user.",
|
||||
"type": "string"
|
||||
@ -2834,7 +2836,8 @@ mockedApiResponse.Schema = {
|
||||
"en_US",
|
||||
"de_DE",
|
||||
"en_GB",
|
||||
"es_ES"
|
||||
"es_ES",
|
||||
"ja_JP"
|
||||
],
|
||||
"description": "Locale for the user.",
|
||||
"type": "string"
|
||||
|
Loading…
x
Reference in New Issue
Block a user