Initial support for RTL detection in core. props SergeyBiryukov for compiling the list. fixes #19600.

git-svn-id: http://svn.automattic.com/wordpress/trunk@19755 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
nacin 2012-01-25 22:41:55 +00:00
parent c06c813b46
commit 853fa27b53
1 changed files with 13 additions and 4 deletions

View File

@ -84,6 +84,11 @@ class WP_Locale {
*/
var $text_direction = 'ltr';
/**
* Locales which are known to be right-to-left.
*/
private $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.
*
@ -177,10 +182,13 @@ class WP_Locale {
$trans = __('number_format_decimal_point');
$this->number_format['decimal_point'] = ('number_format_decimal_point' == $trans) ? '.' : $trans;
// Locale-specific tweaks
if ( in_array( get_locale(), $this->rtl_locales ) )
$this->text_direction = 'rtl';
// Import the $text_direction global.
if ( isset( $GLOBALS['text_direction'] ) )
$this->text_direction = $GLOBALS['text_direction'];
}
/**
@ -321,9 +329,10 @@ class WP_Locale {
* @since 3.0.0
* @return bool Whether locale is RTL.
*/
function is_rtl() {
return 'rtl' == $this->text_direction;
}
function is_rtl() {
return 'rtl' == $this->text_direction;
}
}
/**