From 14f7f0519076c0c9f31ac1636bc356f4382ddb6f Mon Sep 17 00:00:00 2001 From: Dominik Schilling Date: Tue, 15 Mar 2022 16:00:02 +0000 Subject: [PATCH] I18N, Script Loader: Don't register empty locale data objects. For `wp.i18n` the library [https://github.com/messageformat/Jed Jed] was initially used which was throwing an error if a domain was not registered but used in a translate function. Later, the library was replaced by [https://github.com/aduth/tannin Tannin] which no longer requires the domain to be registered and thus we can avoid printing an empty-ish translations script that doesn't add any translations. Props jsnajdr. Fixes #55250. Built from https://develop.svn.wordpress.org/trunk@52937 git-svn-id: http://core.svn.wordpress.org/trunk@52526 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class.wp-scripts.php | 3 +-- wp-includes/version.php | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/wp-includes/class.wp-scripts.php b/wp-includes/class.wp-scripts.php index 10104d6dfa..8edf4ee49b 100644 --- a/wp-includes/class.wp-scripts.php +++ b/wp-includes/class.wp-scripts.php @@ -599,8 +599,7 @@ class WP_Scripts extends WP_Dependencies { $json_translations = load_script_textdomain( $handle, $domain, $path ); if ( ! $json_translations ) { - // Register empty locale data object to ensure the domain still exists. - $json_translations = '{ "locale_data": { "messages": { "": {} } } }'; + return false; } $output = <<