Make WordPress Core

Changeset 19755


Ignore:
Timestamp:
01/25/2012 10:41:55 PM (15 years ago)
Author:
nacin
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/locale.php

    r19754 r19755  
    8484         */
    8585        var $text_direction = 'ltr';
     86
     87        /**
     88         * Locales which are known to be right-to-left.
     89         */
     90        private $rtl_locales = array( 'ar', 'ckb', 'fa_IR', 'he_IL', 'ug_CN', 'dv', 'fa_AF', 'ha', 'ps', 'uz_UZ', 'yi' );
    8691
    8792        /**
    … …  
    178183                $this->number_format['decimal_point'] = ('number_format_decimal_point' == $trans) ? '.' : $trans;
    179184
     185                // Locale-specific tweaks
     186                if ( in_array( get_locale(), $this->rtl_locales ) )
     187                        $this->text_direction = 'rtl';
     188
    180189                // Import the $text_direction global.
    181190                if ( isset( $GLOBALS['text_direction'] ) )
    182191                        $this->text_direction = $GLOBALS['text_direction'];
    183 
    184192        }
    185193
    … …  
    322330         * @return bool Whether locale is RTL.
    323331         */
    324          function is_rtl() {
    325                 return 'rtl' == $this->text_direction;
    326          }
     332        function is_rtl() {
     333                return 'rtl' == $this->text_direction;
     334        }
     335
    327336}
    328337
Note: See TracChangeset for help on using the changeset viewer.