diff --git a/wp-includes/l10n.php b/wp-includes/l10n.php
index 75e30fa2f1..e4acf40b38 100644
--- a/wp-includes/l10n.php
+++ b/wp-includes/l10n.php
@@ -983,6 +983,7 @@ function load_default_textdomain( $locale = null ) {
*
* @since 1.5.0
* @since 4.6.0 The function now tries to load the .mo file from the languages directory first.
+ * @since 6.7.0 Translations are no longer immediately loaded, but handed off to the just-in-time loading mechanism.
*
* @param string $domain Unique identifier for retrieving translated strings
* @param string|false $deprecated Optional. Deprecated. Use the $plugin_rel_path parameter instead.
@@ -999,36 +1000,6 @@ function load_plugin_textdomain( $domain, $deprecated = false, $plugin_rel_path
return false;
}
- if ( ! doing_action( 'after_setup_theme' ) && ! did_action( 'after_setup_theme' ) ) {
- _doing_it_wrong(
- __FUNCTION__,
- sprintf(
- /* translators: 1: The text domain. 2: 'after_setup_theme'. */
- __( 'Attempted to load translations for the %1$s domain too early. Translations should be loaded after the %2$s action has fired, to ensure that the current user is already set up.' ),
- '' . $domain . '',
- 'after_setup_theme'
- ),
- '6.7.0'
- );
- }
-
- /**
- * Filters a plugin's locale.
- *
- * @since 3.0.0
- *
- * @param string $locale The plugin's current locale.
- * @param string $domain Text domain. Unique identifier for retrieving translated strings.
- */
- $locale = apply_filters( 'plugin_locale', determine_locale(), $domain );
-
- $mofile = $domain . '-' . $locale . '.mo';
-
- // Try to load from the languages directory first.
- if ( load_textdomain( $domain, WP_LANG_DIR . '/plugins/' . $mofile, $locale ) ) {
- return true;
- }
-
if ( false !== $plugin_rel_path ) {
$path = WP_PLUGIN_DIR . '/' . trim( $plugin_rel_path, '/' );
} elseif ( false !== $deprecated ) {
@@ -1040,7 +1011,7 @@ function load_plugin_textdomain( $domain, $deprecated = false, $plugin_rel_path
$wp_textdomain_registry->set_custom_path( $domain, $path );
- return load_textdomain( $domain, $path . '/' . $mofile, $locale );
+ return true;
}
/**
@@ -1048,6 +1019,7 @@ function load_plugin_textdomain( $domain, $deprecated = false, $plugin_rel_path
*
* @since 3.0.0
* @since 4.6.0 The function now tries to load the .mo file from the languages directory first.
+ * @since 6.7.0 Translations are no longer immediately loaded, but handed off to the just-in-time loading mechanism.
*
* @global WP_Textdomain_Registry $wp_textdomain_registry WordPress Textdomain Registry.
*
@@ -1064,34 +1036,11 @@ function load_muplugin_textdomain( $domain, $mu_plugin_rel_path = '' ) {
return false;
}
- if ( ! doing_action( 'after_setup_theme' ) && ! did_action( 'after_setup_theme' ) ) {
- _doing_it_wrong(
- __FUNCTION__,
- sprintf(
- /* translators: 1: The text domain. 2: 'after_setup_theme'. */
- __( 'Attempted to load translations for the %1$s domain too early. Translations should be loaded after the %2$s action has fired, to ensure that the current user is already set up.' ),
- '' . $domain . '',
- 'after_setup_theme'
- ),
- '6.7.0'
- );
- }
-
- /** This filter is documented in wp-includes/l10n.php */
- $locale = apply_filters( 'plugin_locale', determine_locale(), $domain );
-
- $mofile = $domain . '-' . $locale . '.mo';
-
- // Try to load from the languages directory first.
- if ( load_textdomain( $domain, WP_LANG_DIR . '/plugins/' . $mofile, $locale ) ) {
- return true;
- }
-
$path = WPMU_PLUGIN_DIR . '/' . ltrim( $mu_plugin_rel_path, '/' );
$wp_textdomain_registry->set_custom_path( $domain, $path );
- return load_textdomain( $domain, $path . '/' . $mofile, $locale );
+ return true;
}
/**
@@ -1104,6 +1053,7 @@ function load_muplugin_textdomain( $domain, $mu_plugin_rel_path = '' ) {
*
* @since 1.5.0
* @since 4.6.0 The function now tries to load the .mo file from the languages directory first.
+ * @since 6.7.0 Translations are no longer immediately loaded, but handed off to the just-in-time loading mechanism.
*
* @global WP_Textdomain_Registry $wp_textdomain_registry WordPress Textdomain Registry.
*
@@ -1120,43 +1070,13 @@ function load_theme_textdomain( $domain, $path = false ) {
return false;
}
- if ( ! doing_action( 'after_setup_theme' ) && ! did_action( 'after_setup_theme' ) ) {
- _doing_it_wrong(
- __FUNCTION__,
- sprintf(
- /* translators: 1: The text domain. 2: 'after_setup_theme'. */
- __( 'Attempted to load translations for the %1$s domain too early. Translations should be loaded after the %2$s action has fired, to ensure that the current user is already set up.' ),
- '' . $domain . '',
- 'after_setup_theme'
- ),
- '6.7.0'
- );
- }
-
- /**
- * Filters a theme's locale.
- *
- * @since 3.0.0
- *
- * @param string $locale The theme's current locale.
- * @param string $domain Text domain. Unique identifier for retrieving translated strings.
- */
- $locale = apply_filters( 'theme_locale', determine_locale(), $domain );
-
- $mofile = $domain . '-' . $locale . '.mo';
-
- // Try to load from the languages directory first.
- if ( load_textdomain( $domain, WP_LANG_DIR . '/themes/' . $mofile, $locale ) ) {
- return true;
- }
-
if ( ! $path ) {
$path = get_template_directory();
}
$wp_textdomain_registry->set_custom_path( $domain, $path );
- return load_textdomain( $domain, $path . '/' . $locale . '.mo', $locale );
+ return true;
}
/**
@@ -1425,9 +1345,10 @@ function _load_textdomain_just_in_time( $domain ) {
_doing_it_wrong(
__FUNCTION__,
sprintf(
- /* translators: %s: The text domain. */
- __( 'Translation loading for the %s domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early.' ),
- '' . $domain . ''
+ /* translators: 1: The text domain. 2: 'init'. */
+ __( 'Translation loading for the %1$s domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the %2$s action or later.' ),
+ '' . $domain . '',
+ 'init'
),
'6.7.0'
);
diff --git a/wp-includes/version.php b/wp-includes/version.php
index 197a32fc49..4608e8dd42 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
-$wp_version = '6.7-beta1-59156';
+$wp_version = '6.7-beta1-59157';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.