Changeset 52937
- Timestamp:
- 03/15/2022 03:57:57 PM (3 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class.wp-scripts.php
r52610 r52937 600 600 601 601 if ( ! $json_translations ) { 602 // Register empty locale data object to ensure the domain still exists. 603 $json_translations = '{ "locale_data": { "messages": { "": {} } } }'; 602 return false; 604 603 } 605 604 -
trunk/tests/phpunit/tests/dependencies/scripts.php
r52010 r52937 741 741 $expected .= "wp.i18n.setLocaleData( { 'text direction\u0004ltr': [ 'ltr' ] } );\n"; 742 742 $expected .= "</script>\n"; 743 $expected .= "<script type='text/javascript' id='wp-a11y-js-translations'>\n";744 $expected .= "( function( domain, translations ) {\n";745 $expected .= " var localeData = translations.locale_data[ domain ] || translations.locale_data.messages;\n";746 $expected .= " localeData[\"\"].domain = domain;\n";747 $expected .= " wp.i18n.setLocaleData( localeData, domain );\n";748 $expected .= "} )( \"default\", { \"locale_data\": { \"messages\": { \"\": {} } } } );\n";749 $expected .= "</script>\n";750 743 $expected .= "<script type='text/javascript' src='/wp-includes/js/dist/a11y{$suffix}.js' id='wp-a11y-js'></script>\n"; 751 744 $expected .= "<script type='text/javascript' src='http://example2.com' id='test-example2-js'></script>\n"; … … 995 988 /** 996 989 * @ticket 45103 990 * @ticket 55250 997 991 */ 998 992 public function test_wp_set_script_translations_when_translation_file_does_not_exist() { … … 1002 996 1003 997 $expected = "<script type='text/javascript' src='/wp-includes/js/dist/wp-i18n.js' id='wp-i18n-js'></script>\n"; 1004 $expected .= str_replace(1005 array(1006 '__DOMAIN__',1007 '__HANDLE__',1008 '__JSON_TRANSLATIONS__',1009 ),1010 array(1011 'admin',1012 'test-example',1013 '{ "locale_data": { "messages": { "": {} } } }',1014 ),1015 $this->wp_scripts_print_translations_output1016 );1017 998 $expected .= "<script type='text/javascript' src='/wp-admin/js/script.js' id='test-example-js'></script>\n"; 1018 999
Note: See TracChangeset
for help on using the changeset viewer.