Changeset 44514
- Timestamp:
- 01/09/2019 11:45:02 AM (6 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/l10n.php
r44418 r44514 1365 1365 * @since 4.3.0 Introduced the `echo` argument. 1366 1366 * @since 4.7.0 Introduced the `show_option_site_default` argument. 1367 * @since 5.1.0 Introduced the `show_option_en_us` argument. 1367 1368 * 1368 1369 * @see get_available_languages() … … 1383 1384 * @type bool $show_available_translations Whether to show available translations. Default true. 1384 1385 * @type bool $show_option_site_default Whether to show an option to fall back to the site's locale. Default false. 1386 * @type bool $show_option_en_us Whether to show an option for English (United States). Default true. 1385 1387 * } 1386 1388 * @return string HTML content … … 1399 1401 'show_available_translations' => true, 1400 1402 'show_option_site_default' => false, 1403 'show_option_en_us' => true, 1401 1404 ) 1402 1405 ); … … 1462 1465 } 1463 1466 1464 // Always show English. 1465 $structure[] = sprintf( 1466 '<option value="" lang="en" data-installed="1"%s>English (United States)</option>', 1467 selected( '', $parsed_args['selected'], false ) 1468 ); 1467 if ( $parsed_args['show_option_en_us'] ) { 1468 $structure[] = sprintf( 1469 '<option value="" lang="en" data-installed="1"%s>English (United States)</option>', 1470 selected( '', $parsed_args['selected'], false ) 1471 ); 1472 } 1469 1473 1470 1474 // List installed languages. -
trunk/tests/phpunit/tests/l10n.php
r43359 r44514 123 123 $this->assertContains( '<option value="it_IT" lang="it">Italiano</option>', $actual ); 124 124 $this->assertContains( '<option value="ja_JP" lang="ja">日本語</option>', $actual ); 125 } 126 127 /** 128 * @ticket 44494 129 */ 130 function test_wp_dropdown_languages_exclude_en_us() { 131 $args = array( 132 'id' => 'foo', 133 'name' => 'bar', 134 'languages' => array( 'de_DE' ), 135 'translations' => $this->wp_dropdown_languages_filter(), 136 'selected' => 'de_DE', 137 'echo' => false, 138 'show_option_en_us' => false, 139 ); 140 $actual = wp_dropdown_languages( $args ); 141 142 $this->assertNotContains( '<option value="" lang="en" data-installed="1">English (United States)</option>', $actual ); 125 143 } 126 144
Note: See TracChangeset
for help on using the changeset viewer.