Tests: Add test for `wp_get_installed_translations()`.

Introduces language files in /tests/phpunit/data/language. Each file includes the header and 5 translations.

Props realloc for initial patch.
Fixes #35284.

git-svn-id: https://develop.svn.wordpress.org/trunk@36563 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Dominik Schilling (ocean90) 2016-02-17 22:01:11 +00:00
parent fafbd9fafd
commit bc95fd2884
16 changed files with 261 additions and 0 deletions

Binary file not shown.

View File

@ -0,0 +1,34 @@
# Translation of Administration in English (UK)
# This file is distributed under the same license as the Administration package.
msgid ""
msgstr ""
"PO-Revision-Date: 2015-12-07 10:23:11+0000\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: GlotPress/1.0-alpha-1100\n"
"Project-Id-Version: Administration\n"
#: wp-admin/about.php:42 wp-admin/credits.php:23 wp-admin/freedoms.php:22
msgid "Thank you for updating! WordPress %s makes your site more connected and responsive."
msgstr "Thank you for updating! WordPress %s makes your site more connected and responsive."
#. translators: 1: WP_Term class name, WP_Comment class name, WP_Network class
#. name
#: wp-admin/about.php:185
msgid "New %1$s, %2$s, and %3$s objects make interacting with terms, comments, and networks more predictable and intuitive in code."
msgstr "New %1$s, %2$s, and %3$s objects make interacting with terms, comments, and networks more predictable and intuitive in code."
#. translators: WP_Comment_Query class name
#: wp-admin/about.php:178
msgid "Comment queries now have cache handling to improve performance. New arguments in %s make crafting robust comment queries simpler."
msgstr "Comment queries now have cache handling to improve performance. New arguments in %s make crafting robust comment queries simpler."
#: wp-admin/about.php:182
msgid "Term, comment, and network objects"
msgstr "Term, comment, and network objects"
#: wp-admin/about.php:175
msgid "Comment query improvements"
msgstr "Comment query improvements"

Binary file not shown.

View File

@ -0,0 +1,34 @@
# Translation of Administration in Spanish (Spain)
# This file is distributed under the same license as the Administration package.
msgid ""
msgstr ""
"PO-Revision-Date: 2015-12-22 20:26:46+0000\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: GlotPress/1.0-alpha-1100\n"
"Project-Id-Version: Administration\n"
#: wp-admin/about.php:42 wp-admin/credits.php:23 wp-admin/freedoms.php:22
msgid "Thank you for updating! WordPress %s makes your site more connected and responsive."
msgstr "¡Gracias por actualizar! WordPress %s hace que tu sitio esté más conectado y sea más adaptable."
#. translators: 1: WP_Term class name, WP_Comment class name, WP_Network class
#. name
#: wp-admin/about.php:185
msgid "New %1$s, %2$s, and %3$s objects make interacting with terms, comments, and networks more predictable and intuitive in code."
msgstr "Ahora los objetos %1$s, %2$s y %3$s hacen que interactuar con términos, comentarios y redes sea más predecible y que el código sea más intuitivo."
#. translators: WP_Comment_Query class name
#: wp-admin/about.php:178
msgid "Comment queries now have cache handling to improve performance. New arguments in %s make crafting robust comment queries simpler."
msgstr "Las consultas de comentarios ahora tiene una caché que mejora el rendimiento. Nuevos argumentos en %s hacen que sea más fácil crear consultas robustas."
#: wp-admin/about.php:182
msgid "Term, comment, and network objects"
msgstr "Objetos de término, comentario y red"
#: wp-admin/about.php:175
msgid "Comment query improvements"
msgstr "Mejoras en las consultas de comentarios"

Binary file not shown.

View File

@ -0,0 +1,32 @@
# Translation of Network Admin in English (UK)
# This file is distributed under the same license as the Network Admin package.
msgid ""
msgstr ""
"PO-Revision-Date: 2015-11-26 00:00:19+0000\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: GlotPress/1.0-alpha-1100\n"
"Project-Id-Version: Network Admin\n"
#: wp-admin/network/site-users.php:329 wp-admin/network/user-new.php:106
msgid "A password reset link will be sent to the user via email."
msgstr "A password reset link will be sent to the user via email."
#. translators: 1: NOBLOGREDIRECT 2: wp-config.php
#: wp-admin/network/settings.php:142
msgid "If registration is disabled, please set %1$s in %2$s to a URL you will redirect visitors to if they visit a non-existent site."
msgstr "If registration is disabled, please set %1$s in %2$s to a URL you will redirect visitors to if they visit a non-existent site."
#: wp-admin/network/site-users.php:42
msgid "Site users list"
msgstr "Site users list"
#: wp-admin/network/site-users.php:41
msgid "Site users list navigation"
msgstr "Site users list navigation"
#: wp-admin/network/sites.php:51
msgid "Sites list"
msgstr "Sites list"

Binary file not shown.

View File

@ -0,0 +1,32 @@
# Translation of Network Admin in Spanish (Spain)
# This file is distributed under the same license as the Network Admin package.
msgid ""
msgstr ""
"PO-Revision-Date: 2015-11-26 00:00:19+0000\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: GlotPress/1.0-alpha-1100\n"
"Project-Id-Version: Network Admin\n"
#: wp-admin/network/site-users.php:329 wp-admin/network/user-new.php:106
msgid "A password reset link will be sent to the user via email."
msgstr "Se te enviará un enlace por email para que puedas cambiar la contraseña."
#. translators: 1: NOBLOGREDIRECT 2: wp-config.php
#: wp-admin/network/settings.php:142
msgid "If registration is disabled, please set %1$s in %2$s to a URL you will redirect visitors to if they visit a non-existent site."
msgstr "Si el registro de usuarios está desactivado , establece como valor de %1$s en %2$s una URL donde redirigir a los visitantes que accedan a un sitio inexistente."
#: wp-admin/network/site-users.php:41
msgid "Site users list navigation"
msgstr "Navegación por la lista de usuarios del sitio"
#: wp-admin/network/site-users.php:42
msgid "Site users list"
msgstr "Lista de usuarios del sitio"
#: wp-admin/network/sites.php:50
msgid "Sites list navigation"
msgstr "Navegación por la lista de sitios"

View File

@ -0,0 +1,31 @@
# Translation of Continents & Cities in Spanish (Spain)
# This file is distributed under the same license as the Continents & Cities package.
msgid ""
msgstr ""
"PO-Revision-Date: 2015-12-29 10:06:29+0000\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: GlotPress/1.0-alpha-1100\n"
"Project-Id-Version: Continents & Cities\n"
#: wp-admin/includes/continents-cities.php:140
msgid "Vincennes"
msgstr "Vincennes"
#: wp-admin/includes/continents-cities.php:141
msgid "Winamac"
msgstr "Winamac"
#: wp-admin/includes/continents-cities.php:142
msgid "Inuvik"
msgstr "Inuvik"
#: wp-admin/includes/continents-cities.php:143
msgid "Iqaluit"
msgstr "Iqaluit"
#: wp-admin/includes/continents-cities.php:144
msgid "Jamaica"
msgstr "Jamaica"

Binary file not shown.

View File

@ -0,0 +1,37 @@
# Translation of Development (4.4.x) in English (UK)
# This file is distributed under the same license as the Development (4.4.x) package.
msgid ""
msgstr ""
"PO-Revision-Date: 2016-01-14 21:14:29+0000\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: GlotPress/1.0-alpha-1100\n"
"Project-Id-Version: Development (4.4.x)\n"
#. translators: 'rtl' or 'ltr'. This sets the text direction for WordPress.
#: wp-includes/locale.php:201
msgctxt "text direction"
msgid "ltr"
msgstr "ltr"
#: wp-includes/user.php:2132
msgid "<strong>ERROR</strong>: Sorry, that username is not allowed."
msgstr "<strong>ERROR</strong>: Sorry, that username is not allowed."
#: wp-includes/rest-api/class-wp-rest-request.php:850
msgid "Invalid parameter."
msgstr "Invalid parameter."
#. translators: %s: menu name
#: wp-includes/customize/class-wp-customize-nav-menu-control.php:76
msgctxt "menu location"
msgid "(Current: %s)"
msgstr "(Current: %s)"
#. translators: %s: menu location slug
#: wp-includes/class-wp-customize-nav-menus.php:340
msgctxt "menu"
msgid "(Currently set to: %s)"
msgstr "(Currently set to: %s)"

