Replace hardcoded RTL list with detected language lookup from dataLocales

This commit is contained in:
Bryan Housel
2016-11-28 00:12:50 -05:00
parent fc0b8a6a90
commit 3f024d0b95
2 changed files with 5 additions and 3 deletions
+3 -1
View File
@@ -1,4 +1,5 @@
import { currentLocale, setTextDirection } from './locale';
import { dataLocales } from '../../data/index';
import { utilStringQs } from './index';
var detected;
@@ -70,7 +71,8 @@ export function utilDetect(force) {
// detect text direction
var q = utilStringQs(window.location.hash.substring(1));
if (['ar', 'fa', 'iw', 'he', 'dv'].indexOf(detected.locale.split('-')[0]) > -1 || q.hasOwnProperty('rtl')) {
var lang = dataLocales[detected.locale];
if ((lang && lang.rtl) || q.hasOwnProperty('rtl')) {
detected.textDirection = 'rtl';
} else {
detected.textDirection = 'ltr';