chore: i18n

This commit is contained in:
Paul Makles 2022-06-12 21:11:23 +01:00
parent c1324108e3
commit 7680931f5f
5 changed files with 63 additions and 35 deletions

2
external/lang vendored

@ -1 +1 @@
Subproject commit c47a2eeaad9b6684d8a7c3fe577f0af05a04cc29 Subproject commit a38d0dc72a39ea2b5a6f54c1c999f2021b899e50

View file

@ -173,15 +173,23 @@ export default function MultiFactorAuthentication() {
<CategoryButton <CategoryButton
icon={<ListOl size={24} />} icon={<ListOl size={24} />}
description={ description={
<Text
id={`app.settings.pages.account.2fa.${
mfa?.recovery_active mfa?.recovery_active
? "View and download your 2FA backup codes." ? "view_recovery"
: "Get ready to use 2FA by setting up a recovery method." : "generate_recovery"
}_long`}
/>
} }
disabled={!mfa} disabled={!mfa}
onClick={recoveryAction}> onClick={recoveryAction}>
{mfa?.recovery_active <Text
? "View Backup Codes" id={`app.settings.pages.account.2fa.${
: "Generate Recovery Codes"} mfa?.recovery_active
? "view_recovery"
: "generate_recovery"
}`}
/>
</CategoryButton> </CategoryButton>
<CategoryButton <CategoryButton
icon={ icon={
@ -193,14 +201,20 @@ export default function MultiFactorAuthentication() {
description={"Set up time-based one-time password."} description={"Set up time-based one-time password."}
disabled={!mfa || (!mfa.recovery_active && !mfa.totp_mfa)} disabled={!mfa || (!mfa.recovery_active && !mfa.totp_mfa)}
onClick={totpAction}> onClick={totpAction}>
{mfa?.totp_mfa ? "Disable" : "Enable"} Authenticator App <Text
id={`app.settings.pages.account.2fa.${
mfa?.totp_mfa ? "remove" : "add"
}_auth`}
/>
</CategoryButton> </CategoryButton>
{mfa && ( {mfa && (
<Tip palette={mfaActive ? "primary" : "error"}> <Tip palette={mfaActive ? "primary" : "error"}>
{mfaActive <Text
? "Two-factor authentication is currently on!" id={`app.settings.pages.account.2fa.two_factor_${
: "Two-factor authentication is currently off!"} mfaActive ? "on" : "off"
}`}
/>
</Tip> </Tip>
)} )}
</> </>

View file

@ -1,6 +1,7 @@
import { QRCodeSVG } from "qrcode.react"; import { QRCodeSVG } from "qrcode.react";
import styled from "styled-components"; import styled from "styled-components";
import { Text } from "preact-i18n";
import { useState } from "preact/hooks"; import { useState } from "preact/hooks";
import { Category, Centred, Column, InputBox, Modal } from "@revoltchat/ui"; import { Category, Centred, Column, InputBox, Modal } from "@revoltchat/ui";
@ -25,14 +26,12 @@ export default function MFAEnableTOTP({
return ( return (
<Modal <Modal
title="Enable authenticator app" title={<Text id="app.special.modals.mfa.enable_totp" />}
description={ description={<Text id="app.special.modals.mfa.prompt_totp" />}
"Please scan or use the token below in your authentication app."
}
actions={[ actions={[
{ {
palette: "primary", palette: "primary",
children: "Continue", children: <Text id="app.special.modals.actions.continue" />,
onClick: () => { onClick: () => {
callback(value.trim().replace(/\s/g, "")); callback(value.trim().replace(/\s/g, ""));
return true; return true;
@ -41,7 +40,7 @@ export default function MFAEnableTOTP({
}, },
{ {
palette: "plain", palette: "plain",
children: "Cancel", children: <Text id="app.special.modals.actions.cancel" />,
onClick: () => { onClick: () => {
callback(); callback();
return true; return true;
@ -65,7 +64,9 @@ export default function MFAEnableTOTP({
</Centred> </Centred>
</Column> </Column>
<Category compact>Enter Code</Category> <Category compact>
<Text id="app.special.modals.mfa.enter_code" />
</Category>
<InputBox <InputBox
value={value} value={value}

View file

@ -126,39 +126,51 @@ export default function MFAFlow({ onClose, ...props }: ModalProps<"mfa_flow">) {
return ( return (
<Modal <Modal
title="Confirm action." title={<Text id="app.special.modals.confirm" />}
description={ description={
selectedMethod <Text
? "Please confirm using selected method." id={`app.special.modals.mfa.${
: "Please select a method to authenticate your request." selectedMethod ? "confirm" : "select_method"
}`}
/>
} }
actions={ actions={
selectedMethod selectedMethod
? [ ? [
{ {
palette: "primary", palette: "primary",
children: "Confirm", children: (
<Text id="app.special.modals.actions.confirm" />
),
onClick: generateTicket, onClick: generateTicket,
confirmation: true, confirmation: true,
}, },
{ {
palette: "plain", palette: "plain",
children: children: (
methods!.length === 1 ? "Cancel" : "Back", <Text
id={`app.special.modals.actions.${
methods!.length === 1
? "cancel"
: "back"
}`}
/>
),
onClick: () => { onClick: () => {
if (methods!.length === 1) { if (methods!.length === 1) {
props.callback(); props.callback();
return true; return true;
} }
setSelected(undefined); setSelected(undefined);
}, },
}, },
] ]
: [ : [
{ {
palette: "plain", palette: "plain",
children: "Cancel", children: (
<Text id="app.special.modals.actions.cancel" />
),
onClick: () => { onClick: () => {
props.callback(); props.callback();
return true; return true;

View file

@ -1,5 +1,6 @@
import styled from "styled-components"; import styled from "styled-components";
import { Text } from "preact-i18n";
import { useCallback, useState } from "preact/hooks"; import { useCallback, useState } from "preact/hooks";
import { Modal } from "@revoltchat/ui"; import { Modal } from "@revoltchat/ui";
@ -49,29 +50,29 @@ export default function MFARecovery({
} }
return false; return false;
}, []); }, [client]);
return ( return (
<Modal <Modal
title="Your recovery codes" title={<Text id="app.special.modals.mfa.recovery_codes" />}
description={"Please save these to a safe location."} description={<Text id="app.special.modals.mfa.save_codes" />}
actions={[ actions={[
{ {
palette: "primary", palette: "primary",
children: "Done", children: <Text id="app.special.modals.actions.done" />,
onClick: noopTrue, onClick: noopTrue,
confirmation: true, confirmation: true,
}, },
{ {
palette: "plain", palette: "plain",
children: "Reset", children: <Text id="app.special.modals.actions.reset" />,
onClick: reset, onClick: reset,
}, },
]} ]}
onClose={onClose}> onClose={onClose}>
<List> <List>
{known.map((code) => ( {known.map((code) => (
<span>{code}</span> <span key={code}>{code}</span>
))} ))}
</List> </List>
</Modal> </Modal>