wp/wp-includes/class-wp-locale-switcher.php
changeset 9 177826044cd9
parent 7 cf61fcea0001
child 16 a86126ab1dd4
--- a/wp/wp-includes/class-wp-locale-switcher.php	Mon Oct 14 18:06:33 2019 +0200
+++ b/wp/wp-includes/class-wp-locale-switcher.php	Mon Oct 14 18:28:13 2019 +0200
@@ -45,7 +45,7 @@
 	 * @since 4.7.0
 	 */
 	public function __construct() {
-		$this->original_locale     = is_admin() ? get_user_locale() : get_locale();
+		$this->original_locale     = determine_locale();
 		$this->available_languages = array_merge( array( 'en_US' ), get_available_languages() );
 	}
 
@@ -53,6 +53,8 @@
 	 * Initializes the locale switcher.
 	 *
 	 * Hooks into the {@see 'locale'} filter to change the locale on the fly.
+	 *
+	 * @since 4.7.0
 	 */
 	public function init() {
 		add_filter( 'locale', array( $this, 'filter_locale' ) );
@@ -67,7 +69,7 @@
 	 * @return bool True on success, false on failure.
 	 */
 	public function switch_to_locale( $locale ) {
-		$current_locale = is_admin() ? get_user_locale() : get_locale();
+		$current_locale = determine_locale();
 		if ( $current_locale === $locale ) {
 			return false;
 		}