Make WordPress Core


Ignore:
Timestamp:
02/08/2021 11:49:33 PM (5 years ago)
Author:
noisysocks
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/dependencies/scripts.php

    r50137 r50259  
    724724        $expected .= "<script type='text/javascript' src='/wp-includes/js/dist/hooks{$suffix}.js' id='wp-hooks-js'></script>\n";
    725725        $expected .= "<script type='text/javascript' src='/wp-includes/js/dist/i18n{$suffix}.js' id='wp-i18n-js'></script>\n";
     726        $expected .= "<script type='text/javascript' id='wp-i18n-js-after'>\n";
     727        $expected .= "wp.i18n.setLocaleData( { 'text direction\u0004ltr': [ 'ltr' ] } );\n";
     728        $expected .= "</script>\n";
    726729        $expected .= "<script type='text/javascript' id='wp-a11y-js-translations'>\n";
    727730        $expected .= "( function( domain, translations ) {\n";
Note: See TracChangeset for help on using the changeset viewer.