[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/wp-includes/ -> class-wp-locale-switcher.php (summary)

Locale API: WP_Locale_Switcher class

File Size: 237 lines (5 kb)
Included or required: 1 time
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

WP_Locale_Switcher:: (9 methods):
  __construct()
  init()
  switch_to_locale()
  restore_previous_locale()
  restore_current_locale()
  is_switched()
  filter_locale()
  load_translations()
  change_locale()


Class: WP_Locale_Switcher  - X-Ref

Core class used for switching locales.

__construct()   X-Ref
Constructor.

Stores the original locale as well as a list of all available languages.

since: 4.7.0

init()   X-Ref
Initializes the locale switcher.

Hooks into the {@see 'locale'} filter to change the locale on the fly.

since: 4.7.0

switch_to_locale( $locale )   X-Ref
Switches the translations according to the given locale.

return: bool True on success, false on failure.
param: string $locale The locale to switch to.
since: 4.7.0

restore_previous_locale()   X-Ref
Restores the translations according to the previous locale.

return: string|false Locale on success, false on failure.
since: 4.7.0

restore_current_locale()   X-Ref
Restores the translations according to the original locale.

return: string|false Locale on success, false on failure.
since: 4.7.0

is_switched()   X-Ref
Whether switch_to_locale() is in effect.

return: bool True if the locale has been switched, false otherwise.
since: 4.7.0

filter_locale( $locale )   X-Ref
Filters the locale of the WordPress installation.

return: string The locale currently being switched to.
param: string $locale The locale of the WordPress installation.
since: 4.7.0

load_translations( $locale )   X-Ref
Load translations for a given locale.

When switching to a locale, translations for this locale must be loaded from scratch.

param: string $locale The locale to load translations for.
since: 4.7.0

change_locale( $locale )   X-Ref
Changes the site's locale to the given one.

Loads the translations, changes the global `$wp_locale` object and updates
all post type labels.

param: string $locale The locale to change to.
since: 4.7.0



Generated: Sat Apr 27 01:00:02 2024 Cross-referenced by PHPXref 0.7.1