mirror of
https://github.com/WordPress/WordPress.git
synced 2025-02-02 05:31:25 +01:00
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: http://svn.automattic.com/wordpress/trunk@19836 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
d7fd5c3d42
commit
1d5e72a39c
@ -726,8 +726,6 @@ function wp_load_translations_early() {
|
|||||||
load_textdomain( 'default', $location . '/' . $locale . '.mo' );
|
load_textdomain( 'default', $location . '/' . $locale . '.mo' );
|
||||||
if ( defined( 'WP_SETUP_CONFIG' ) && file_exists( $location . '/admin-' . $locale . '.mo' ) )
|
if ( defined( 'WP_SETUP_CONFIG' ) && file_exists( $location . '/admin-' . $locale . '.mo' ) )
|
||||||
load_textdomain( 'default', $location . '/admin-' . $locale . '.mo' );
|
load_textdomain( 'default', $location . '/admin-' . $locale . '.mo' );
|
||||||
if ( WP_Locale::is_locale_rtl( $locale ) )
|
|
||||||
$text_direction = 'rtl';
|
|
||||||
break 2;
|
break 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -84,16 +84,6 @@ class WP_Locale {
|
|||||||
*/
|
*/
|
||||||
var $text_direction = 'ltr';
|
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.
|
* Sets up the translated strings and object properties.
|
||||||
*
|
*
|
||||||
@ -190,7 +180,7 @@ class WP_Locale {
|
|||||||
// Set text direction.
|
// Set text direction.
|
||||||
if ( isset( $GLOBALS['text_direction'] ) )
|
if ( isset( $GLOBALS['text_direction'] ) )
|
||||||
$this->text_direction = $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';
|
$this->text_direction = 'rtl';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -336,19 +326,6 @@ class WP_Locale {
|
|||||||
function is_rtl() {
|
function is_rtl() {
|
||||||
return 'rtl' == $this->text_direction;
|
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 );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user