Ticket #26511: 26511.15.diff
File 26511.15.diff, 22.6 KB (added by , 8 years ago) |
---|
-
src/wp-admin/includes/ms.php
272 272 ); 273 273 update_option( 'adminhash', $new_admin_email ); 274 274 275 $switched_locale = switch_to_locale( get_user_locale() ); 276 275 277 /* translators: Do not translate USERNAME, ADMIN_URL, EMAIL, SITENAME, SITEURL: those are placeholders. */ 276 278 $email_text = __( 'Howdy ###USERNAME###, 277 279 … … 315 317 $content = str_replace( '###SITEURL###', network_home_url(), $content ); 316 318 317 319 wp_mail( $value, sprintf( __( '[%s] New Admin Email Address' ), wp_specialchars_decode( get_option( 'blogname' ) ) ), $content ); 320 321 if ( $switched_locale ) { 322 restore_previous_locale(); 323 } 318 324 } 319 325 320 326 /** … … 353 359 ); 354 360 update_user_meta( $current_user->ID, '_new_email', $new_user_email ); 355 361 362 $switched_locale = switch_to_locale( get_user_locale() ); 363 356 364 /* translators: Do not translate USERNAME, ADMIN_URL, EMAIL, SITENAME, SITEURL: those are placeholders. */ 357 365 $email_text = __( 'Howdy ###USERNAME###, 358 366 … … 395 403 396 404 wp_mail( $_POST['email'], sprintf( __( '[%s] New Email Address' ), wp_specialchars_decode( get_option( 'blogname' ) ) ), $content ); 397 405 $_POST['email'] = $current_user->user_email; 406 407 if ( $switched_locale ) { 408 restore_previous_locale(); 409 } 398 410 } 399 411 } 400 412 -
src/wp-admin/includes/upgrade.php
373 373 $email = $user->user_email; 374 374 $name = $user->user_login; 375 375 $login_url = wp_login_url(); 376 377 $switched_locale = switch_to_locale( $user->locale ); 378 376 379 $message = sprintf( __( "Your new WordPress site has been successfully set up at: 377 380 378 381 %1\$s … … 390 393 "), $blog_url, $name, $password, $login_url ); 391 394 392 395 @wp_mail($email, __('New WordPress Site'), $message); 396 397 if ( $switched_locale ) { 398 restore_previous_locale(); 399 } 393 400 } 394 401 endif; 395 402 -
src/wp-admin/ms-delete-site.php
42 42 43 43 $url_delete = esc_url( admin_url( 'ms-delete-site.php?h=' . $hash ) ); 44 44 45 $switched_locale = switch_to_locale( get_locale() ); 46 45 47 /* translators: Do not translate USERNAME, URL_DELETE, SITE_NAME: those are placeholders. */ 46 48 $content = __( "Howdy ###USERNAME###, 47 49 … … 73 75 $content = str_replace( '###SITE_NAME###', get_network()->site_name, $content ); 74 76 75 77 wp_mail( get_option( 'admin_email' ), "[ " . wp_specialchars_decode( get_option( 'blogname' ) ) . " ] ".__( 'Delete My Site' ), $content ); 78 79 if ( $switched_locale ) { 80 restore_previous_locale(); 81 } 76 82 ?> 77 83 78 84 <p><?php _e( 'Thank you. Please check your email for a link to confirm your action. Your site will not be deleted until this link is clicked.' ) ?></p> -
src/wp-admin/user-new.php
87 87 */ 88 88 do_action( 'invite_user', $user_id, $role, $newuser_key ); 89 89 90 $switched_locale = switch_to_locale( $user_details->locale ); 91 90 92 /* translators: 1: Site name, 2: site URL, 3: role, 4: activation URL */ 91 93 $message = __( 'Hi, 92 94 … … 96 98 Please click the following link to confirm the invite: 97 99 %4$s' ); 98 100 wp_mail( $new_user_email, sprintf( __( '[%s] Joining confirmation' ), wp_specialchars_decode( get_option( 'blogname' ) ) ), sprintf( $message, get_option( 'blogname' ), home_url(), wp_specialchars_decode( translate_user_role( $role['name'] ) ), home_url( "/newbloguser/$newuser_key/" ) ) ); 101 102 if ( $switched_locale ) { 103 restore_previous_locale(); 104 } 105 99 106 $redirect = add_query_arg( array('update' => 'add'), 'user-new.php' ); 100 107 } 101 108 } -
src/wp-includes/class-wp-locale-switcher.php
1 <?php 2 /** 3 * Locale API: WP_Locale_Switcher class 4 * 5 * @package WordPress 6 * @subpackage i18n 7 * @since 4.7.0 8 */ 9 10 /** 11 * Core class used for switching locales. 12 * 13 * @since 4.7.0 14 */ 15 class WP_Locale_Switcher { 16 /** 17 * Locale stack. 18 * 19 * @since 4.7.0 20 * @access private 21 * @var string[] 22 */ 23 private $locales = array(); 24 25 /** 26 * Original locale. 27 * 28 * @since 4.7.0 29 * @access private 30 * @var string 31 */ 32 private $original_locale; 33 34 /** 35 * Holds all available languages. 36 * 37 * @since 4.7.0 38 * @access private 39 * @var array An array of language codes (file names without the .mo extension). 40 */ 41 private $available_languages = array(); 42 43 /** 44 * Constructor. 45 * 46 * Stores the original locale as well as a list of all available languages. 47 * 48 * @since 4.7.0 49 */ 50 public function __construct() { 51 $this->original_locale = get_locale(); 52 $this->available_languages = get_available_languages(); 53 } 54 55 /** 56 * Initializes the locale switcher. 57 * 58 * Hooks into the {@see 'locale'} filter to change the locale on the fly. 59 */ 60 public function init() { 61 add_filter( 'locale', array( $this, 'filter_locale' ) ); 62 } 63 64 /** 65 * Switches the translations according to the given locale. 66 * 67 * @since 4.7.0 68 * 69 * @param string $locale The locale to switch to. 70 * @return bool True on success, false on failure. 71 */ 72 public function switch_to_locale( $locale ) { 73 if ( $locale === get_locale() ) { 74 return false; 75 } 76 77 if ( ! in_array( $locale, $this->available_languages, true ) ) { 78 return false; 79 } 80 81 $this->locales[] = $locale; 82 83 $this->change_locale( $locale ); 84 85 /** 86 * Fires when the locale is switched. 87 * 88 * @since 4.7.0 89 * 90 * @param string $locale The new locale. 91 */ 92 do_action( 'switch_locale', $locale ); 93 94 return true; 95 } 96 97 /** 98 * Restores the translations according to the previous locale. 99 * 100 * @since 4.7.0 101 * 102 * @return string|false Locale on success, false on failure. 103 */ 104 public function restore_previous_locale() { 105 $previous_locale = array_pop( $this->locales ); 106 107 if ( null === $previous_locale ) { 108 // The stack is empty, bail. 109 return false; 110 } 111 112 $locale = end( $this->locales ); 113 114 if ( ! $locale ) { 115 // There's nothing left in the stack: go back to the original locale. 116 $locale = $this->original_locale; 117 } 118 119 $this->change_locale( $locale ); 120 121 /** 122 * Fires when the locale is restored to the previous one. 123 * 124 * @since 4.7.0 125 * 126 * @param string $locale The new locale. 127 * @param string $previous_locale The previous locale. 128 */ 129 do_action( 'restore_previous_locale', $locale, $previous_locale ); 130 131 return $locale; 132 } 133 134 /** 135 * Restores the translations according to the original locale. 136 * 137 * @since 4.7.0 138 * 139 * @return string|false Locale on success, false on failure. 140 */ 141 public function restore_current_locale() { 142 if ( empty( $this->locales ) ) { 143 return false; 144 } 145 146 $this->locales = array( $this->original_locale ); 147 148 return $this->restore_previous_locale(); 149 } 150 151 /** 152 * Whether switch_to_locale() is in effect. 153 * 154 * @since 4.7.0 155 * 156 * @return bool True if the locale has been switched, false otherwise. 157 */ 158 public function is_switched() { 159 return ! empty( $this->locales ); 160 } 161 162 /** 163 * Filters the WordPress install's locale. 164 * 165 * @since 4.7.0 166 * 167 * @param string $locale The WordPress install's locale. 168 * @return string The locale currently being switched to. 169 */ 170 public function filter_locale( $locale ) { 171 $switched_locale = end( $this->locales ); 172 173 if ( $switched_locale ) { 174 return $switched_locale; 175 } 176 177 return $locale; 178 } 179 180 /** 181 * Load translations for a given locale. 182 * 183 * When switching to a locale, translations for this locale must be loaded from scratch. 184 * 185 * @since 4.7.0 186 * @access private 187 * 188 * @global Mo[] $l10n An array of all currently loaded text domains. 189 * 190 * @param string $locale The locale to load translations for. 191 */ 192 private function load_translations( $locale ) { 193 global $l10n; 194 195 $domains = $l10n ? array_keys( $l10n ) : array(); 196 197 load_default_textdomain( $locale ); 198 199 foreach ( $domains as $domain ) { 200 if ( 'default' === $domain ) { 201 continue; 202 } 203 204 $mofile = $l10n[ $domain ]->get_filename(); 205 206 unload_textdomain( $domain ); 207 208 if ( $mofile ) { 209 load_textdomain( $domain, $mofile ); 210 } 211 212 get_translations_for_domain( $domain ); 213 } 214 } 215 216 /** 217 * Changes the site's locale to the given one. 218 * 219 * Loads the translations, changes the global `$wp_locale` object and updates 220 * all post type labels. 221 * 222 * @since 4.7.0 223 * @access private 224 * 225 * @global WP_Locale $wp_locale The WordPress date and time locale object. 226 * 227 * @param string $locale The locale to change to. 228 */ 229 private function change_locale( $locale ) { 230 $this->load_translations( $locale ); 231 232 $GLOBALS['wp_locale'] = new WP_Locale(); 233 234 /** 235 * Fires when the locale is switched to or restored. 236 * 237 * @since 4.7.0 238 * 239 * @param string $locale The new locale. 240 */ 241 do_action( 'change_locale', $locale ); 242 } 243 } -
src/wp-includes/default-filters.php
404 404 add_action( 'admin_menu', '_add_post_type_submenus' ); 405 405 add_action( 'before_delete_post', '_reset_front_page_settings_for_post' ); 406 406 add_action( 'wp_trash_post', '_reset_front_page_settings_for_post' ); 407 add_action( 'change_locale', 'create_initial_post_types' ); 407 408 408 409 // Post Formats 409 410 add_filter( 'request', '_post_format_request' ); … … 429 430 430 431 // Taxonomy 431 432 add_action( 'init', 'create_initial_taxonomies', 0 ); // highest priority 433 add_action( 'change_locale', 'create_initial_taxonomies' ); 432 434 433 435 // Canonical 434 436 add_action( 'template_redirect', 'redirect_canonical' ); -
src/wp-includes/l10n.php
1166 1166 } 1167 1167 return $wp_locale->is_rtl(); 1168 1168 } 1169 1170 /** 1171 * Switches the translations according to the given locale. 1172 * 1173 * @since 4.7.0 1174 * 1175 * @global WP_Locale_Switcher $wp_locale_switcher 1176 * 1177 * @param string $locale The locale. 1178 * @return bool True on success, false on failure. 1179 */ 1180 function switch_to_locale( $locale ) { 1181 /* @var WP_Locale_Switcher $wp_locale_switcher */ 1182 global $wp_locale_switcher; 1183 1184 return $wp_locale_switcher->switch_to_locale( $locale ); 1185 } 1186 1187 /** 1188 * Restores the translations according to the previous locale. 1189 * 1190 * @since 4.7.0 1191 * 1192 * @global WP_Locale_Switcher $wp_locale_switcher 1193 * 1194 * @return string|false Locale on success, false on error. 1195 */ 1196 function restore_previous_locale() { 1197 /* @var WP_Locale_Switcher $wp_locale_switcher */ 1198 global $wp_locale_switcher; 1199 1200 return $wp_locale_switcher->restore_previous_locale(); 1201 } 1202 1203 /** 1204 * Restores the translations according to the original locale. 1205 * 1206 * @since 4.7.0 1207 * 1208 * @global WP_Locale_Switcher $wp_locale_switcher 1209 * 1210 * @return string|false Locale on success, false on error. 1211 */ 1212 function restore_current_locale() { 1213 /* @var WP_Locale_Switcher $wp_locale_switcher */ 1214 global $wp_locale_switcher; 1215 1216 return $wp_locale_switcher->restore_current_locale(); 1217 } 1218 1219 /** 1220 * Whether switch_to_locale() is in effect. 1221 * 1222 * @since 4.7.0 1223 * 1224 * @global WP_Locale_Switcher $wp_locale_switcher 1225 * 1226 * @return bool True if the locale has been switched, false otherwise. 1227 */ 1228 function is_locale_switched() { 1229 /* @var WP_Locale_Switcher $wp_locale_switcher */ 1230 global $wp_locale_switcher; 1231 1232 return $wp_locale_switcher->is_switched(); 1233 } -
src/wp-includes/load.php
841 841 * @since 3.4.0 842 842 * @access private 843 843 * 844 * @global string $text_direction 845 * @global WP_Locale $wp_locale The WordPress date and time locale object. 844 * @global string $text_direction 845 * @global WP_Locale $wp_locale The WordPress date and time locale object. 846 * @global WP_Locale_Switcher $wp_locale_switcher WordPress locale switcher object. 846 847 * 847 848 * @staticvar bool $loaded 848 849 */ 849 850 function wp_load_translations_early() { 850 global $text_direction, $wp_locale ;851 global $text_direction, $wp_locale, $wp_locale_switcher; 851 852 852 853 static $loaded = false; 853 854 if ( $loaded ) … … 864 865 require_once ABSPATH . WPINC . '/pomo/mo.php'; 865 866 require_once ABSPATH . WPINC . '/l10n.php'; 866 867 require_once ABSPATH . WPINC . '/class-wp-locale.php'; 868 require_once ABSPATH . WPINC . '/class-wp-locale-switcher.php'; 867 869 868 870 // General libraries 869 871 require_once ABSPATH . WPINC . '/plugin.php'; … … 915 917 } 916 918 917 919 $wp_locale = new WP_Locale(); 920 $wp_locale_switcher = new WP_Locale_Switcher(); 921 $wp_locale_switcher->init(); 918 922 } 919 923 920 924 /** -
src/wp-includes/ms-functions.php
800 800 $admin_email = 'support@' . $_SERVER['SERVER_NAME']; 801 801 $from_name = get_site_option( 'site_name' ) == '' ? 'WordPress' : esc_html( get_site_option( 'site_name' ) ); 802 802 $message_headers = "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n"; 803 804 $user = get_user_by( 'login', $user ); 805 $switched_locale = switch_to_locale( $user && $user->locale ? $user->locale : get_locale() ); 806 803 807 $message = sprintf( 804 808 /** 805 809 * Filters the message content of the new blog notification email. … … 849 853 esc_url( 'http://' . $domain . $path ) 850 854 ); 851 855 wp_mail( $user_email, wp_specialchars_decode( $subject ), $message, $message_headers ); 856 857 if ( $switched_locale ) { 858 restore_previous_locale(); 859 } 860 852 861 return true; 853 862 } 854 863 … … 887 896 if ( ! apply_filters( 'wpmu_signup_user_notification', $user, $user_email, $key, $meta ) ) 888 897 return false; 889 898 899 $user = get_user_by( 'login', $user ); 900 $switched_locale = switch_to_locale( $user && $user->locale ? $user->locale : get_locale() ); 901 890 902 // Send email with activation link. 891 903 $admin_email = get_site_option( 'admin_email' ); 892 904 if ( $admin_email == '' ) … … 934 946 $user 935 947 ); 936 948 wp_mail( $user_email, wp_specialchars_decode( $subject ), $message, $message_headers ); 949 950 if ( $switched_locale ) { 951 restore_previous_locale(); 952 } 953 937 954 return true; 938 955 } 939 956 … … 1448 1465 if ( ! apply_filters( 'wpmu_welcome_notification', $blog_id, $user_id, $password, $title, $meta ) ) 1449 1466 return false; 1450 1467 1468 $user = get_userdata( $user_id ); 1469 1470 $switched_locale = switch_to_locale( $user->locale ); 1471 1451 1472 $welcome_email = get_site_option( 'welcome_email' ); 1452 1473 if ( $welcome_email == false ) { 1453 1474 /* translators: Do not translate USERNAME, SITE_NAME, BLOG_URL, PASSWORD: those are placeholders. */ … … 1468 1489 } 1469 1490 1470 1491 $url = get_blogaddress_by_id($blog_id); 1471 $user = get_userdata( $user_id );1472 1492 1473 1493 $welcome_email = str_replace( 'SITE_NAME', $current_network->site_name, $welcome_email ); 1474 1494 $welcome_email = str_replace( 'BLOG_TITLE', $title, $welcome_email ); … … 1512 1532 */ 1513 1533 $subject = apply_filters( 'update_welcome_subject', sprintf( __( 'New %1$s Site: %2$s' ), $current_network->site_name, wp_unslash( $title ) ) ); 1514 1534 wp_mail( $user->user_email, wp_specialchars_decode( $subject ), $message, $message_headers ); 1535 1536 if ( $switched_locale ) { 1537 restore_previous_locale(); 1538 } 1539 1515 1540 return true; 1516 1541 } 1517 1542 … … 1551 1576 1552 1577 $user = get_userdata( $user_id ); 1553 1578 1579 $switched_locale = switch_to_locale( $user->locale ); 1580 1554 1581 /** 1555 1582 * Filters the content of the welcome email after user activation. 1556 1583 * … … 1590 1617 */ 1591 1618 $subject = apply_filters( 'update_welcome_user_subject', sprintf( __( 'New %1$s User: %2$s' ), $current_network->site_name, $user->user_login) ); 1592 1619 wp_mail( $user->user_email, wp_specialchars_decode( $subject ), $message, $message_headers ); 1620 1621 if ( $switched_locale ) { 1622 restore_previous_locale(); 1623 } 1624 1593 1625 return true; 1594 1626 } 1595 1627 -
src/wp-includes/pluggable.php
211 211 // (Re)create it, if it's gone missing 212 212 if ( ! ( $phpmailer instanceof PHPMailer ) ) { 213 213 require_once ABSPATH . WPINC . '/class-phpmailer.php'; 214 require_once ABSPATH . WPINC . '/class-smtp.php'; 214 require_once ABSPATH . WPINC . '/class-smtp.php'; 215 215 $phpmailer = new PHPMailer( true ); 216 216 } 217 217 … … 1418 1418 $emails = array_flip( $emails ); 1419 1419 } 1420 1420 1421 $switched_locale = switch_to_locale( get_locale() ); 1422 var_dump( get_locale()); 1423 var_dump($switched_locale);return; 1424 1421 1425 $comment_author_domain = @gethostbyaddr($comment->comment_author_IP); 1422 1426 1423 1427 // The blogname option is escaped with esc_html on the way into the database in sanitize_option … … 1522 1526 @wp_mail( $email, wp_specialchars_decode( $subject ), $notify_message, $message_headers ); 1523 1527 } 1524 1528 1529 if ( $switched_locale ) { 1530 restore_previous_locale(); 1531 } 1532 1525 1533 return true; 1526 1534 } 1527 1535 endif; … … 1569 1577 $emails[] = $user->user_email; 1570 1578 } 1571 1579 1580 $switched_locale = switch_to_locale( get_locale() ); 1581 1572 1582 $comment_author_domain = @gethostbyaddr($comment->comment_author_IP); 1573 1583 $comments_waiting = $wpdb->get_var("SELECT count(comment_ID) FROM $wpdb->comments WHERE comment_approved = '0'"); 1574 1584 … … 1664 1674 @wp_mail( $email, wp_specialchars_decode( $subject ), $notify_message, $message_headers ); 1665 1675 } 1666 1676 1677 if ( $switched_locale ) { 1678 restore_previous_locale(); 1679 } 1680 1667 1681 return true; 1668 1682 } 1669 1683 endif; … … 1723 1737 $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES); 1724 1738 1725 1739 if ( 'user' !== $notify ) { 1740 $switched_locale = switch_to_locale( get_locale() ); 1726 1741 $message = sprintf( __( 'New user registration on your site %s:' ), $blogname ) . "\r\n\r\n"; 1727 1742 $message .= sprintf( __( 'Username: %s' ), $user->user_login ) . "\r\n\r\n"; 1728 1743 $message .= sprintf( __( 'Email: %s' ), $user->user_email ) . "\r\n"; 1729 1744 1730 1745 @wp_mail( get_option( 'admin_email' ), sprintf( __( '[%s] New User Registration' ), $blogname ), $message ); 1746 1747 if ( $switched_locale ) { 1748 restore_previous_locale(); 1749 } 1731 1750 } 1732 1751 1733 1752 // `$deprecated was pre-4.3 `$plaintext_pass`. An empty `$plaintext_pass` didn't sent a user notifcation. … … 1748 1767 $hashed = time() . ':' . $wp_hasher->HashPassword( $key ); 1749 1768 $wpdb->update( $wpdb->users, array( 'user_activation_key' => $hashed ), array( 'user_login' => $user->user_login ) ); 1750 1769 1770 $switched_locale = switch_to_locale( $user->locale ); 1771 1751 1772 $message = sprintf(__('Username: %s'), $user->user_login) . "\r\n\r\n"; 1752 1773 $message .= __('To set your password, visit the following address:') . "\r\n\r\n"; 1753 1774 $message .= '<' . network_site_url("wp-login.php?action=rp&key=$key&login=" . rawurlencode($user->user_login), 'login') . ">\r\n\r\n"; … … 1755 1776 $message .= wp_login_url() . "\r\n"; 1756 1777 1757 1778 wp_mail($user->user_email, sprintf(__('[%s] Your username and password info'), $blogname), $message); 1779 1780 if ( $switched_locale ) { 1781 restore_previous_locale(); 1782 } 1758 1783 } 1759 1784 endif; 1760 1785 -
src/wp-includes/pomo/mo.php
16 16 var $_nplurals = 2; 17 17 18 18 /** 19 * Loaded MO file. 20 * 21 * @var string 22 */ 23 private $filename = ''; 24 25 /** 26 * Returns the loaded MO file. 27 * 28 * @return string The loaded MO file. 29 */ 30 public function get_filename() { 31 return $this->filename; 32 } 33 34 /** 19 35 * Fills up with the entries from MO file $filename 20 36 * 21 37 * @param string $filename MO file to load 22 38 */ 23 39 function import_from_file($filename) { 24 $reader = new POMO_FileReader($filename); 25 if (!$reader->is_resource()) 40 $reader = new POMO_FileReader( $filename ); 41 42 if ( ! $reader->is_resource() ) { 26 43 return false; 27 return $this->import_from_reader($reader); 44 } 45 46 $this->filename = (string) $filename; 47 48 return $this->import_from_reader( $reader ); 28 49 } 29 50 30 51 /** … … 299 320 return $this->_nplurals; 300 321 } 301 322 } 302 endif; 303 No newline at end of file 323 endif; -
src/wp-includes/user.php
1801 1801 1802 1802 $blog_name = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ); 1803 1803 1804 $switched_locale = false; 1805 if ( ! empty( $send_password_change_email ) || ! empty( $send_email_change_email ) ) { 1806 $switched_locale = switch_to_locale( isset( $user['locale'] ) ? $user['locale'] : get_locale() ); 1807 } 1808 1804 1809 if ( ! empty( $send_password_change_email ) ) { 1805 1806 1810 /* translators: Do not translate USERNAME, ADMIN_EMAIL, EMAIL, SITENAME, SITEURL: those are placeholders. */ 1807 1811 $pass_change_text = __( 'Hi ###USERNAME###, 1808 1812 … … 1910 1914 1911 1915 wp_mail( $email_change_email['to'], sprintf( $email_change_email['subject'], $blog_name ), $email_change_email['message'], $email_change_email['headers'] ); 1912 1916 } 1917 1918 if ( $switched_locale ) { 1919 restore_previous_locale(); 1920 } 1913 1921 } 1914 1922 1915 1923 // Update the cookies if the password changed. -
src/wp-settings.php
129 129 // Load the L10n library. 130 130 require_once( ABSPATH . WPINC . '/l10n.php' ); 131 131 require_once( ABSPATH . WPINC . '/class-wp-locale.php' ); 132 require_once( ABSPATH . WPINC . '/class-wp-locale-switcher.php' ); 132 133 133 134 // Run the installer if WordPress is not installed. 134 135 wp_not_installed(); … … 399 400 */ 400 401 $GLOBALS['wp_locale'] = new WP_Locale(); 401 402 403 /** 404 * WordPress Locale Switcher object for switching locales. 405 * 406 * @since 4.7.0 407 * 408 * @global WP_Locale_Switcher $wp_locale_switcher WordPress locale switcher object. 409 */ 410 $GLOBALS['wp_locale_switcher'] = new WP_Locale_Switcher(); 411 $GLOBALS['wp_locale_switcher']->init(); 412 402 413 // Load the functions for the active theme, for both parent and child theme if applicable. 403 414 if ( ! wp_installing() || 'wp-activate.php' === $pagenow ) { 404 415 if ( TEMPLATEPATH !== STYLESHEETPATH && file_exists( STYLESHEETPATH . '/functions.php' ) )