Added set language to the Setup.vue

This commit is contained in:
Ponkhy 2021-09-05 15:40:35 +02:00
parent d34ed00841
commit 1b8b33c4c3
3 changed files with 19 additions and 3 deletions

View File

@ -108,5 +108,6 @@ export default {
"Repeat Password": "Wiederhole das Passwort", "Repeat Password": "Wiederhole das Passwort",
"Resource Record Type": "Resource Record Type", "Resource Record Type": "Resource Record Type",
respTime: "Antw. Zeit (ms)", respTime: "Antw. Zeit (ms)",
notAvailableShort: "N/A" notAvailableShort: "N/A",
Create: "Erstellen",
} }

View File

@ -108,5 +108,6 @@ export default {
"Create your admin account": "Create your admin account", "Create your admin account": "Create your admin account",
"Repeat Password": "Repeat Password", "Repeat Password": "Repeat Password",
respTime: "Resp. Time (ms)", respTime: "Resp. Time (ms)",
notAvailableShort: "N/A" notAvailableShort: "N/A",
Create: "Create",
} }

View File

@ -14,6 +14,15 @@
</p> </p>
<div class="form-floating"> <div class="form-floating">
<select id="language" v-model="$i18n.locale" class="form-select">
<option v-for="(lang, i) in $i18n.availableLocales" :key="`Lang${i}`" :value="lang">
{{ $i18n.messages[lang].languageName }}
</option>
</select>
<label for="language" class="form-label">{{ $t("Language") }}</label>
</div>
<div class="form-floating mt-3">
<input id="floatingInput" v-model="username" type="text" class="form-control" placeholder="Username" required> <input id="floatingInput" v-model="username" type="text" class="form-control" placeholder="Username" required>
<label for="floatingInput">{{ $t("Username") }}</label> <label for="floatingInput">{{ $t("Username") }}</label>
</div> </div>
@ -29,7 +38,7 @@
</div> </div>
<button class="w-100 btn btn-primary mt-3" type="submit" :disabled="processing"> <button class="w-100 btn btn-primary mt-3" type="submit" :disabled="processing">
Create {{ $t("Create") }}
</button> </button>
</form> </form>
</div> </div>
@ -49,6 +58,11 @@ export default {
repeatPassword: "", repeatPassword: "",
} }
}, },
watch: {
"$i18n.locale"() {
localStorage.locale = this.$i18n.locale;
},
},
mounted() { mounted() {
this.$root.getSocket().emit("needSetup", (needSetup) => { this.$root.getSocket().emit("needSetup", (needSetup) => {
if (! needSetup) { if (! needSetup) {