I18N: Rename `WP_Translation_Controller::instance()` method to `get_instance()`.
This improves consistency as `get_instance()` is more commonly used in core. See #59656. Built from https://develop.svn.wordpress.org/trunk@57350 git-svn-id: http://core.svn.wordpress.org/trunk@56856 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
465d17a905
commit
64ca037991
|
@ -283,7 +283,7 @@ class WP_Locale_Switcher {
|
|||
|
||||
$wp_locale = new WP_Locale();
|
||||
|
||||
WP_Translation_Controller::instance()->set_locale( $locale );
|
||||
WP_Translation_Controller::get_instance()->set_locale( $locale );
|
||||
|
||||
/**
|
||||
* Fires when the locale is switched to or restored.
|
||||
|
|
|
@ -797,7 +797,7 @@ function load_textdomain( $domain, $mofile, $locale = null ) {
|
|||
$locale = determine_locale();
|
||||
}
|
||||
|
||||
$i18n_controller = WP_Translation_Controller::instance();
|
||||
$i18n_controller = WP_Translation_Controller::get_instance();
|
||||
|
||||
// Ensures the correct locale is set as the current one, in case it was filtered.
|
||||
$i18n_controller->set_locale( $locale );
|
||||
|
@ -911,7 +911,7 @@ function unload_textdomain( $domain, $reloadable = false ) {
|
|||
|
||||
// Since multiple locales are supported, reloadable text domains don't actually need to be unloaded.
|
||||
if ( ! $reloadable ) {
|
||||
WP_Translation_Controller::instance()->unload_textdomain( $domain );
|
||||
WP_Translation_Controller::get_instance()->unload_textdomain( $domain );
|
||||
}
|
||||
|
||||
if ( isset( $l10n[ $domain ] ) ) {
|
||||
|
|
|
@ -42,20 +42,28 @@ final class WP_Translation_Controller {
|
|||
protected $loaded_files = array();
|
||||
|
||||
/**
|
||||
* Returns the WP_Translation_Controller singleton.
|
||||
* 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 instance(): WP_Translation_Controller {
|
||||
static $instance;
|
||||
|
||||
if ( ! $instance ) {
|
||||
$instance = new self();
|
||||
public static function get_instance(): WP_Translation_Controller {
|
||||
if ( null === self::$instance ) {
|
||||
self::$instance = new self();
|
||||
}
|
||||
|
||||
return $instance;
|
||||
return self::$instance;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.5-alpha-57349';
|
||||
$wp_version = '6.5-alpha-57350';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
|
@ -622,7 +622,7 @@ $GLOBALS['wp_locale'] = new WP_Locale();
|
|||
$GLOBALS['wp_locale_switcher'] = new WP_Locale_Switcher();
|
||||
$GLOBALS['wp_locale_switcher']->init();
|
||||
|
||||
WP_Translation_Controller::instance()->set_locale( $locale );
|
||||
WP_Translation_Controller::get_instance()->set_locale( $locale );
|
||||
|
||||
// Load the functions for the active theme, for both parent and child theme if applicable.
|
||||
foreach ( wp_get_active_and_valid_themes() as $theme ) {
|
||||
|
|
Loading…
Reference in New Issue