From 1699a8cc5c2c47f471ced83025905efc0dfbf412 Mon Sep 17 00:00:00 2001 From: sbs20 Date: Sat, 27 Mar 2021 16:07:26 +0000 Subject: [PATCH] More locale #151 --- webui/src/App.vue | 2 +- webui/src/classes/constants.js | 5 +++++ webui/src/classes/settings.js | 3 ++- webui/src/components/Settings.vue | 14 +++++++++++++- webui/src/locales/en.json | 2 ++ webui/src/locales/test.json | 2 ++ 6 files changed, 25 insertions(+), 3 deletions(-) diff --git a/webui/src/App.vue b/webui/src/App.vue index 49926c17..8d21b782 100644 --- a/webui/src/App.vue +++ b/webui/src/App.vue @@ -53,7 +53,7 @@ export default { } this.$vuetify.theme.dark = theme === Constants.Themes.Dark; - // this.$i18n.locale = 'test'; + this.$i18n.locale = storage.settings.locale; // Default route if connected if (this.$route.matched.length === 0) { diff --git a/webui/src/classes/constants.js b/webui/src/classes/constants.js index e120e568..04e2b3a3 100644 --- a/webui/src/classes/constants.js +++ b/webui/src/classes/constants.js @@ -1,6 +1,11 @@ const Constants = { Version: process.env.VUE_APP_VERSION, + Locales: [ + 'en', + 'test' + ], + Keys: { enter: 13, escape: 27 diff --git a/webui/src/classes/settings.js b/webui/src/classes/settings.js index 0843303e..c9787a92 100644 --- a/webui/src/classes/settings.js +++ b/webui/src/classes/settings.js @@ -9,7 +9,8 @@ export default class Settings { static default() { return { version: Constants.Version, - theme: 'system' + theme: 'system', + locale: 'en' }; } } \ No newline at end of file diff --git a/webui/src/components/Settings.vue b/webui/src/components/Settings.vue index 54611381..c825e356 100644 --- a/webui/src/components/Settings.vue +++ b/webui/src/components/Settings.vue @@ -10,10 +10,21 @@ + + + + + @@ -38,6 +49,7 @@ export default { data() { return { settings: storage.settings, + locales: Constants.Locales, themes: [ { text: this.$t('settings.theme:system'), diff --git a/webui/src/locales/en.json b/webui/src/locales/en.json index 803070fd..3feb82df 100644 --- a/webui/src/locales/en.json +++ b/webui/src/locales/en.json @@ -77,6 +77,8 @@ "settings": { "title": "Settings", "behaviour-ui": "Behaviour and UI", + "locale": "Locale", + "locale:description": "Choose your locale", "theme": "Theme", "theme:description": "Theme. If you use system theme and change it, you will need to reload the app.", "theme:system": "System", diff --git a/webui/src/locales/test.json b/webui/src/locales/test.json index f4d9a31c..39b0b6d3 100644 --- a/webui/src/locales/test.json +++ b/webui/src/locales/test.json @@ -78,6 +78,8 @@ "settings": { "title": "##SETTINGS.TITLE", "behaviour-ui": "##SETTINGS.BEHAVIOUR-UI", + "locale": "##SETTINGS.LOCALE", + "locale:description": "##SETTINGS.LOCALE-DESCRIPTION", "theme": "##SETTINGS.THEME", "theme:description": "##SETTINGS.THEME:DESCRIPTION", "theme:system": "##SETTINGS.THEME:SYSTEM",