1
0
Fork 0

Add translations to TransitViewSecretPage.

This commit is contained in:
Kitteh 2021-04-29 10:51:36 +01:00
parent 61954536e5
commit 76d58d1850
3 changed files with 25 additions and 8 deletions

View file

@ -2,6 +2,7 @@ import { Page } from "../../types/Page.js";
import { DoesNotExistError, getTransitKeys } from "../../api.js"; import { DoesNotExistError, getTransitKeys } from "../../api.js";
import { setErrorText, setTitleElement, changePage } from "../../pageUtils.js"; import { setErrorText, setTitleElement, changePage } from "../../pageUtils.js";
import { makeElement } from "../../htmlUtils.js"; import { makeElement } from "../../htmlUtils.js";
import i18next from 'i18next';
export class TransitViewPage extends Page { export class TransitViewPage extends Page {
constructor() { constructor() {
@ -51,7 +52,7 @@ export class TransitViewPage extends Page {
if (e == DoesNotExistError) { if (e == DoesNotExistError) {
pageContent.appendChild(makeElement({ pageContent.appendChild(makeElement({
tag: "p", 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 { } else {
setErrorText(e.message); setErrorText(e.message);
@ -60,6 +61,6 @@ export class TransitViewPage extends Page {
} }
get name() { get name() {
return "Transit View"; return i18next.t("transit_view_title");
} }
} }

View file

@ -1,6 +1,7 @@
import { Page } from "../../types/Page.js"; import { Page } from "../../types/Page.js";
import { changePage, setPageContent, setTitleElement } from "../../pageUtils.js"; import { changePage, setPageContent, setTitleElement } from "../../pageUtils.js";
import { makeElement } from "../../htmlUtils.js"; import { makeElement } from "../../htmlUtils.js";
import i18next from 'i18next';
export class TransitViewSecretPage extends Page { export class TransitViewSecretPage extends Page {
constructor() { constructor() {
@ -10,7 +11,7 @@ export class TransitViewSecretPage extends Page {
changePage("TRANSIT_VIEW"); changePage("TRANSIT_VIEW");
} }
makeTile(title, description, icon = "code", onclick = _ => { }) { makeTile(title, description, icon, iconText, onclick = _ => { }) {
return makeElement({ return makeElement({
tag: "a", tag: "a",
class: "uk-link-heading", class: "uk-link-heading",
@ -54,15 +55,17 @@ export class TransitViewSecretPage extends Page {
tag: "div", tag: "div",
children: [ children: [
this.makeTile( this.makeTile(
"Encrypt", i18next.t("transit_view_encrypt_text"),
"Encrypt some plaintext or base64 encoded binary.", i18next.t("transit_view_encrypt_description"),
"lock", "lock",
i18next.t("transit_view_encrypt_icon_text"),
_ => { changePage("TRANSIT_ENCRYPT"); } _ => { changePage("TRANSIT_ENCRYPT"); }
), ),
this.makeTile( this.makeTile(
"Decrypt", i18next.t("transit_view_decrypt_text"),
"Decrypt some cyphertext.", i18next.t("transit_view_decrypt_description"),
"mail", "mail",
i18next.t("transit_view_decrypt_icon_text"),
_ => { changePage("TRANSIT_DECRYPT"); } _ => { changePage("TRANSIT_DECRYPT"); }
), ),
] ]
@ -72,6 +75,6 @@ export class TransitViewSecretPage extends Page {
} }
get name() { get name() {
return "Transit Secret View"; return i18next.t("transit_view_secret_title");
} }
} }

View file

@ -111,5 +111,18 @@ module.exports = {
"totp_new_key_input": "Key", "totp_new_key_input": "Key",
"totp_new_add_btn": "Add TOTP 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",
} }