From 93fcb693b5824c995afe9a296aa85de187bb856b Mon Sep 17 00:00:00 2001 From: Kitteh Date: Tue, 20 Apr 2021 20:32:57 +0100 Subject: [PATCH] Add translations on KeyValueDelete and rename titlePrefix to titleSuffix. --- src/pageUtils.js | 2 +- src/pages/KeyValue/KeyValueDelete.js | 11 ++++++----- src/pages/KeyValue/KeyValueNew.js | 2 +- src/pages/KeyValue/KeyValueSecretsEdit.js | 2 +- src/pages/KeyValue/KeyValueVersions.js | 2 +- src/pages/TOTP/NewTOTP.js | 2 +- src/pages/Transit/TransitDecrypt.js | 2 +- src/pages/Transit/TransitEncrypt.js | 2 +- src/translations/en.js | 7 ++++++- src/types/Page.js | 2 +- 10 files changed, 20 insertions(+), 14 deletions(-) diff --git a/src/pageUtils.js b/src/pageUtils.js index 342938d..8086a7a 100644 --- a/src/pageUtils.js +++ b/src/pageUtils.js @@ -48,7 +48,7 @@ export function setPageTitle(title) { function currentTitleSecretText() { let currentSecretText = pageState.currentSecret; - currentSecretText += pageState.currentPage.titlePrefix; + currentSecretText += pageState.currentPage.titleSuffix; if (pageState.currentSecretVersion != "0") currentSecretText += ` (v${pageState.currentSecretVersion})`; return currentSecretText; diff --git a/src/pages/KeyValue/KeyValueDelete.js b/src/pages/KeyValue/KeyValueDelete.js index 7f99c97..6dd16b1 100644 --- a/src/pages/KeyValue/KeyValueDelete.js +++ b/src/pages/KeyValue/KeyValueDelete.js @@ -2,6 +2,7 @@ import { Page } from "../../types/Page.js"; import { deleteSecret } from "../../api.js"; import { setPageContent, setTitleElement, changePage } from "../../pageUtils.js"; import { makeElement } from "../../htmlUtils.js"; +import i18next from 'i18next'; export class KeyValueDeletePage extends Page { constructor() { @@ -23,12 +24,12 @@ export class KeyValueDeletePage extends Page { children: [ makeElement({ tag: "h5", - text: "Are you sure you want to delete this?" + text: i18next.t("kv_delete_text") }), makeElement({ tag: "button", class: ["uk-button", "uk-button-danger"], - text: "Delete", + text: i18next.t("kv_delete_btn"), onclick: _ => { deleteSecret(pageState.currentBaseMount, pageState.currentSecretPath, pageState.currentSecret, pageState.currentSecretVersion).then(() => { this.goBack(); @@ -38,10 +39,10 @@ export class KeyValueDeletePage extends Page { ] })); } - get titlePrefix() { - return " (delete)"; + get titleSuffix() { + return i18next.t("kv_delete_suffix"); } get name() { - return "K/V Delete"; + return i18next.t("kv_delete_title"); } } \ No newline at end of file diff --git a/src/pages/KeyValue/KeyValueNew.js b/src/pages/KeyValue/KeyValueNew.js index d2cc668..9b355d7 100644 --- a/src/pages/KeyValue/KeyValueNew.js +++ b/src/pages/KeyValue/KeyValueNew.js @@ -76,7 +76,7 @@ export class KeyValueNewPage extends Page { }); } - get titlePrefix() { + get titleSuffix() { return " (new)"; } diff --git a/src/pages/KeyValue/KeyValueSecretsEdit.js b/src/pages/KeyValue/KeyValueSecretsEdit.js index 62de13d..9af2928 100644 --- a/src/pages/KeyValue/KeyValueSecretsEdit.js +++ b/src/pages/KeyValue/KeyValueSecretsEdit.js @@ -64,7 +64,7 @@ export class KeyValueSecretsEditPage extends Page { }); } - get titlePrefix() { + get titleSuffix() { return " (edit)"; } diff --git a/src/pages/KeyValue/KeyValueVersions.js b/src/pages/KeyValue/KeyValueVersions.js index ad11511..7986b29 100644 --- a/src/pages/KeyValue/KeyValueVersions.js +++ b/src/pages/KeyValue/KeyValueVersions.js @@ -41,7 +41,7 @@ export class KeyValueVersionsPage extends Page { }); } - get titlePrefix() { + get titleSuffix() { return " (versions)"; } diff --git a/src/pages/TOTP/NewTOTP.js b/src/pages/TOTP/NewTOTP.js index e4a9b19..9f93a52 100644 --- a/src/pages/TOTP/NewTOTP.js +++ b/src/pages/TOTP/NewTOTP.js @@ -85,7 +85,7 @@ export class NewTOTPPage extends Page { }); } - get titlePrefix() { + get titleSuffix() { return " (new)"; } diff --git a/src/pages/Transit/TransitDecrypt.js b/src/pages/Transit/TransitDecrypt.js index f373c59..afbaca3 100644 --- a/src/pages/Transit/TransitDecrypt.js +++ b/src/pages/Transit/TransitDecrypt.js @@ -86,7 +86,7 @@ export class TransitDecryptPage extends Page { }); } - get titlePrefix() { + get titleSuffix() { return " (decrypt)"; } diff --git a/src/pages/Transit/TransitEncrypt.js b/src/pages/Transit/TransitEncrypt.js index 66d06a0..fd84233 100644 --- a/src/pages/Transit/TransitEncrypt.js +++ b/src/pages/Transit/TransitEncrypt.js @@ -85,7 +85,7 @@ export class TransitEncryptPage extends Page { }); } - get titlePrefix() { + get titleSuffix() { return " (encrypt)"; } diff --git a/src/translations/en.js b/src/translations/en.js index c5c181b..e38c637 100644 --- a/src/translations/en.js +++ b/src/translations/en.js @@ -38,7 +38,12 @@ module.exports = { "token_input": "Token", "username_input": "Username", "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)", } \ No newline at end of file diff --git a/src/types/Page.js b/src/types/Page.js index 89228b2..9030029 100644 --- a/src/types/Page.js +++ b/src/types/Page.js @@ -7,7 +7,7 @@ export class Page { get name() { return "Page"; } - get titlePrefix() { + get titleSuffix() { return ""; } goBack() {