1
0
Fork 0

Add translations to KeyValueSecretsEdit and fix build.

This commit is contained in:
Kitteh 2021-04-20 23:02:18 +01:00
parent 748036d98a
commit 368feeb76b
3 changed files with 18 additions and 7 deletions

View file

@ -4,6 +4,8 @@ import { verifyJSONString } from "../../utils.js";
import { setPageContent, setTitleElement, setErrorText, changePage } from "../../pageUtils.js";
import { makeElement } from "../../htmlUtils.js";
import { CodeJar } from "codejar";
import i18next from 'i18next';
export class KeyValueSecretEditPage extends Page {
constructor() {
@ -14,7 +16,10 @@ export class KeyValueSecretEditPage extends Page {
}
render() {
setTitleElement(pageState);
let loadingText = makeElement({ tag: "p", text: "Loading.." });
let loadingText = makeElement({
tag: "p",
text: i18next.t("kv_sec_edit_loading")
});
let editor = makeElement({
tag: "div",
class: ["editor", "language-json"]
@ -22,7 +27,7 @@ export class KeyValueSecretEditPage extends Page {
let saveButton = makeElement({
tag: "button",
class: ["uk-button", "uk-button-primary"],
text: "Save"
text: i18next.t("kv_sec_edit_btn")
});
setPageContent(makeElement({
tag: "div",
@ -46,7 +51,7 @@ export class KeyValueSecretEditPage extends Page {
jar.updateCode(secretsJSON);
saveButton.onclick = function () {
if (!verifyJSONString(jar.toString())) {
setErrorText("Invalid JSON");
setErrorText(i18next.t("kv_sec_edit_invalid_json_err"));
return;
}
createOrUpdateSecret(
@ -65,10 +70,10 @@ export class KeyValueSecretEditPage extends Page {
}
get titleSuffix() {
return " (edit)";
return i18next.t("kv_sec_edit_suffix");
}
get name() {
return "K/V Secrets Edit";
return i18next.t("kv_sec_edit_title");
}
}

View file

@ -8,7 +8,7 @@ export { SetLanguagePage } from "./SetLanguage.js";
export { TOTPViewPage } from "./TOTP/TOTPView.js";
export { NewTOTPPage } from "./TOTP/NewTOTP.js";
export { KeyValueViewPage } from "./KeyValue/KeyValueView.js";
export { KeyValueSecretPage } from "./KeyValue/KeyValueSecrets.js";
export { KeyValueSecretPage } from "./KeyValue/KeyValueSecret.js";
export { KeyValueVersionsPage } from "./KeyValue/KeyValueVersions.js";
export { KeyValueNewPage } from "./KeyValue/KeyValueNew.js";
export { KeyValueDeletePage } from "./KeyValue/KeyValueDelete.js";

View file

@ -67,7 +67,13 @@ module.exports = {
"kv_secret_delete_all_btn": "Delete All Versions",
"kv_secret_delete_version_btn": "Delete Version {{ version }}",
"kv_secret_edit_btn": "Edit",
"kv_secret_versions_btn": "Versions"
"kv_secret_versions_btn": "Versions",
// Key Value Secret Editor Page
"kv_sec_edit_title": "K/V Edit",
"kv_sec_edit_btn": "Edit",
"kv_sec_edit_loading": "Loading Editor..",
"kv_sec_edit_invalid_json_err": "Invalid JSON",
"kv_sec_edit_suffix": " (edit)",
}