1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-13 17:56:25 +00:00

Centralized languages into 1 file

This commit is contained in:
Hung Nguyen
2018-04-17 09:59:30 +07:00
parent 4a6b22f5b7
commit 47af3f09fc
4 changed files with 84 additions and 33 deletions

View File

@@ -15,6 +15,7 @@ import eventEmitter from 'browser/main/lib/eventEmitter'
import { hashHistory } from 'react-router'
import store from 'browser/main/store'
import i18n from 'browser/lib/i18n'
import { languages } from 'browser/lib/Languages'
const path = require('path')
const electron = require('electron')
const { remote } = electron
@@ -152,24 +153,12 @@ class Main extends React.Component {
document.body.setAttribute('data-theme', 'default')
}
const supportedLanguages = [
'sq',
'zh-CN',
'zh-TW',
'da',
'fr',
'de',
'hu',
'ja',
'ko',
'no',
'pl',
'pt',
'ru',
'es-ES'
]
let locales = languages.reduce(function (localeList, locale) {
localeList.push(locale.locale)
return localeList
}, [])
if (supportedLanguages.indexOf(config.ui.language) !== -1) {
if (locales.indexOf(config.ui.language) !== -1) {
i18n.setLocale(config.ui.language)
} else {
i18n.setLocale('en')