From 76d58d1850ac3a242c2df08c218953b847c3e2ce Mon Sep 17 00:00:00 2001 From: Kitteh Date: Thu, 29 Apr 2021 10:51:36 +0100 Subject: [PATCH] Add translations to TransitViewSecretPage. --- src/pages/Transit/TransitView.js | 5 +++-- src/pages/Transit/TransitViewSecret.js | 15 +++++++++------ src/translations/en.js | 13 +++++++++++++ 3 files changed, 25 insertions(+), 8 deletions(-) diff --git a/src/pages/Transit/TransitView.js b/src/pages/Transit/TransitView.js index c560704..99c5210 100644 --- a/src/pages/Transit/TransitView.js +++ b/src/pages/Transit/TransitView.js @@ -2,6 +2,7 @@ import { Page } from "../../types/Page.js"; import { DoesNotExistError, getTransitKeys } from "../../api.js"; import { setErrorText, setTitleElement, changePage } from "../../pageUtils.js"; import { makeElement } from "../../htmlUtils.js"; +import i18next from 'i18next'; export class TransitViewPage extends Page { constructor() { @@ -51,7 +52,7 @@ export class TransitViewPage extends Page { if (e == DoesNotExistError) { pageContent.appendChild(makeElement({ tag: "p", - text: "You seem to have no transit keys here, would you like to create one?" + text: i18next.t("transit_view_none_here_text") })); } else { setErrorText(e.message); @@ -60,6 +61,6 @@ export class TransitViewPage extends Page { } get name() { - return "Transit View"; + return i18next.t("transit_view_title"); } } diff --git a/src/pages/Transit/TransitViewSecret.js b/src/pages/Transit/TransitViewSecret.js index 1b1315a..49619e5 100644 --- a/src/pages/Transit/TransitViewSecret.js +++ b/src/pages/Transit/TransitViewSecret.js @@ -1,6 +1,7 @@ import { Page } from "../../types/Page.js"; import { changePage, setPageContent, setTitleElement } from "../../pageUtils.js"; import { makeElement } from "../../htmlUtils.js"; +import i18next from 'i18next'; export class TransitViewSecretPage extends Page { constructor() { @@ -10,7 +11,7 @@ export class TransitViewSecretPage extends Page { changePage("TRANSIT_VIEW"); } - makeTile(title, description, icon = "code", onclick = _ => { }) { + makeTile(title, description, icon, iconText, onclick = _ => { }) { return makeElement({ tag: "a", class: "uk-link-heading", @@ -54,15 +55,17 @@ export class TransitViewSecretPage extends Page { tag: "div", children: [ this.makeTile( - "Encrypt", - "Encrypt some plaintext or base64 encoded binary.", + i18next.t("transit_view_encrypt_text"), + i18next.t("transit_view_encrypt_description"), "lock", + i18next.t("transit_view_encrypt_icon_text"), _ => { changePage("TRANSIT_ENCRYPT"); } ), this.makeTile( - "Decrypt", - "Decrypt some cyphertext.", + i18next.t("transit_view_decrypt_text"), + i18next.t("transit_view_decrypt_description"), "mail", + i18next.t("transit_view_decrypt_icon_text"), _ => { changePage("TRANSIT_DECRYPT"); } ), ] @@ -72,6 +75,6 @@ export class TransitViewSecretPage extends Page { } get name() { - return "Transit Secret View"; + return i18next.t("transit_view_secret_title"); } } \ No newline at end of file diff --git a/src/translations/en.js b/src/translations/en.js index 063de93..df17b2c 100644 --- a/src/translations/en.js +++ b/src/translations/en.js @@ -111,5 +111,18 @@ module.exports = { "totp_new_key_input": "Key", "totp_new_add_btn": "Add TOTP Key", + // Transit View Page + "transit_view_title": "Transit View", + "transit_view_none_here_text": "You seem to have no transit keys here, would you like to create one?", + + // Transit View Secret Page + "transit_view_secret_title": "Transit Secret View", + "transit_view_encrypt_text": "Encrypt", + "transit_view_encrypt_icon_text": "Encryption Icon", + "transit_view_encrypt_description": "Encrypt some plaintext or base64 encoded binary.", + "transit_view_decrypt_text": "Decrypt", + "transit_view_decrypt_description": "Decrypt some cyphertext.", + "transit_view_decrypt_icon_text": "Decryption Icon", + } \ No newline at end of file