Skip to content

Commit

Permalink
user menu i18n
Browse files Browse the repository at this point in the history
  • Loading branch information
ianopolous committed Feb 20, 2024
1 parent cd1771e commit 39c4d8b
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 17 deletions.
36 changes: 19 additions & 17 deletions src/components/UserSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,59 +34,59 @@
v-on:keyup.enter="showAdminPanel()"
@click="showAdminPanel()"
>
Admin Panel
{{ translate("SETTINGS.ADMIN") }}
</li>
<li
v-on:keyup.enter="showRequestStorage()"
@click="showRequestStorage()"
>
Account
{{ translate("SETTINGS.ACCOUNT") }}
</li>
<li class="divider"></li>
<li v-on:keyup.enter="showProfile()" @click="showProfile()">
Profile
{{ translate("SETTINGS.PROFILE") }}
</li>
<li v-on:keyup.enter="showFeedback()" @click="showFeedback()">
Feedback
{{ translate("SETTINGS.FEEDBACK") }}
</li>
<li v-on:keyup.enter="showTour()" @click="showTour()">
Tour
{{ translate("SETTINGS.TOUR") }}
</li>
<li v-on:keyup.enter="launchHelp()" @click="launchHelp()">
Help/FAQ
{{ translate("SETTINGS.HELP") }}
</li>
<li
v-on:keyup.enter="showAuthenticationScreen()"
@click="showAuthenticationScreen()"
>
Authentication
{{ translate("SETTINGS.AUTH") }}
</li>
<li
v-on:keyup.enter="showChangePassword()"
@click="showChangePassword()"
>
Change Password
{{ translate("SETTINGS.PASS") }}
</li>
<li
v-on:keyup.enter="cleanupFailedUploads()"
@click="cleanupFailedUploads()"
>
Cleanup Failed Uploads
{{ translate("SETTINGS.CLEANUP") }}
</li>
<li
v-on:keyup.enter="modifyCacheSize()"
@click="modifyCacheSize()"
>
Set Cache size
{{ translate("SETTINGS.CACHE") }}
</li>
<li
v-on:keyup.enter="showViewAccount()"
@click="showViewAccount()"
>
Delete Account
{{ translate("SETTINGS.DELETE") }}
</li>
<li class="divider"></li>
<li v-on:keyup.enter="logout()" @click="logout()">Log out</li>
<li v-on:keyup.enter="logout()" @click="logout()">{{ translate("SETTINGS.LOGOUT") }}</li>
</ul>
</AppDropdown>

Expand Down Expand Up @@ -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: {
Expand All @@ -135,6 +136,7 @@ module.exports = {
Spinner,
AppIcon,
},
mixins:[i18n],
data() {
return {
profileImage: "",
Expand Down Expand Up @@ -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 = " ";
Expand All @@ -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"));
});
}
}
Expand Down Expand Up @@ -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([]);
Expand Down
15 changes: 15 additions & 0 deletions src/i18n/en-GB.js
Original file line number Diff line number Diff line change
Expand Up @@ -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",
}

0 comments on commit 39c4d8b

Please sign in to comment.