From 39c4d8b88862586fff789fc05bbdad228c6e84ca Mon Sep 17 00:00:00 2001 From: ian Date: Tue, 20 Feb 2024 16:49:48 +0000 Subject: [PATCH] user menu i18n --- src/components/UserSettings.vue | 36 +++++++++++++++++---------------- src/i18n/en-GB.js | 15 ++++++++++++++ 2 files changed, 34 insertions(+), 17 deletions(-) diff --git a/src/components/UserSettings.vue b/src/components/UserSettings.vue index 12f40a83..92ff908c 100644 --- a/src/components/UserSettings.vue +++ b/src/components/UserSettings.vue @@ -34,59 +34,59 @@ v-on:keyup.enter="showAdminPanel()" @click="showAdminPanel()" > - Admin Panel + {{ translate("SETTINGS.ADMIN") }}
  • - Account + {{ translate("SETTINGS.ACCOUNT") }}
  • - Profile + {{ translate("SETTINGS.PROFILE") }}
  • - Feedback + {{ translate("SETTINGS.FEEDBACK") }}
  • - Tour + {{ translate("SETTINGS.TOUR") }}
  • - Help/FAQ + {{ translate("SETTINGS.HELP") }}
  • - Authentication + {{ translate("SETTINGS.AUTH") }}
  • - Change Password + {{ translate("SETTINGS.PASS") }}
  • - Cleanup Failed Uploads + {{ translate("SETTINGS.CLEANUP") }}
  • - Set Cache size + {{ translate("SETTINGS.CACHE") }}
  • - Delete Account + {{ translate("SETTINGS.DELETE") }}
  • -
  • Log out
  • +
  • {{ translate("SETTINGS.LOGOUT") }}
  • @@ -125,6 +125,7 @@ const AppDropdown = require("./AppDropdown.vue"); const AppIcon = require("AppIcon.vue"); const AppPrompt = require("./prompt/AppPrompt.vue"); const Spinner = require("./spinner/Spinner.vue"); +const i18n = require("../i18n/index.js"); module.exports = { components: { @@ -135,6 +136,7 @@ module.exports = { Spinner, AppIcon, }, + mixins:[i18n], data() { return { profileImage: "", @@ -179,7 +181,7 @@ module.exports = { } getBrowserStorageQuota().then(maxStorage => { let maxStorageMiB = Math.floor(maxStorage /1024 /1024); - this.prompt_message = 'Set Cache Size (MiB)'; + this.prompt_message = this.translate("SETTINGS.CACHE") + ' (MiB)'; let roundedCurrentCacheSize = Math.floor(getCurrentDesiredCacheSize()); this.prompt_value = '' + roundedCurrentCacheSize; this.prompt_placeholder = " "; @@ -190,18 +192,19 @@ module.exports = { } let newCacheSizeMiB = prompt_result.trim(); if (!that.validateCacheSize(newCacheSizeMiB)) { - that.$toast.error('Cache size value not valid', {timeout:false}); + that.$toast.error(that.translate("SETTINGS.CACHE.INVALID"), {timeout:false}); return; } let validNewCacheSize = Number(newCacheSizeMiB); if (validNewCacheSize > maxStorageMiB) { - that.$toast.error('Invalid Cache size. Maximum Cache Size: ' + maxStorageMiB + ' MiB', {timeout:false}); + that.$toast.error(that.translate("SETTINGS.CACHE.LARGE") + .replace("$SIZE", maxStorageMiB), {timeout:false}); } else { if (roundedCurrentCacheSize != validNewCacheSize) { that.showSettingsSpinner = true; modifyCacheSize(validNewCacheSize).thenApply(() => { that.showSettingsSpinner = false; - that.$toast('Cache Size Updated'); + that.$toast(that.translate("SETTINGS.CACHE.UPDATED")); }); } } @@ -246,7 +249,6 @@ module.exports = { }, showAdminPanel() { if (this.context == null) return; - console.log("admin panel..."); const that = this; this.context.getAndDecodePendingSpaceRequests().thenApply(reqs => { that.admindata.pending = reqs.toArray([]); diff --git a/src/i18n/en-GB.js b/src/i18n/en-GB.js index 48eb13aa..43c217e8 100644 --- a/src/i18n/en-GB.js +++ b/src/i18n/en-GB.js @@ -137,4 +137,19 @@ module.exports = { "SEARCH.VIDEO":"Video", "SEARCH.RESULTS":"Results", "SEARCH.DIR":"Directory", + "SETTINGS.ADMIN":"Admin Panel", + "SETTINGS.ACCOUNT":"Account", + "SETTINGS.PROFILE":"Profile", + "SETTINGS.FEEDBACK":"Feedback", + "SETTINGS.TOUR":"Tour", + "SETTINGS.HELP":"Help/FAQ", + "SETTINGS.AUTH":"Authentication", + "SETTINGS.PASS":"Change Password", + "SETTINGS.CLEANUP":"Cleanup Failed Uploads", + "SETTINGS.CACHE":"Set Cache Size", + "SETTINGS.DELETE":"Delete Account", + "SETTINGS.LOGOUT":"Log out", + "SETTINGS.CACHE.INVALID":"Cache size value not valid", + "SETTINGS.CACHE.LARGE":"Invalid Cache size. Maximum Cache Size: $SIZE MiB", + "SETTINGS.CACHE.UPDATED":"Cache Size Updated", }