An RTL WPLANG results in RTL even if messages are not loaded
|Reported by:||nacin||Owned by:||nacin|
define( 'WPLANG', 'he_IL' ); in wp-config.php results in get_locale() returning 'he_IL', and he_IL.mo will attempt to be loaded, as will he_IL.php.
he_IL.php previously set $text_direction = 'rtl'; It is a reasonable assumption that if he_IL.php is installed in WP_LANG_DIR, then so is he_IL.mo.
The new RTL detection code introduced in #19600 acts without the need for he_IL.php.
While I would consider it an incorrect configuration to have WPLANG = he_IL, I imagine there are some installations out there with an RTL WPLANG but no language files to trigger it. Normally, this would result in an English interface, but now, this would result in an English interface in RTL mode.
Maybe this is more edge than I am anticipating, but perhaps an is_readable() check of the $locale.mo file would make sense before trusting WP_Locale::is_locale_rtl().
We could give load_default_textdomain() a return value of its first load_textdomain() call, and then decide to not even load the $locale.php file or trigger an RTL switch.