Add Locale Setting and enable German Translation
This commit is contained in:
parent
4f4728b525
commit
0ba7cc53ca
|
@ -33,6 +33,7 @@ export default Vue.extend({
|
||||||
this.$store.dispatch('grabUserSettings')
|
this.$store.dispatch('grabUserSettings')
|
||||||
this.$store.commit('setUsingElectron', useElectron)
|
this.$store.commit('setUsingElectron', useElectron)
|
||||||
this.checkThemeSettings()
|
this.checkThemeSettings()
|
||||||
|
this.checkLocale()
|
||||||
|
|
||||||
if (useElectron) {
|
if (useElectron) {
|
||||||
console.log('User is using Electron')
|
console.log('User is using Electron')
|
||||||
|
@ -48,6 +49,17 @@ export default Vue.extend({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
checkLocale: function () {
|
||||||
|
const locale = localStorage.getItem('locale')
|
||||||
|
|
||||||
|
if (locale === null) {
|
||||||
|
// TODO: Get User default locale
|
||||||
|
this.$i18n.locale = 'en-US'
|
||||||
|
} else {
|
||||||
|
this.$i18n.locale = locale
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
checkThemeSettings: function () {
|
checkThemeSettings: function () {
|
||||||
let baseTheme = localStorage.getItem('baseTheme')
|
let baseTheme = localStorage.getItem('baseTheme')
|
||||||
let mainColor = localStorage.getItem('mainColor')
|
let mainColor = localStorage.getItem('mainColor')
|
||||||
|
|
|
@ -23,6 +23,7 @@ export default Vue.extend({
|
||||||
showInvidiousInstances: false,
|
showInvidiousInstances: false,
|
||||||
instanceNames: [],
|
instanceNames: [],
|
||||||
instanceValues: [],
|
instanceValues: [],
|
||||||
|
currentLocale: '',
|
||||||
backendValues: [
|
backendValues: [
|
||||||
'invidious',
|
'invidious',
|
||||||
'local'
|
'local'
|
||||||
|
@ -562,6 +563,10 @@ export default Vue.extend({
|
||||||
return this.$store.getters.getThumbnailPreference
|
return this.$store.getters.getThumbnailPreference
|
||||||
},
|
},
|
||||||
|
|
||||||
|
localeOptions: function () {
|
||||||
|
return Object.keys(this.$i18n.messages)
|
||||||
|
},
|
||||||
|
|
||||||
backendNames: function () {
|
backendNames: function () {
|
||||||
return [
|
return [
|
||||||
this.$t('Settings.General Settings.Preferred API Backend.Invidious API'),
|
this.$t('Settings.General Settings.Preferred API Backend.Invidious API'),
|
||||||
|
@ -614,6 +619,8 @@ export default Vue.extend({
|
||||||
})
|
})
|
||||||
|
|
||||||
this.updateInvidiousInstanceBounce = debounce(this.updateInvidiousInstance, 500)
|
this.updateInvidiousInstanceBounce = debounce(this.updateInvidiousInstance, 500)
|
||||||
|
|
||||||
|
this.currentLocale = this.$i18n.locale
|
||||||
},
|
},
|
||||||
beforeDestroy: function () {
|
beforeDestroy: function () {
|
||||||
if (this.invidiousInstance === '') {
|
if (this.invidiousInstance === '') {
|
||||||
|
@ -626,6 +633,11 @@ export default Vue.extend({
|
||||||
this.updateInvidiousInstanceBounce(invidiousInstance)
|
this.updateInvidiousInstanceBounce(invidiousInstance)
|
||||||
},
|
},
|
||||||
|
|
||||||
|
updateLocale: function (locale) {
|
||||||
|
this.$i18n.locale = locale
|
||||||
|
localStorage.setItem('locale', locale)
|
||||||
|
},
|
||||||
|
|
||||||
...mapActions([
|
...mapActions([
|
||||||
'updateEnableSearchSuggestions',
|
'updateEnableSearchSuggestions',
|
||||||
'updateBackendFallback',
|
'updateBackendFallback',
|
||||||
|
|
|
@ -63,6 +63,13 @@
|
||||||
:select-values="thumbnailTypeValues"
|
:select-values="thumbnailTypeValues"
|
||||||
@change="updateThumbnailPreference"
|
@change="updateThumbnailPreference"
|
||||||
/>
|
/>
|
||||||
|
<ft-select
|
||||||
|
placeholder="Change Locale"
|
||||||
|
:value="currentLocale"
|
||||||
|
:select-names="localeOptions"
|
||||||
|
:select-values="localeOptions"
|
||||||
|
@change="updateLocale"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<ft-flex-box class="generalSettingsFlexBox">
|
<ft-flex-box class="generalSettingsFlexBox">
|
||||||
<ft-input
|
<ft-input
|
||||||
|
|
|
@ -33,7 +33,7 @@ fs.readdir('.', (err, dir) => {
|
||||||
})
|
})
|
||||||
|
|
||||||
// List of locales approved for use
|
// List of locales approved for use
|
||||||
const activeLocales = ['en-US']
|
const activeLocales = ['en-US', 'de-DE']
|
||||||
const messages = {}
|
const messages = {}
|
||||||
|
|
||||||
// Take active locales and load respective YAML file
|
// Take active locales and load respective YAML file
|
||||||
|
|
|
@ -106,6 +106,7 @@ Settings:
|
||||||
Fallback to Non-Preferred Backend on Failure: Falle zu nicht-präferiertem System bei Fehlschlag zurück
|
Fallback to Non-Preferred Backend on Failure: Falle zu nicht-präferiertem System bei Fehlschlag zurück
|
||||||
Enable Search Suggestions: Aktiviere Suchvorschläge
|
Enable Search Suggestions: Aktiviere Suchvorschläge
|
||||||
Default Landing Page: Standardseite
|
Default Landing Page: Standardseite
|
||||||
|
Locale Preference: Locale Preference
|
||||||
Preferred API Backend:
|
Preferred API Backend:
|
||||||
Preferred API Backend: Präferiertes API System
|
Preferred API Backend: Präferiertes API System
|
||||||
Local API: Lokale API
|
Local API: Lokale API
|
||||||
|
|
|
@ -106,6 +106,7 @@ Settings:
|
||||||
Fallback to Non-Preferred Backend on Failure: Fallback to Non-Preferred Backend on Failure
|
Fallback to Non-Preferred Backend on Failure: Fallback to Non-Preferred Backend on Failure
|
||||||
Enable Search Suggestions: Enable Search Suggestions
|
Enable Search Suggestions: Enable Search Suggestions
|
||||||
Default Landing Page: Default Landing Page
|
Default Landing Page: Default Landing Page
|
||||||
|
Locale Preference: Locale Preference
|
||||||
Preferred API Backend:
|
Preferred API Backend:
|
||||||
Preferred API Backend: Preferred API Backend
|
Preferred API Backend: Preferred API Backend
|
||||||
Local API: Local API
|
Local API: Local API
|
||||||
|
|
Loading…
Reference in New Issue