Core Class
View Source on Trac ↗
Core Class
WP_Locale_Switcher
class WP_Locale_Switcher
// Constructor: function Object() { [native code] } Core class used for switching locales.
Methods 12 methods
| Method / Return | Description |
|---|---|
| __construct() void | Constructor. |
| init() void | Initializes the locale switcher. |
| switch_to_locale() bool | Switches the translations according to the given locale.
Parameters: $locale: mixed, $user_id: mixed |
| switch_to_user_locale() bool | Switches the translations according to the given user's locale.
Parameters: $user_id: mixed |
| restore_previous_locale() (string | Restores the translations according to the previous locale. |
| restore_current_locale() (string | Restores the translations according to the original locale. |
| is_switched() bool | Whether switch_to_locale() is in effect. |
| get_switched_locale() (string | Returns the locale currently switched to. |
| get_switched_user_id() (int | Returns the user ID related to the currently switched locale. |
| filter_locale() string | Filters the locale of the WordPress installation.
Parameters: $locale: mixed |
| load_translations() void | Load translations for a given locale.
Parameters: $locale: mixed |
| change_locale() void | Changes the site's locale to the given one.
Parameters: $locale: mixed |
Properties
| Property / Type | Description |
|---|---|
| $stack mixed public | No description available. |
| $original_locale mixed public | No description available. |
| $available_languages mixed public | No description available. |
Class Information
Since Version
4.7.0
Source File
wp-includes/class-wp-locale-switcher.php
Advertisement