Fix wp.i18n.isRTL()

Fixes a bug causing wp.i18n.isRTL() to return false in RTL langauges by manually
loading the translated 'ltr' string for the i18n dependency. This ports over an
identical fix that was made in Gutenberg.

Fixes #52441.
Props @jonsurrell @youknowriad.


git-svn-id: https://develop.svn.wordpress.org/trunk@50259 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Robert Anderson
2021-02-08 23:49:33 +00:00
parent 27a113951b
commit 385c29b49a
3 changed files with 23 additions and 6 deletions
@@ -723,6 +723,9 @@ JS;
$expected .= "<script type='text/javascript' src='/wp-includes/js/dist/dom-ready{$suffix}.js' id='wp-dom-ready-js'></script>\n";
$expected .= "<script type='text/javascript' src='/wp-includes/js/dist/hooks{$suffix}.js' id='wp-hooks-js'></script>\n";
$expected .= "<script type='text/javascript' src='/wp-includes/js/dist/i18n{$suffix}.js' id='wp-i18n-js'></script>\n";
$expected .= "<script type='text/javascript' id='wp-i18n-js-after'>\n";
$expected .= "wp.i18n.setLocaleData( { 'text direction\u0004ltr': [ 'ltr' ] } );\n";
$expected .= "</script>\n";
$expected .= "<script type='text/javascript' id='wp-a11y-js-translations'>\n";
$expected .= "( function( domain, translations ) {\n";
$expected .= " var localeData = translations.locale_data[ domain ] || translations.locale_data.messages;\n";