--- a/wp/wp-includes/class-wp-textdomain-registry.php Fri Sep 05 18:40:08 2025 +0200
+++ b/wp/wp-includes/class-wp-textdomain-registry.php Fri Sep 05 18:52:52 2025 +0200
@@ -153,6 +153,16 @@
* @param string $path Language directory path.
*/
public function set_custom_path( $domain, $path ) {
+ // If just-in-time loading was triggered before, reset the entry so it can be tried again.
+
+ if ( isset( $this->all[ $domain ] ) ) {
+ $this->all[ $domain ] = array_filter( $this->all[ $domain ] );
+ }
+
+ if ( empty( $this->current[ $domain ] ) ) {
+ unset( $this->current[ $domain ] );
+ }
+
$this->custom_paths[ $domain ] = rtrim( $path, '/' );
}
@@ -182,8 +192,8 @@
* @since 6.5.0
*
* @param null|array $files List of translation files. Default null.
- * @param string $path The path from which translation files are being fetched.
- **/
+ * @param string $path The path from which translation files are being fetched.
+ */
$files = apply_filters( 'pre_get_language_files_from_path', null, $path );
if ( null !== $files ) {
@@ -336,7 +346,7 @@
* If no path is found for the given locale and a custom path has been set
* using load_plugin_textdomain/load_theme_textdomain, use that one.
*/
- if ( 'en_US' !== $locale && isset( $this->custom_paths[ $domain ] ) ) {
+ if ( isset( $this->custom_paths[ $domain ] ) ) {
$fallback_location = rtrim( $this->custom_paths[ $domain ], '/' ) . '/';
$this->set( $domain, $locale, $fallback_location );
return $fallback_location;