1
0
Fork 0

Add translations on KeyValueDelete and rename titlePrefix to titleSuffix.

This commit is contained in:
Kitteh 2021-04-20 20:32:57 +01:00
parent cc61c26264
commit 93fcb693b5
10 changed files with 20 additions and 14 deletions

View file

@ -48,7 +48,7 @@ export function setPageTitle(title) {
function currentTitleSecretText() { function currentTitleSecretText() {
let currentSecretText = pageState.currentSecret; let currentSecretText = pageState.currentSecret;
currentSecretText += pageState.currentPage.titlePrefix; currentSecretText += pageState.currentPage.titleSuffix;
if (pageState.currentSecretVersion != "0") currentSecretText += ` (v${pageState.currentSecretVersion})`; if (pageState.currentSecretVersion != "0") currentSecretText += ` (v${pageState.currentSecretVersion})`;
return currentSecretText; return currentSecretText;

View file

@ -2,6 +2,7 @@ import { Page } from "../../types/Page.js";
import { deleteSecret } from "../../api.js"; import { deleteSecret } from "../../api.js";
import { setPageContent, setTitleElement, changePage } from "../../pageUtils.js"; import { setPageContent, setTitleElement, changePage } from "../../pageUtils.js";
import { makeElement } from "../../htmlUtils.js"; import { makeElement } from "../../htmlUtils.js";
import i18next from 'i18next';
export class KeyValueDeletePage extends Page { export class KeyValueDeletePage extends Page {
constructor() { constructor() {
@ -23,12 +24,12 @@ export class KeyValueDeletePage extends Page {
children: [ children: [
makeElement({ makeElement({
tag: "h5", tag: "h5",
text: "Are you sure you want to delete this?" text: i18next.t("kv_delete_text")
}), }),
makeElement({ makeElement({
tag: "button", tag: "button",
class: ["uk-button", "uk-button-danger"], class: ["uk-button", "uk-button-danger"],
text: "Delete", text: i18next.t("kv_delete_btn"),
onclick: _ => { onclick: _ => {
deleteSecret(pageState.currentBaseMount, pageState.currentSecretPath, pageState.currentSecret, pageState.currentSecretVersion).then(() => { deleteSecret(pageState.currentBaseMount, pageState.currentSecretPath, pageState.currentSecret, pageState.currentSecretVersion).then(() => {
this.goBack(); this.goBack();
@ -38,10 +39,10 @@ export class KeyValueDeletePage extends Page {
] ]
})); }));
} }
get titlePrefix() { get titleSuffix() {
return " (delete)"; return i18next.t("kv_delete_suffix");
} }
get name() { get name() {
return "K/V Delete"; return i18next.t("kv_delete_title");
} }
} }

View file

@ -76,7 +76,7 @@ export class KeyValueNewPage extends Page {
}); });
} }
get titlePrefix() { get titleSuffix() {
return " (new)"; return " (new)";
} }

View file

@ -64,7 +64,7 @@ export class KeyValueSecretsEditPage extends Page {
}); });
} }
get titlePrefix() { get titleSuffix() {
return " (edit)"; return " (edit)";
} }

View file

@ -41,7 +41,7 @@ export class KeyValueVersionsPage extends Page {
}); });
} }
get titlePrefix() { get titleSuffix() {
return " (versions)"; return " (versions)";
} }

View file

@ -85,7 +85,7 @@ export class NewTOTPPage extends Page {
}); });
} }
get titlePrefix() { get titleSuffix() {
return " (new)"; return " (new)";
} }

View file

@ -86,7 +86,7 @@ export class TransitDecryptPage extends Page {
}); });
} }
get titlePrefix() { get titleSuffix() {
return " (decrypt)"; return " (decrypt)";
} }

View file

@ -85,7 +85,7 @@ export class TransitEncryptPage extends Page {
}); });
} }
get titlePrefix() { get titleSuffix() {
return " (encrypt)"; return " (encrypt)";
} }

View file

@ -38,7 +38,12 @@ module.exports = {
"token_input": "Token", "token_input": "Token",
"username_input": "Username", "username_input": "Username",
"password_input": "Password", "password_input": "Password",
"log_in_btn": "Login" "log_in_btn": "Login",
"kv_delete_title": "K/V Delete",
"kv_delete_text": "Are you sure you want to delete this?",
"kv_delete_btn": "Delete",
"kv_delete_suffix": " (delete)",
} }

View file

@ -7,7 +7,7 @@ export class Page {
get name() { get name() {
return "Page"; return "Page";
} }
get titlePrefix() { get titleSuffix() {
return ""; return "";
} }
goBack() { goBack() {