1
0
Fork 0

Add key value secret page translations.

This commit is contained in:
Kitteh 2021-04-20 22:49:33 +01:00
parent 7d677b6b19
commit 646487610f
8 changed files with 41 additions and 23 deletions

View file

@ -34,11 +34,11 @@ import {
TransitEncryptPage, TransitEncryptPage,
TransitDecryptPage, TransitDecryptPage,
KeyValueViewPage, KeyValueViewPage,
KeyValueSecretsPage, KeyValueSecretPage,
KeyValueVersionsPage, KeyValueVersionsPage,
KeyValueNewPage, KeyValueNewPage,
KeyValueDeletePage, KeyValueDeletePage,
KeyValueSecretsEditPage, KeyValueSecretEditPage,
PwGenPage, PwGenPage,
SetLanguagePage, SetLanguagePage,
} from "./pages"; } from "./pages";
@ -57,11 +57,11 @@ const pages = {
TRANSIT_ENCRYPT: new TransitEncryptPage(), TRANSIT_ENCRYPT: new TransitEncryptPage(),
TRANSIT_DECRYPT: new TransitDecryptPage(), TRANSIT_DECRYPT: new TransitDecryptPage(),
KEY_VALUE_VIEW: new KeyValueViewPage(), KEY_VALUE_VIEW: new KeyValueViewPage(),
KEY_VALUE_SECRETS: new KeyValueSecretsPage(), KEY_VALUE_SECRET: new KeyValueSecretPage(),
KEY_VALUE_VERSIONS: new KeyValueVersionsPage(), KEY_VALUE_VERSIONS: new KeyValueVersionsPage(),
KEY_VALUE_NEW_SECRET: new KeyValueNewPage(), KEY_VALUE_NEW_SECRET: new KeyValueNewPage(),
KEY_VALUE_DELETE: new KeyValueDeletePage(), KEY_VALUE_DELETE: new KeyValueDeletePage(),
KEY_VALUE_SECRETS_EDIT: new KeyValueSecretsEditPage(), KEY_VALUE_SECRET_EDIT: new KeyValueSecretEditPage(),
PW_GEN: new PwGenPage(), PW_GEN: new PwGenPage(),
}; };

View file

