mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-22 17:18:32 +01:00
I18N: Show available timezones in the user's locale on the settings screen.
Adds a `$locale` parameter to `wp_timezone_choice()` to only reload translations when necessary. Props yale01. See #38485. Built from https://develop.svn.wordpress.org/trunk@39068 git-svn-id: http://core.svn.wordpress.org/trunk@39010 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
d7d8768ffd
commit
8df80ae3ee
@ -147,7 +147,7 @@ if ( empty($tzstring) ) { // Create a UTC+- zone if no timezone string exists
|
||||
<td>
|
||||
|
||||
<select id="timezone_string" name="timezone_string" aria-describedby="timezone-description">
|
||||
<?php echo wp_timezone_choice($tzstring); ?>
|
||||
<?php echo wp_timezone_choice( $tzstring, get_user_locale() ); ?>
|
||||
</select>
|
||||
|
||||
<p class="description" id="timezone-description"><?php _e( 'Choose either a city in the same timezone as you or a UTC timezone offset.' ); ?></p>
|
||||
|
@ -4501,21 +4501,25 @@ function _wp_timezone_choice_usort_callback( $a, $b ) {
|
||||
* Gives a nicely-formatted list of timezone strings.
|
||||
*
|
||||
* @since 2.9.0
|
||||
* @since 4.7.0 Added the `$locale` parameter.
|
||||
*
|
||||
* @staticvar bool $mo_loaded
|
||||
* @staticvar string $locale_loaded
|
||||
*
|
||||
* @param string $selected_zone Selected timezone.
|
||||
* @param string $locale Optional. Locale to load the timezones in. Default current site locale.
|
||||
* @return string
|
||||
*/
|
||||
function wp_timezone_choice( $selected_zone ) {
|
||||
static $mo_loaded = false;
|
||||
function wp_timezone_choice( $selected_zone, $locale = null ) {
|
||||
static $mo_loaded = false, $locale_loaded = null;
|
||||
|
||||
$continents = array( 'Africa', 'America', 'Antarctica', 'Arctic', 'Asia', 'Atlantic', 'Australia', 'Europe', 'Indian', 'Pacific');
|
||||
|
||||
// Load translations for continents and cities
|
||||
if ( !$mo_loaded ) {
|
||||
$locale = get_locale();
|
||||
$mofile = WP_LANG_DIR . '/continents-cities-' . $locale . '.mo';
|
||||
// Load translations for continents and cities.
|
||||
if ( ! $mo_loaded || $locale !== $locale_loaded ) {
|
||||
$locale_loaded = $locale ? $locale : get_locale();
|
||||
$mofile = WP_LANG_DIR . '/continents-cities-' . $locale_loaded . '.mo';
|
||||
unload_textdomain( 'continents-cities' );
|
||||
load_textdomain( 'continents-cities', $mofile );
|
||||
$mo_loaded = true;
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.7-beta1-39067';
|
||||
$wp_version = '4.7-beta1-39068';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user