Do RTL detection based on a translated string, rather than a hardcoded list. Makes things a bit cleaner. fixes #19924, fixes #19600.

git-svn-id: https://develop.svn.wordpress.org/trunk@19836 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin 2012-02-06 19:36:24 +00:00
parent d2a65599a3
commit e92b79e31f
2 changed files with 1 additions and 26 deletions

View File

@ -726,8 +726,6 @@ function wp_load_translations_early() {
load_textdomain( 'default', $location . '/' . $locale . '.mo' );
if ( defined( 'WP_SETUP_CONFIG' ) && file_exists( $location . '/admin-' . $locale . '.mo' ) )
load_textdomain( 'default', $location . '/admin-' . $locale . '.mo' );
if ( WP_Locale::is_locale_rtl( $locale ) )
$text_direction = 'rtl';
break 2;
}
}

View File

@ -84,16 +84,6 @@ class WP_Locale {
*/
var $text_direction = 'ltr';
/**
* Locales which are known to be right-to-left.
*
* @since 3.4.0
* @var array
* @access private
* @static
*/
private static $rtl_locales = array( 'ar', 'ckb', 'fa_IR', 'he_IL', 'ug_CN', 'dv', 'fa_AF', 'ha', 'ps', 'uz_UZ', 'yi' );
/**
* Sets up the translated strings and object properties.
*
@ -190,7 +180,7 @@ class WP_Locale {
// Set text direction.
if ( isset( $GLOBALS['text_direction'] ) )
$this->text_direction = $GLOBALS['text_direction'];
elseif ( is_textdomain_loaded( 'default' ) && self::is_locale_rtl( get_locale() ) )
elseif ( 'rtl' == _x( 'ltr', 'text direction' ) )
$this->text_direction = 'rtl';
}
@ -336,19 +326,6 @@ class WP_Locale {
function is_rtl() {
return 'rtl' == $this->text_direction;
}
/**
* Determines whether a locale is known to be right-to-left.
*
* @since 3.4.0
* @static
*
* @param string Locale in WP format.
* @return bool Whether locale is RTL.
*/
public static function is_locale_rtl( $locale ) {
return in_array( $locale, self::$rtl_locales );
}
}
/**