From 646487610ff307129974beba974eda4a2ebfd724 Mon Sep 17 00:00:00 2001 From: Kitteh Date: Tue, 20 Apr 2021 22:49:33 +0100 Subject: [PATCH] Add key value secret page translations. --- src/main.js | 8 +++--- src/pages/KeyValue/KeyValueDelete.js | 2 +- .../{KeyValueSecrets.js => KeyValueSecret.js} | 13 +++++----- src/pages/KeyValue/KeyValueSecretsEdit.js | 6 ++--- src/pages/KeyValue/KeyValueVersions.js | 4 +-- src/pages/KeyValue/KeyValueView.js | 2 +- src/pages/index.js | 4 +-- src/translations/en.js | 25 ++++++++++++++++--- 8 files changed, 41 insertions(+), 23 deletions(-) rename src/pages/KeyValue/{KeyValueSecrets.js => KeyValueSecret.js} (93%) diff --git a/src/main.js b/src/main.js index 2f2f206..35b46a7 100644 --- a/src/main.js +++ b/src/main.js @@ -34,11 +34,11 @@ import { TransitEncryptPage, TransitDecryptPage, KeyValueViewPage, - KeyValueSecretsPage, + KeyValueSecretPage, KeyValueVersionsPage, KeyValueNewPage, KeyValueDeletePage, - KeyValueSecretsEditPage, + KeyValueSecretEditPage, PwGenPage, SetLanguagePage, } from "./pages"; @@ -57,11 +57,11 @@ const pages = { TRANSIT_ENCRYPT: new TransitEncryptPage(), TRANSIT_DECRYPT: new TransitDecryptPage(), KEY_VALUE_VIEW: new KeyValueViewPage(), - KEY_VALUE_SECRETS: new KeyValueSecretsPage(), + KEY_VALUE_SECRET: new KeyValueSecretPage(), KEY_VALUE_VERSIONS: new KeyValueVersionsPage(), KEY_VALUE_NEW_SECRET: new KeyValueNewPage(), KEY_VALUE_DELETE: new KeyValueDeletePage(), - KEY_VALUE_SECRETS_EDIT: new KeyValueSecretsEditPage(), + KEY_VALUE_SECRET_EDIT: new KeyValueSecretEditPage(), PW_GEN: new PwGenPage(), }; diff --git a/src/pages/KeyValue/KeyValueDelete.js b/src/pages/KeyValue/KeyValueDelete.js index 6dd16b1..6302ef6 100644 --- a/src/pages/KeyValue/KeyValueDelete.js +++ b/src/pages/KeyValue/KeyValueDelete.js @@ -11,7 +11,7 @@ export class KeyValueDeletePage extends Page { goBack() { if (pageState.currentSecretVersion != "0") { pageState.currentSecretVersion = "0"; - changePage("KEY_VALUE_SECRETS"); + changePage("KEY_VALUE_SECRET"); } else { pageState.currentSecret = ""; changePage("KEY_VALUE_VIEW"); diff --git a/src/pages/KeyValue/KeyValueSecrets.js b/src/pages/KeyValue/KeyValueSecret.js similarity index 93% rename from src/pages/KeyValue/KeyValueSecrets.js rename to src/pages/KeyValue/KeyValueSecret.js index ef7eaf5..d8a88c7 100644 --- a/src/pages/KeyValue/KeyValueSecrets.js +++ b/src/pages/KeyValue/KeyValueSecret.js @@ -4,9 +4,10 @@ import { setPageContent, setTitleElement, changePage } from "../../pageUtils.js" import { CopyableInputBox } from "../../elements/CopyableInputBox.js"; import { makeElement } from "../../htmlUtils.js"; import Prism from "prismjs"; +import i18next from 'i18next'; -export class KeyValueSecretsPage extends Page { +export class KeyValueSecretPage extends Page { constructor() { super(); } @@ -32,7 +33,7 @@ export class KeyValueSecretsPage extends Page { }), makeElement({ tag: "p", - text: "Loading..", + text: i18next.t("kv_secret_loading"), id: "loadingText" }), makeElement({ @@ -67,7 +68,7 @@ export class KeyValueSecretsPage extends Page { tag: "button", id: "editButton", class: ["uk-button", "uk-margin", "uk-button-primary"], - onclick: _ => { changePage("KEY_VALUE_SECRETS_EDIT"); }, + onclick: _ => { changePage("KEY_VALUE_SECRET_EDIT"); }, text: "Edit" })); } @@ -94,12 +95,12 @@ export class KeyValueSecretsPage extends Page { kvList.appendChild(makeElement({ tag: "p", - text: "This secret version has been soft deleted but remains restorable, do you want to restore it?" + text: i18next.t("kv_secret_deleted_text") })); kvList.appendChild(makeElement({ tag: "button", - text: "Restore Secret Version", + text: i18next.t("kv_secret_restore_btn"), id: "restoreButton", class: ["uk-button", "uk-button-primary"], onclick: () => { @@ -147,6 +148,6 @@ export class KeyValueSecretsPage extends Page { } get name() { - return "K/V Secret"; + return i18next.t("kv_secret_title"); } } \ No newline at end of file diff --git a/src/pages/KeyValue/KeyValueSecretsEdit.js b/src/pages/KeyValue/KeyValueSecretsEdit.js index 9af2928..26938a3 100644 --- a/src/pages/KeyValue/KeyValueSecretsEdit.js +++ b/src/pages/KeyValue/KeyValueSecretsEdit.js @@ -5,12 +5,12 @@ import { setPageContent, setTitleElement, setErrorText, changePage } from "../.. import { makeElement } from "../../htmlUtils.js"; import { CodeJar } from "codejar"; -export class KeyValueSecretsEditPage extends Page { +export class KeyValueSecretEditPage extends Page { constructor() { super(); } goBack() { - changePage("KEY_VALUE_SECRETS"); + changePage("KEY_VALUE_SECRET"); } render() { setTitleElement(pageState); @@ -55,7 +55,7 @@ export class KeyValueSecretsEditPage extends Page { pageState.currentSecret, JSON.parse(jar.toString()) ).then(_ => { - changePage("KEY_VALUE_SECRETS"); + changePage("KEY_VALUE_SECRET"); return; }).catch(e => { setErrorText(e.message); diff --git a/src/pages/KeyValue/KeyValueVersions.js b/src/pages/KeyValue/KeyValueVersions.js index 7986b29..5d4a11a 100644 --- a/src/pages/KeyValue/KeyValueVersions.js +++ b/src/pages/KeyValue/KeyValueVersions.js @@ -8,7 +8,7 @@ export class KeyValueVersionsPage extends Page { super(); } goBack() { - changePage("KEY_VALUE_SECRETS"); + changePage("KEY_VALUE_SECRET"); } async render() { setTitleElement(pageState); @@ -34,7 +34,7 @@ export class KeyValueVersionsPage extends Page { text: `v${ver}`, onclick: _ => { pageState.currentSecretVersion = ver; - changePage("KEY_VALUE_SECRETS"); + changePage("KEY_VALUE_SECRET"); } }) })); diff --git a/src/pages/KeyValue/KeyValueView.js b/src/pages/KeyValue/KeyValueView.js index 6918615..cb63658 100644 --- a/src/pages/KeyValue/KeyValueView.js +++ b/src/pages/KeyValue/KeyValueView.js @@ -56,7 +56,7 @@ export class KeyValueViewPage extends Page { changePage("KEY_VALUE_VIEW"); } else { pageState.currentSecret = secret; - changePage("KEY_VALUE_SECRETS"); + changePage("KEY_VALUE_SECRET"); } } }) diff --git a/src/pages/index.js b/src/pages/index.js index 3b64bd7..68aaa11 100644 --- a/src/pages/index.js +++ b/src/pages/index.js @@ -8,11 +8,11 @@ export { SetLanguagePage } from "./SetLanguage.js"; export { TOTPViewPage } from "./TOTP/TOTPView.js"; export { NewTOTPPage } from "./TOTP/NewTOTP.js"; export { KeyValueViewPage } from "./KeyValue/KeyValueView.js"; -export { KeyValueSecretsPage } from "./KeyValue/KeyValueSecrets.js"; +export { KeyValueSecretPage } from "./KeyValue/KeyValueSecrets.js"; export { KeyValueVersionsPage } from "./KeyValue/KeyValueVersions.js"; export { KeyValueNewPage } from "./KeyValue/KeyValueNew.js"; export { KeyValueDeletePage } from "./KeyValue/KeyValueDelete.js"; -export { KeyValueSecretsEditPage } from "./KeyValue/KeyValueSecretsEdit.js"; +export { KeyValueSecretEditPage } from "./KeyValue/KeyValueSecretsEdit.js"; export { TransitViewPage } from "./Transit/TransitView.js"; export { TransitViewSecretPage } from "./Transit/TransitViewSecret.js"; export { TransitEncryptPage } from "./Transit/TransitEncrypt.js"; diff --git a/src/translations/en.js b/src/translations/en.js index 814c754..ea2b564 100644 --- a/src/translations/en.js +++ b/src/translations/en.js @@ -7,31 +7,37 @@ module.exports = { "back_btn": "Back", "refresh_btn": "Refresh", "me_btn": "Me/Settings", + // These are the page titles - "me_page_title": "Me/Settings", "home_page_title": "Home", - // These are all o the other translations + // Me Page + "me_page_title": "Me/Settings", "log_out_btn": "Log Out", "copy_token_btn": "Copy Token", "renew_lease_btn": "Renew Token Lease", + "change_language_btn": "Change Language", + // Home Page "vaulturl_text": "Vault URL: {{text}}", "password_generator_btn": "Password Generator", - "change_language_btn": "Change Language", "your_token_expires_in": "Your token expires in {{date, until_date}}", + // Unseal Page "unseal_vault_text": "Unseal the Vault", "submit_key_btn": "Submit Key", "key_input_placeholder": "Key", "unseal_keys_progress": "Keys: {{progress}}/{{keys_needed}}", + // Language Selector Page "set_language_title": "Set Language", "set_language_btn": "Set Language", + // Password Generator Page "password_generator_title": "Password Generator", "gen_password_btn": "Generate Password", + // Login Page "log_in_title": "Login", "log_in_with_token": "Token", "log_in_with_username": "Username", @@ -40,13 +46,24 @@ module.exports = { "password_input": "Password", "log_in_btn": "Login", + // Key Value Delete Page "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)", + // Key Value New Page "kv_new_title": "K/V New", "kv_new_suffix": " (new)", "kv_new_path": "Relative Path", - "kv_new_create_btn": "Create Empty Secret" + "kv_new_create_btn": "Create Empty Secret", + + // Key Value Secret Page + "kv_secret_title": "K/V Secret", + "kv_secret_deleted_text": "This secret version has been soft deleted but remains restorable, do you want to restore it?", + "kv_secret_restore_btn": "Restore Secret Version", + "kv_secret_loading": "Loading Secret..", + "kv_secret_delete_btn": "" + + } \ No newline at end of file