Make WordPress Core

Opened 15 years ago

Closed 14 years ago

Last modified 14 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's profile 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)

#1 @ocean90
15 years ago

  • Keywords rtl-feedback added; bug removed

#2 @wojtek.szkutnik
14 years ago

Works for me incurrent trunk version

#3 @azaozz
14 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.

#4 @azaozz
14 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.