I18N: Add ability to change user's locale back to site's locale.

Previously there was no way to remove the user locale setting again, even though that might be desirable.

This adds a new 'Site Default' option to the user-specific language setting by introducing a new `show_site_locale_default` argument to `wp_dropdown_languages()`.

Props ocean90.
See #29783.
Fixes #38632.

git-svn-id: https://develop.svn.wordpress.org/trunk@39169 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Pascal Birchler
2016-11-08 23:00:38 +00:00
parent 5f610350e1
commit 21e874e00a
6 changed files with 95 additions and 8 deletions

View File

@@ -284,9 +284,9 @@ if ( $languages ) : ?>
$user_locale = $profileuser->locale;
if ( 'en_US' === $user_locale ) {
$user_locale = false;
} elseif ( ! in_array( $user_locale, $languages, true ) ) {
$user_locale = get_locale();
$user_locale = '';
} elseif ( '' === $user_locale || ! in_array( $user_locale, $languages, true ) ) {
$user_locale = 'site-default';
}
wp_dropdown_languages( array(
@@ -294,7 +294,8 @@ if ( $languages ) : ?>
'id' => 'locale',
'selected' => $user_locale,
'languages' => $languages,
'show_available_translations' => false
'show_available_translations' => false,
'show_site_locale_default' => true
) );
?>
</td>