Skip to content

Commit

Permalink
More locale #151
Browse files Browse the repository at this point in the history
  • Loading branch information
sbs20 committed Mar 27, 2021
1 parent 067c0bc commit 1699a8c
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 3 deletions.
2 changes: 1 addition & 1 deletion webui/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
5 changes: 5 additions & 0 deletions webui/src/classes/constants.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
const Constants = {
Version: process.env.VUE_APP_VERSION,

Locales: [
'en',
'test'
],

Keys: {
enter: 13,
escape: 27
Expand Down
3 changes: 2 additions & 1 deletion webui/src/classes/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ export default class Settings {
static default() {
return {
version: Constants.Version,
theme: 'system'
theme: 'system',
locale: 'en'
};
}
}
14 changes: 13 additions & 1 deletion webui/src/components/Settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,21 @@
</template>
<template v-slot:action>
<div style="max-width: 9rem;">
<v-select label="Theme" :items="themes" v-model="settings.theme" @change="reload"></v-select>
<v-select :label="$t('settings.theme')" :items="themes" v-model="settings.theme" @change="reload"></v-select>
</div>
</template>
</settings-item>
<settings-item>
<template v-slot:description>
{{ $t('settings.locale:description') }}
</template>
<template v-slot:action>
<div style="max-width: 9rem;">
<v-select :label="$t('settings.locale')" :items="locales" v-model="settings.locale" @change="reload"></v-select>
</div>
</template>
</settings-item>

</template>
</settings-section>
</div>
Expand All @@ -38,6 +49,7 @@ export default {
data() {
return {
settings: storage.settings,
locales: Constants.Locales,
themes: [
{
text: this.$t('settings.theme:system'),
Expand Down
2 changes: 2 additions & 0 deletions webui/src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 2 additions & 0 deletions webui/src/locales/test.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 1699a8c

Please sign in to comment.