@ -11,7 +11,7 @@ export class KeyValueDeletePage extends Page {
goBack() { goBack() {
if (pageState.currentSecretVersion != "0") { if (pageState.currentSecretVersion != "0") {
pageState.currentSecretVersion = "0"; pageState.currentSecretVersion = "0";
changePage("KEY_VALUE_SECRETS"); changePage("KEY_VALUE_SECRET");
} else { } else {
pageState.currentSecret = ""; pageState.currentSecret = "";
changePage("KEY_VALUE_VIEW"); changePage("KEY_VALUE_VIEW");

View file

@ -4,9 +4,10 @@ import { setPageContent, setTitleElement, changePage } from "../../pageUtils.js"
import { CopyableInputBox } from "../../elements/CopyableInputBox.js"; import { CopyableInputBox } from "../../elements/CopyableInputBox.js";
import { makeElement } from "../../htmlUtils.js"; import { makeElement } from "../../htmlUtils.js";
import Prism from "prismjs"; import Prism from "prismjs";
import i18next from 'i18next';
export class KeyValueSecretsPage extends Page { export class KeyValueSecretPage extends Page {
constructor() { constructor() {
super(); super();
} }
@ -32,7 +33,7 @@ export class KeyValueSecretsPage extends Page {
}), }),
makeElement({ makeElement({
tag: "p", tag: "p",
text: "Loading..", text: i18next.t("kv_secret_loading"),
id: "loadingText" id: "loadingText"
}), }),
makeElement({ makeElement({
@ -67,7 +68,7 @@ export class KeyValueSecretsPage extends Page {
tag: "button", tag: "button",
id: "editButton", id: "editButton",
class: ["uk-button", "uk-margin", "uk-button-primary"], class: ["uk-button", "uk-margin", "uk-button-primary"],
onclick: _ => { changePage("KEY_VALUE_SECRETS_EDIT"); }, onclick: _ => { changePage("KEY_VALUE_SECRET_EDIT"); },
text: "Edit" text: "Edit"
})); }));
} }
@ -94,12 +95,12 @@ export class KeyValueSecretsPage extends Page {
kvList.appendChild(makeElement({ kvList.appendChild(makeElement({
tag: "p", 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({ kvList.appendChild(makeElement({
tag: "button", tag: "button",
text: "Restore Secret Version", text: i18next.t("kv_secret_restore_btn"),
id: "restoreButton", id: "restoreButton",
class: ["uk-button", "uk-button-primary"], class: ["uk-button", "uk-button-primary"],
onclick: () => { onclick: () => {
@ -147,6 +148,6 @@ export class KeyValueSecretsPage extends Page {
} }
get name() { get name() {
return "K/V Secret"; return i18next.t("kv_secret_title");
} }
} }

View file

@ -5,12 +5,12 @@ import { setPageContent, setTitleElement, setErrorText, changePage } from "../..
import { makeElement } from "../../htmlUtils.js"; import { makeElement } from "../../htmlUtils.js";
import { CodeJar } from "codejar"; import { CodeJar } from "codejar";
export class KeyValueSecretsEditPage extends Page { export class KeyValueSecretEditPage extends Page {
constructor() { constructor() {
super(); super();
} }
goBack() { goBack() {
changePage("KEY_VALUE_SECRETS"); changePage("KEY_VALUE_SECRET");
} }
render() { render() {
setTitleElement(pageState); setTitleElement(pageState);
@ -55,7 +55,7 @@ export class KeyValueSecretsEditPage extends Page {
pageState.currentSecret, pageState.currentSecret,
JSON.parse(jar.toString()) JSON.parse(jar.toString())
).then(_ => { ).then(_ => {
changePage("KEY_VALUE_SECRETS"); changePage("KEY_VALUE_SECRET");
return; return;
}).catch(e => { }).catch(e => {
setErrorText(e.message); setErrorText(e.message);

View file

@ -8,7 +8,7 @@ export class KeyValueVersionsPage extends Page {
super(); super();
} }
goBack() { goBack() {
changePage("KEY_VALUE_SECRETS"); changePage("KEY_VALUE_SECRET");
} }
async render() { async render() {
setTitleElement(pageState); setTitleElement(pageState);
@ -34,7 +34,7 @@ export class KeyValueVersionsPage extends Page {
text: `v${ver}`, text: `v${ver}`,
onclick: _ => { onclick: _ => {
pageState.currentSecretVersion = ver; pageState.currentSecretVersion = ver;
changePage("KEY_VALUE_SECRETS"); changePage("KEY_VALUE_SECRET");
} }
}) })
})); }));

View file

@ -56,7 +56,7 @@ export class KeyValueViewPage extends Page {
changePage("KEY_VALUE_VIEW"); changePage("KEY_VALUE_VIEW");
} else { } else {
pageState.currentSecret = secret; pageState.currentSecret = secret;
changePage("KEY_VALUE_SECRETS"); changePage("KEY_VALUE_SECRET");
} }
} }
}) })

View file

@ -8,11 +8,11 @@ export { SetLanguagePage } from "./SetLanguage.js";
export { TOTPViewPage } from "./TOTP/TOTPView.js"; export { TOTPViewPage } from "./TOTP/TOTPView.js";
export { NewTOTPPage } from "./TOTP/NewTOTP.js"; export { NewTOTPPage } from "./TOTP/NewTOTP.js";
export { KeyValueViewPage } from "./KeyValue/KeyValueView.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 { KeyValueVersionsPage } from "./KeyValue/KeyValueVersions.js";
export { KeyValueNewPage } from "./KeyValue/KeyValueNew.js"; export { KeyValueNewPage } from "./KeyValue/KeyValueNew.js";
export { KeyValueDeletePage } from "./KeyValue/KeyValueDelete.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 { TransitViewPage } from "./Transit/TransitView.js";
export { TransitViewSecretPage } from "./Transit/TransitViewSecret.js"; export { TransitViewSecretPage } from "./Transit/TransitViewSecret.js";
export { TransitEncryptPage } from "./Transit/TransitEncrypt.js"; export { TransitEncryptPage } from "./Transit/TransitEncrypt.js";

View file

@ -7,31 +7,37 @@ module.exports = {
"back_btn": "Back", "back_btn": "Back",
"refresh_btn": "Refresh", "refresh_btn": "Refresh",
"me_btn": "Me/Settings", "me_btn": "Me/Settings",
// These are the page titles // These are the page titles
"me_page_title": "Me/Settings",
"home_page_title": "Home", "home_page_title": "Home",
// These are all o the other translations // Me Page
"me_page_title": "Me/Settings",
"log_out_btn": "Log Out", "log_out_btn": "Log Out",
"copy_token_btn": "Copy Token", "copy_token_btn": "Copy Token",
"renew_lease_btn": "Renew Token Lease", "renew_lease_btn": "Renew Token Lease",
"change_language_btn": "Change Language",
// Home Page
"vaulturl_text": "Vault URL: {{text}}", "vaulturl_text": "Vault URL: {{text}}",
"password_generator_btn": "Password Generator", "password_generator_btn": "Password Generator",
"change_language_btn": "Change Language",
"your_token_expires_in": "Your token expires in {{date, until_date}}", "your_token_expires_in": "Your token expires in {{date, until_date}}",
// Unseal Page
"unseal_vault_text": "Unseal the Vault", "unseal_vault_text": "Unseal the Vault",
"submit_key_btn": "Submit Key", "submit_key_btn": "Submit Key",
"key_input_placeholder": "Key", "key_input_placeholder": "Key",
"unseal_keys_progress": "Keys: {{progress}}/{{keys_needed}}", "unseal_keys_progress": "Keys: {{progress}}/{{keys_needed}}",
// Language Selector Page
"set_language_title": "Set Language", "set_language_title": "Set Language",
"set_language_btn": "Set Language", "set_language_btn": "Set Language",
// Password Generator Page
"password_generator_title": "Password Generator", "password_generator_title": "Password Generator",
"gen_password_btn": "Generate Password", "gen_password_btn": "Generate Password",
// Login Page
"log_in_title": "Login", "log_in_title": "Login",
"log_in_with_token": "Token", "log_in_with_token": "Token",
"log_in_with_username": "Username", "log_in_with_username": "Username",
@ -40,13 +46,24 @@ module.exports = {
"password_input": "Password", "password_input": "Password",
"log_in_btn": "Login", "log_in_btn": "Login",
// Key Value Delete Page
"kv_delete_title": "K/V Delete", "kv_delete_title": "K/V Delete",
"kv_delete_text": "Are you sure you want to delete this?", "kv_delete_text": "Are you sure you want to delete this?",
"kv_delete_btn": "Delete", "kv_delete_btn": "Delete",
"kv_delete_suffix": " (delete)", "kv_delete_suffix": " (delete)",
// Key Value New Page
"kv_new_title": "K/V New", "kv_new_title": "K/V New",
"kv_new_suffix": " (new)", "kv_new_suffix": " (new)",
"kv_new_path": "Relative Path", "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": ""
} }