mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 17:56:25 +00:00
Merge pull request #1807 from ZeroX-DG/master
Edited theme and language init code to avoid code repetition
This commit is contained in:
@@ -140,43 +140,37 @@ class Main extends React.Component {
|
|||||||
componentDidMount () {
|
componentDidMount () {
|
||||||
const { dispatch, config } = this.props
|
const { dispatch, config } = this.props
|
||||||
|
|
||||||
if (config.ui.theme === 'dark') {
|
const supportedThemes = [
|
||||||
document.body.setAttribute('data-theme', 'dark')
|
'dark',
|
||||||
} else if (config.ui.theme === 'white') {
|
'white',
|
||||||
document.body.setAttribute('data-theme', 'white')
|
'solarized-dark'
|
||||||
} else if (config.ui.theme === 'solarized-dark') {
|
]
|
||||||
document.body.setAttribute('data-theme', 'solarized-dark')
|
|
||||||
|
if (supportedThemes.indexOf(config.ui.theme) !== -1) {
|
||||||
|
document.body.setAttribute('data-theme', config.ui.theme)
|
||||||
} else {
|
} else {
|
||||||
document.body.setAttribute('data-theme', 'default')
|
document.body.setAttribute('data-theme', 'default')
|
||||||
}
|
}
|
||||||
if (config.ui.language === 'sq') {
|
|
||||||
i18n.setLocale('sq')
|
const supportedLanguages = [
|
||||||
} else if (config.ui.language === 'zh-CN') {
|
'sq',
|
||||||
i18n.setLocale('zh-CN')
|
'zh-CN',
|
||||||
} else if (config.ui.language === 'zh-TW') {
|
'zh-TW',
|
||||||
i18n.setLocale('zh-TW')
|
'da',
|
||||||
} else if (config.ui.language === 'da') {
|
'fr',
|
||||||
i18n.setLocale('da')
|
'de',
|
||||||
} else if (config.ui.language === 'fr') {
|
'hu',
|
||||||
i18n.setLocale('fr')
|
'ja',
|
||||||
} else if (config.ui.language === 'de') {
|
'ko',
|
||||||
i18n.setLocale('de')
|
'no',
|
||||||
} else if (config.ui.language === 'hu') {
|
'pl',
|
||||||
i18n.setLocale('hu')
|
'pt',
|
||||||
} else if (config.ui.language === 'ja') {
|
'ru',
|
||||||
i18n.setLocale('ja')
|
'es-ES'
|
||||||
} else if (config.ui.language === 'ko') {
|
]
|
||||||
i18n.setLocale('ko')
|
|
||||||
} else if (config.ui.language === 'no') {
|
if (supportedLanguages.indexOf(config.ui.language) !== -1) {
|
||||||
i18n.setLocale('no')
|
i18n.setLocale(config.ui.language)
|
||||||
} else if (config.ui.language === 'pl') {
|
|
||||||
i18n.setLocale('pl')
|
|
||||||
} else if (config.ui.language === 'pt') {
|
|
||||||
i18n.setLocale('pt')
|
|
||||||
} else if (config.ui.language === 'ru') {
|
|
||||||
i18n.setLocale('ru')
|
|
||||||
} else if (config.ui.language === 'es-ES') {
|
|
||||||
i18n.setLocale('es-ES')
|
|
||||||
} else {
|
} else {
|
||||||
i18n.setLocale('en')
|
i18n.setLocale('en')
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user