I18N: Set translations for all WordPress packages scripts.

Calls `wp_set_script_translations` for all packages scripts that have translations. Also correctly sets the domain on the translations.

Props omarreiss, pento, ocean90.
Merges [43878] to trunk.
Fixes #45161.

git-svn-id: https://develop.svn.wordpress.org/trunk@44239 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov
2018-12-16 22:23:34 +00:00
parent c687f1957e
commit a10598acd0
3 changed files with 33 additions and 9 deletions

View File

@@ -546,7 +546,8 @@ class WP_Scripts extends WP_Dependencies {
}
$output = '(function( translations ){' .
'wp.i18n.setLocaleData( translations.locale_data, "' . $domain . '" );' .
'translations.locale_data.messages[""].domain = "' . $domain . '";' .
'wp.i18n.setLocaleData( translations.locale_data.messages, "' . $domain . '" );' .
'})(' . $json_translations . ');';
if ( $echo ) {