Make WordPress Core

Changeset 39069


Ignore:
Timestamp:
11/01/2016 09:23:23 AM (7 years ago)
Author:
swissspidy
Message:

I18N: Use the user's locale when loading text domains in the admin.

Leverages get_user_locale() in load_*_textdomain() and _load_textdomain_just_in_time() to always load translations in the user's language when in the admin.

Fixes #38485.

File:
1 edited

Legend:

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

    r39067 r39069  
    711711     * @param string $domain Text domain. Unique identifier for retrieving translated strings.
    712712     */
    713     $locale = apply_filters( 'plugin_locale', get_locale(), $domain );
     713    $locale = apply_filters( 'plugin_locale', is_admin() ? get_user_locale() : get_locale(), $domain );
    714714
    715715    $mofile = $domain . '-' . $locale . '.mo';
     
    745745function load_muplugin_textdomain( $domain, $mu_plugin_rel_path = '' ) {
    746746    /** This filter is documented in wp-includes/l10n.php */
    747     $locale = apply_filters( 'plugin_locale', get_locale(), $domain );
     747    $locale = apply_filters( 'plugin_locale', is_admin() ? get_user_locale() : get_locale(), $domain );
    748748
    749749    $mofile = $domain . '-' . $locale . '.mo';
     
    784784     * @param string $domain Text domain. Unique identifier for retrieving translated strings.
    785785     */
    786     $locale = apply_filters( 'theme_locale', get_locale(), $domain );
     786    $locale = apply_filters( 'theme_locale', is_admin() ? get_user_locale() : get_locale(), $domain );
    787787
    788788    $mofile = $domain . '-' . $locale . '.mo';
     
    866866    }
    867867
    868     $locale = get_locale();
     868    $locale = is_admin() ? get_user_locale() : get_locale();
    869869    $mofile = "{$domain}-{$locale}.mo";
    870870
Note: See TracChangeset for help on using the changeset viewer.