Make WordPress Core


Ignore:
Timestamp:
10/03/2016 07:03:41 AM (8 years ago)
Author:
swissspidy
Message:

I18N: Introduce a user-specific language setting.

By enabling the user to select their preferred locale when editing the profile, we allow for greater personalization of the WordPress admin and therefore a better user experience.

The back end will be displayed in the user's individual locale while the locale used on the front end equals the one set for the whole site. If the user didn't specify a locale, the site's locale will be used as a fallback. The new locale property of the WP_User class can be used to retrieve the user's locale setting.

Props ocean90, ipm-frommen, swissspidy.
Fixes #29783.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-editor.php

    r38459 r38705  
    352352                self::$baseurl = includes_url( 'js/tinymce' );
    353353
    354                 $mce_locale = get_locale();
     354                $mce_locale = get_user_locale();
    355355                self::$mce_locale = $mce_locale = empty( $mce_locale ) ? 'en' : strtolower( substr( $mce_locale, 0, 2 ) ); // ISO 639-1
    356356
     
    673673            }
    674674
    675             $body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_locale() ) ) );
     675            $body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_user_locale() ) ) );
    676676
    677677            if ( !empty($set['tinymce']['body_class']) ) {
Note: See TracChangeset for help on using the changeset viewer.