WPDev.one
Core Class

WP_Translation_Controller

class WP_Translation_Controller // Constructor: function Object() { [native code] }

Class WP_Translation_Controller.

Methods 15 methods

Method / Return Description
get_instance()
WP_Translation_Controller

Utility method to retrieve the main instance of the class.

get_locale()
string

Returns the current locale.

set_locale()
void

Sets the current locale.

Parameters: $locale: string
load_file()
bool

Loads a translation file for a given text domain.

Parameters: $translation_file: string, $textdomain: string, $locale: ?string
unload_file()
bool

Unloads a translation file for a given text domain.

Parameters: $file: mixed, $textdomain: string, $locale: ?string
unload_textdomain()
bool

Unloads all translation files for a given text domain.

Parameters: $textdomain: string, $locale: ?string
is_textdomain_loaded()
bool

Determines whether translations are loaded for a given text domain.

Parameters: $textdomain: string, $locale: ?string
translate()
(string

Translates a singular string.

Parameters: $text: string, $context: string, $textdomain: string, $locale: ?string
translate_plural()
(string

Translates plurals.

Parameters: $plurals: array, $number: int, $context: string, $textdomain: string, $locale: ?string
get_headers()
array<string,

Returns all existing headers for a given text domain.

Parameters: $textdomain: string
normalize_header()
string

Normalizes header names to be capitalized.

Parameters: $header: string
get_entries()
array<string,

Returns all entries for a given text domain.

Parameters: $textdomain: string
locate_translation()
(array{source:

Locates translation for a given string and text domain.

Parameters: $singular: string, $textdomain: string, $locale: ?string
get_files()
WP_Translation_File[]

Returns all translation files for a given text domain.

Parameters: $textdomain: string, $locale: ?string
has_translation()
bool

Returns a boolean to indicate whether a translation exists for a given string with optional text domain and locale.

Parameters: $singular: string, $textdomain: string, $locale: ?string

Properties

Property / Type Description
$current_locale
mixed
public
No description available.
$loaded_translations
mixed
public
No description available.
$loaded_files
mixed
public
No description available.
$instance
mixed
public
No description available.

Class Information

Since Version
6.5.0
Source File
wp-includes/l10n/class-wp-translation-controller.php
Advertisement