WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#14129 closed defect (bug) (invalid)

RTL admin CSS files not loaded even if xx_XX.php states $text_direction = 'rtl';

Reported by: codestyling Owned by:
Milestone: Priority: normal
Severity: blocker Version:
Component: I18N Keywords:
Focuses: Cc:

Description

If you have a language file needs to be loaded with RTL support like he_IL.php (languages folder), you will find inside

$text_direction = 'rtl';

So if you allow by plugin a dynamically switch of backend languages driven by user choise, this wont work anymore (prev 3.0 works!) because the follwoing file makes a wrong assumption: /wp-includes/script-loader.php

The questionable function is print_admin_styles() where the $dir var will be taken out of a style not proper configured:

$dir = $wp_styles->text_direction;

This can be repaired by using the correctly set global locale object:

global $wp_locale;
$dir = $wp_locale->text_direction;

afterwards the admin menu is correctly displayed right hand side instead of left side.

Reproducing the bug is easy: use original US WP version 3.0, download he_IL.mo and he_IL.php and change only define ('WPLANG', 'he_IL');
I would expect now the admin menu on right hand side but it's still left side, what is wrong!

Change History (4)

comment:1 ocean904 years ago

  • Keywords rtl-feedback added; bug removed

comment:2 wojtek.szkutnik4 years ago

Works for me incurrent trunk version

comment:3 azaozz4 years ago

  • Resolution set to invalid
  • Status changed from new to closed

The text direction in $styles is assigned when the default stylesheets are queued, L: 424 in script-loader.php

$styles->text_direction = function_exists( 'is_rtl' ) && is_rtl() ? 'rtl' : 'ltr';

The problem you're seeing in your plugin may be caused by premature queueing of the stylesheets or if you're changing the text direction after stylesheetrs have been queued.

comment:4 azaozz4 years ago

  • Keywords RTL admin stylsheet rtl-feedback removed
  • Milestone Awaiting Review deleted
  • Version 3.0 deleted
Note: See TracTickets for help on using tickets.