Binary file not shown.

View File

@ -0,0 +1,37 @@
# Translation of Development (4.4.x) in Spanish (Spain)
# This file is distributed under the same license as the Development (4.4.x) package.
msgid ""
msgstr ""
"PO-Revision-Date: 2016-01-07 18:35:45+0000\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: GlotPress/1.0-alpha-1100\n"
"Project-Id-Version: Development (4.4.x)\n"
#. translators: 'rtl' or 'ltr'. This sets the text direction for WordPress.
#: wp-includes/locale.php:201
msgctxt "text direction"
msgid "ltr"
msgstr "ltr"
#: wp-includes/user.php:2132
msgid "<strong>ERROR</strong>: Sorry, that username is not allowed."
msgstr "<strong>ERROR</strong>: Lo siento, ese nombre de usuario no está permitido."
#: wp-includes/rest-api/class-wp-rest-request.php:850
msgid "Invalid parameter."
msgstr "Parámetro no válido. "
#. translators: %s: menu name
#: wp-includes/customize/class-wp-customize-nav-menu-control.php:76
msgctxt "menu location"
msgid "(Current: %s)"
msgstr "(Actual: %s)"
#. translators: %s: menu location slug
#: wp-includes/class-wp-customize-nav-menus.php:340
msgctxt "menu"
msgid "(Currently set to: %s)"
msgstr "(Actualmente fijado en: %s)"

View File

@ -26,6 +26,8 @@ require_once $config_file_path;
define( 'WP_TESTS_TABLE_PREFIX', $table_prefix );
define( 'DIR_TESTDATA', dirname( __FILE__ ) . '/../data' );
define( 'WP_LANG_DIR', DIR_TESTDATA . '/languages' );
if ( ! defined( 'WP_TESTS_FORCE_KNOWN_BUGS' ) )
define( 'WP_TESTS_FORCE_KNOWN_BUGS', false );

View File

@ -46,4 +46,26 @@ class Tests_L10n extends WP_UnitTestCase {
__( 'just some string', 'wp-tests-domain' );
$this->assertFalse( is_textdomain_loaded( 'wp-tests-domain' ) );
}
/**
* @ticket 35284
*/
function test_wp_get_installed_translations_for_core() {
$installed_translations = wp_get_installed_translations( 'core' );
$this->assertInternalType( 'array', $installed_translations );
$textdomains_expected = array( 'admin', 'admin-network', 'continents-cities', 'default' );
$this->assertEqualSets( $textdomains_expected, array_keys( $installed_translations ) );
$this->assertNotEmpty( $installed_translations['default']['en_GB'] );
$data_en_GB = $installed_translations['default']['en_GB'];
$this->assertEquals( '2016-01-14 21:14:29+0000', $data_en_GB['PO-Revision-Date'] );
$this->assertEquals( 'Development (4.4.x)', $data_en_GB['Project-Id-Version'] );
$this->assertEquals( 'GlotPress/1.0-alpha-1100', $data_en_GB['X-Generator'] );
$this->assertNotEmpty( $installed_translations['admin']['es_ES'] );
$data_es_ES = $installed_translations['admin']['es_ES'];
$this->assertEquals( '2015-12-22 20:26:46+0000', $data_es_ES['PO-Revision-Date'] );
$this->assertEquals( 'Administration', $data_es_ES['Project-Id-Version'] );
$this->assertEquals( 'GlotPress/1.0-alpha-1100', $data_es_ES['X-Generator'] );
}
}