[wp-trac] [WordPress Trac] #52441: Fix wp.i18n.isRTL() returning false in RTL languages

WordPress Trac noreply at wordpress.org
Thu Feb 4 16:17:08 UTC 2021


#52441: Fix wp.i18n.isRTL() returning false in RTL languages
--------------------------------------+-------------------------
 Reporter:  noisysocks                |       Owner:  noisysocks
     Type:  defect (bug)              |      Status:  assigned
 Priority:  normal                    |   Milestone:  5.7
Component:  I18N                      |     Version:
 Severity:  normal                    |  Resolution:
 Keywords:  has-patch has-unit-tests  |     Focuses:
--------------------------------------+-------------------------

Comment (by jonsurrell):

 I've tested https://github.com/WordPress/wordpress-develop/pull/977 with
 WordPress 5.6.1 by:

 - Set RTL language
 - Enter post editor
 - Console log `wp.i18n.isRTL()` (should be `true`)
 - Without the patch, it's `false`
 - Manually apply the patch and the result is then `true` as it should be.

 The patch seems to work and is very similar to the solution used in
 Gutenberg.

 This does seem like more of a workaround to me, I understand the solution
 to https://core.trac.wordpress.org/ticket/46089 is complex but I'd really
 like to see a solution for that. This has the limitation that it still
 doesn't add `wp-i18n` translations, it just adds a specific translation
 that we know is required.

 What about adding a condition to `WP_Scripts::print_translations` to print
 the localization after if the script is the `wp-i18n` script?

 https://github.com/WordPress/wordpress-
 develop/blob/3c40632397cf1ee64e09c7ac767391dfac59e5ea/src/wp-
 includes/class.wp-scripts.php#L574-L602

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/52441#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list