Make WordPress Core


Ignore:
Timestamp:
11/08/2021 10:36:11 PM (3 years ago)
Author:
joedolson
Message:

I18N: Add language switcher on login/registration screens.

Load a language switcher on the login and registration screens that allows users to choose any already-installed language. Set user locale on registration.

Props johnbillion, Nikschavan, afercia, sabernhardt, garrett-eclipse, keyur5, paaljoachim, Clorith, tobifjellner.
Fixes #43700.

File:
1 edited

Legend:

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

    r51943 r52058  
    30453045    update_user_meta( $user_id, 'default_password_nag', true ); // Set up the password change nag.
    30463046
     3047    if ( ! empty( $_COOKIE['wp_lang'] ) ) {
     3048        $wp_lang = sanitize_text_field( $_COOKIE['wp_lang'] );
     3049        if ( in_array( $wp_lang, get_available_languages(), true ) ) {
     3050            update_user_meta( $user_id, 'locale', $wp_lang ); // Set user locale if defined on registration.
     3051        }
     3052    }
     3053
    30473054    /**
    30483055     * Fires after a new user registration has been recorded.
Note: See TracChangeset for help on using the changeset viewer.