WordPress.org

Make WordPress Core


Ignore:
Timestamp:
11/08/2016 11:00:38 PM (20 months ago)
Author:
swissspidy
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/user-edit.php

    r39040 r39169  
    285285
    286286        if ( 'en_US' === $user_locale ) {
    287             $user_locale = false;
    288         } elseif ( ! in_array( $user_locale, $languages, true ) ) {
    289             $user_locale = get_locale();
     287            $user_locale = '';
     288        } elseif ( '' === $user_locale || ! in_array( $user_locale, $languages, true ) ) {
     289            $user_locale = 'site-default';
    290290        }
    291291
     
    295295            'selected'                    => $user_locale,
    296296            'languages'                   => $languages,
    297             'show_available_translations' => false
     297            'show_available_translations' => false,
     298            'show_site_locale_default'    => true
    298299        ) );
    299300        ?>
Note: See TracChangeset for help on using the changeset viewer.