I18N: Show "Settings saved." in the correct language after switching the site language.
This simplifies the logic by comparing `get_user_locale()` before and after an settings update. Props swissspidy, ocean90. See #29783, #29281. Fixes #38482. Built from https://develop.svn.wordpress.org/trunk@39122 git-svn-id: http://core.svn.wordpress.org/trunk@39062 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
60db5df85f
commit
89cab4e197
|
@ -194,6 +194,8 @@ if ( 'update' == $action ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $options ) {
|
if ( $options ) {
|
||||||
|
$user_language_old = get_user_locale();
|
||||||
|
|
||||||
foreach ( $options as $option ) {
|
foreach ( $options as $option ) {
|
||||||
if ( $unregistered ) {
|
if ( $unregistered ) {
|
||||||
_deprecated_argument( 'options.php', '2.7.0',
|
_deprecated_argument( 'options.php', '2.7.0',
|
||||||
|
@ -217,15 +219,15 @@ if ( 'update' == $action ) {
|
||||||
update_option( $option, $value );
|
update_option( $option, $value );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Switch translation in case WPLANG was changed.
|
/*
|
||||||
$language = get_option( 'WPLANG' );
|
* Switch translation in case WPLANG was changed.
|
||||||
$user_language = get_user_locale();
|
* The global $locale is used in get_locale() which is
|
||||||
if ( $language === $user_language ) {
|
* used as a fallback in get_user_locale().
|
||||||
if ( $language ) {
|
*/
|
||||||
load_default_textdomain( $language );
|
unset( $GLOBALS['locale'] );
|
||||||
} else {
|
$user_language_new = get_user_locale();
|
||||||
unload_textdomain( 'default' );
|
if ( $user_language_old !== $user_language_new ) {
|
||||||
}
|
load_default_textdomain( $user_language_new );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.7-beta1-39121';
|
$wp_version = '4.7-beta1-39122';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue