1
0
Fork 0

Add TOTPView page translations

This commit is contained in:
Kitteh 2021-04-20 23:16:36 +01:00
parent 67465967ab
commit 19a305d867
2 changed files with 13 additions and 5 deletions

View file

@ -3,6 +3,7 @@ import { getTOTPKeys, getTOTPCode, DoesNotExistError } from "../../api.js";
import { setTitleElement, setPageContent, changePage, setErrorText } from "../../pageUtils.js";
import { CopyableInputBox } from "../../elements/CopyableInputBox.js";
import { makeElement } from "../../htmlUtils.js";
import i18next from 'i18next';
export class TOTPViewPage extends Page {
constructor() {
@ -17,13 +18,13 @@ export class TOTPViewPage extends Page {
children: [
makeElement({
tag: "a",
text: "Add new TOTP",
text: i18next.t("totp_view_new_btn"),
onclick: _ => { changePage("NEW_TOTP"); }
}),
makeElement({
tag: "p",
id: "loadingText",
text: "Loading TOTP Codes..",
text: i18next.t("totp_view_loading"),
}),
makeElement({ tag: "br" }),
makeElement({ tag: "br" }),
@ -46,7 +47,7 @@ export class TOTPViewPage extends Page {
}).catch(e => {
if (e == DoesNotExistError) {
let loadingText = document.getElementById("loadingText");
loadingText.innerText = "You seem to have no TOTP codes here, would you like to create one?";
loadingText.innerText = i18next.t("totp_view_empty");
} else {
setErrorText(e.message);
}
@ -60,7 +61,7 @@ export class TOTPViewPage extends Page {
makeTOTPListElement(totpKeyName) {
let totpKeyBox = CopyableInputBox(totpKeyName, false);
let totpValueBox = CopyableInputBox("Loading..");
let totpValueBox = CopyableInputBox(i18next.t("totp_view_loading_box"));
let gridElement = makeElement({
tag: "div",
@ -73,6 +74,6 @@ export class TOTPViewPage extends Page {
return gridElement;
}
get name() {
return "TOTP";
return i18next.t("totp_view_title");
}
}

View file

@ -86,6 +86,13 @@ module.exports = {
"kv_view_new_btn": "New",
"kv_view_none_here_text": "You seem to have no secrets here, would you like to create one?",
// TOTP View Page
"totp_view_title": "TOTP",
"totp_view_new_btn": "Add new TOTP key",
"totp_view_loading": "Loading TOTP Codes..",
"totp_view_empty": "You seem to have no TOTP codes here, would you like to create one?",
"totp_view_loading_box": "Loading..",
}