From 19a305d8677df0500ea43cfe7e3285056258f57b Mon Sep 17 00:00:00 2001 From: Kitteh Date: Tue, 20 Apr 2021 23:16:36 +0100 Subject: [PATCH] Add TOTPView page translations --- src/pages/TOTP/TOTPView.js | 11 ++++++----- src/translations/en.js | 7 +++++++ 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/pages/TOTP/TOTPView.js b/src/pages/TOTP/TOTPView.js index 8a2a2b8..eb593b9 100644 --- a/src/pages/TOTP/TOTPView.js +++ b/src/pages/TOTP/TOTPView.js @@ -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"); } } \ No newline at end of file diff --git a/src/translations/en.js b/src/translations/en.js index e84ce3d..76ce256 100644 --- a/src/translations/en.js +++ b/src/translations/en.js @@ -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..", + } \ No newline at end of file