Unverified Commit 251728f7 authored by Sasha Sorokin's avatar Sasha Sorokin 🇷🇺

fix: auto-prepare array of supported locales

All locales in `defaultLocales` are supported and can be selected
by the end-user, so we don't have any reasons to fill them in manually.

This commit changes so that for every locale in `defaultLocales`, an
element containing its name will be pushed to `supportedLocales` array.

Fixes #23
parent 34786370
......@@ -6,25 +6,6 @@ import {
LANGUAGES_FETCH_SUCCESS,
} from './actions';
const supportedLocales = [
'ar',
'cs',
'cy',
'de',
'en',
'es',
'fr',
'ja',
'ko',
'nl-NL',
'pl',
'pt-BR',
'sq',
'tr',
'zh',
'zh-TW',
];
const defaultLanguages = [
{ locale: 'ar', language: 'العربية' },
{ locale: 'ca', language: 'Català' },
......@@ -53,6 +34,12 @@ const defaultLanguages = [
{ locale: 'zh', language: '中文' },
];
const supportedLocales = [];
for (let i = 0, l = defaultLanguages.length; i < l; i++) {
supportedLocales.push(defaultLanguages[i].locale);
}
const initialLocale = () => {
const lang = navigator.language.split('-')[0];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment