Add TOTPView page translations
This commit is contained in:
parent
67465967ab
commit
19a305d867
|
@ -3,6 +3,7 @@ import { getTOTPKeys, getTOTPCode, DoesNotExistError } from "../../api.js";
|
||||||
import { setTitleElement, setPageContent, changePage, setErrorText } from "../../pageUtils.js";
|
import { setTitleElement, setPageContent, changePage, setErrorText } 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 i18next from 'i18next';
|
||||||
|
|
||||||
export class TOTPViewPage extends Page {
|
export class TOTPViewPage extends Page {
|
||||||
constructor() {
|
constructor() {
|
||||||
|
@ -17,13 +18,13 @@ export class TOTPViewPage extends Page {
|
||||||
children: [
|
children: [
|
||||||
makeElement({
|
makeElement({
|
||||||
tag: "a",
|
tag: "a",
|
||||||
text: "Add new TOTP",
|
text: i18next.t("totp_view_new_btn"),
|
||||||
onclick: _ => { changePage("NEW_TOTP"); }
|
onclick: _ => { changePage("NEW_TOTP"); }
|
||||||
}),
|
}),
|
||||||
makeElement({
|
makeElement({
|
||||||
tag: "p",
|
tag: "p",
|
||||||
id: "loadingText",
|
id: "loadingText",
|
||||||
text: "Loading TOTP Codes..",
|
text: i18next.t("totp_view_loading"),
|
||||||
}),
|
}),
|
||||||
makeElement({ tag: "br" }),
|
makeElement({ tag: "br" }),
|
||||||
makeElement({ tag: "br" }),
|
makeElement({ tag: "br" }),
|
||||||
|
@ -46,7 +47,7 @@ export class TOTPViewPage extends Page {
|
||||||
}).catch(e => {
|
}).catch(e => {
|
||||||
if (e == DoesNotExistError) {
|
if (e == DoesNotExistError) {
|
||||||
let loadingText = document.getElementById("loadingText");
|
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 {
|
} else {
|
||||||
setErrorText(e.message);
|
setErrorText(e.message);
|
||||||
}
|
}
|
||||||
|
@ -60,7 +61,7 @@ export class TOTPViewPage extends Page {
|
||||||
|
|
||||||
makeTOTPListElement(totpKeyName) {
|
makeTOTPListElement(totpKeyName) {
|
||||||
let totpKeyBox = CopyableInputBox(totpKeyName, false);
|
let totpKeyBox = CopyableInputBox(totpKeyName, false);
|
||||||
let totpValueBox = CopyableInputBox("Loading..");
|
let totpValueBox = CopyableInputBox(i18next.t("totp_view_loading_box"));
|
||||||
|
|
||||||
let gridElement = makeElement({
|
let gridElement = makeElement({
|
||||||
tag: "div",
|
tag: "div",
|
||||||
|
@ -73,6 +74,6 @@ export class TOTPViewPage extends Page {
|
||||||
return gridElement;
|
return gridElement;
|
||||||
}
|
}
|
||||||
get name() {
|
get name() {
|
||||||
return "TOTP";
|
return i18next.t("totp_view_title");
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -86,6 +86,13 @@ module.exports = {
|
||||||
"kv_view_new_btn": "New",
|
"kv_view_new_btn": "New",
|
||||||
"kv_view_none_here_text": "You seem to have no secrets here, would you like to create one?",
|
"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..",
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in a new issue