mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-13 09:12:52 +00:00
Replace hardcoded RTL list with detected language lookup from dataLocales
This commit is contained in:
@@ -307,7 +307,7 @@ export function coreContext() {
|
||||
};
|
||||
|
||||
context.loadLocale = function(callback) {
|
||||
if (locale && locale !== 'en' && dataLocales.indexOf(locale) !== -1) {
|
||||
if (locale && locale !== 'en' && dataLocales.hasOwnProperty(locale)) {
|
||||
localePath = localePath || context.asset('locales/' + locale + '.json');
|
||||
d3.json(localePath, function(err, result) {
|
||||
if (!err) {
|
||||
@@ -351,7 +351,7 @@ export function coreContext() {
|
||||
context.projection = geoRawMercator();
|
||||
|
||||
locale = utilDetect().locale;
|
||||
if (locale && dataLocales.indexOf(locale) === -1) {
|
||||
if (locale && !dataLocales.hasOwnProperty(locale)) {
|
||||
locale = locale.split('-')[0];
|
||||
}
|
||||
|
||||
|
||||
@@ -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';
|
||||
|
||||
Reference in New Issue
Block a user