wppaste
WordPress

WP_Translation_Controller

Since
6.5.0
Source
wp-includes/l10n/class-wp-translation-controller.php:15
Class WP_Translation_Controller.

Compatibility

WordPress
since 6.5.0
  • 6.7.7
  • 6.8.8
  • 6.9.7
  • 7.0.4
  • 7.1.0

Present in every tracked release (6.7.7 to 7.1.0).

Properties · 4

$current_localestringprotected
Current locale.
$loaded_translationsarray<string,protected
Map of loaded translations per locale and text domain.
$loaded_filesarray<string,protected
List of loaded translation files.
$instanceWP_Translation_Controller|nullprivate static
Container for the main instance of the class.

Methods · 15

Source code

final class WP_Translation_Controller {	/**	 * Current locale.	 *	 * @since 6.5.0	 * @var string	 */	protected $current_locale = 'en_US'; 	/**	 * Map of loaded translations per locale and text domain.	 *	 * [ Locale => [ Textdomain => [ ..., ... ] ] ]	 *	 * @since 6.5.0	 * @var array<string, array<string, WP_Translation_File[]>>	 */	protected $loaded_translations = array(); 	/**	 * List of loaded translation files.	 *	 * [ Filename => [ Locale => [ Textdomain => WP_Translation_File ] ] ]	 *	 * @since 6.5.0	 * @var array<string, array<string, array<string, WP_Translation_File|false>>>	 */	protected $loaded_files = array(); 	/**	 * Container for the main instance of the class.	 *	 * @since 6.5.0	 * @var WP_Translation_Controller|null	 */	private static $instance = null; 	/**	 * Utility method to retrieve the main instance of the class.	 *	 * The instance will be created if it does not exist yet.	 *	 * @since 6.5.0	 *	 * @return WP_Translation_Controller	 */	public static function get_instance(): WP_Translation_Controller {		if ( null === self::$instance ) {			self::$instance = new self();		} 		return self::$instance;	} 	/**	 * Returns the current locale.	 *	 * @since 6.5.0	 *	 * @return string Locale.	 */	public function get_locale(): string {		return $this->current_locale;	} 	/**	 * Sets the current locale.	 *	 * @since 6.5.0	 *	 * @param string $locale Locale.	 */	public function set_locale( string $locale ) {		$this->current_locale = $locale;	} 	/**	 * Loads a translation file for a given text domain.	 *	 * @since 6.5.0

Changelog

Introduced in 6.5.0. Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

About this page

Parsed data
Generated from the wordpress-develop 7.1.0 tag, from src/wp-includes/l10n/class-wp-translation-controller.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.