Initial support for RTL detection in core. props SergeyBiryukov for compiling the list. fixes #19600.
git-svn-id: https://develop.svn.wordpress.org/trunk@19755 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
eb56e50088
commit
16cc855201
|
@ -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'];
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -324,6 +332,7 @@ class WP_Locale {
|
|||
function is_rtl() {
|
||||
return 'rtl' == $this->text_direction;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue