Browse Source

Minor i18n fixes (#663)

* i18n fixes

Add PKI Backup Reminder dialog + ensure en-US is UI default

* Revert edits to i18n components
pull/670/head
Jeremy Gallant 12 months ago
committed by GitHub
parent
commit
ccc4202aa4
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 2
      src/components/KeyBackupReminder.tsx
  2. 14
      src/core/hooks/useKeyBackupReminder.tsx
  3. 1
      src/i18n/locales/en/common.json
  4. 8
      src/i18n/locales/en/dialog.json

2
src/components/KeyBackupReminder.tsx

@ -7,7 +7,7 @@ export const KeyBackupReminder = () => {
const { t } = useTranslation("dialog");
useBackupReminder({
message: t("pkiBackup.description"),
message: t("pkiBackupReminder.description"),
onAccept: () => setDialogOpen("pkiBackup", true),
enabled: true,
});

14
src/core/hooks/useKeyBackupReminder.tsx

@ -2,6 +2,7 @@ import { Button } from "@components/UI/Button.tsx";
import { useCallback, useEffect, useRef } from "react";
import { useToast } from "@core/hooks/useToast.ts";
import useLocalStorage from "@core/hooks/useLocalStorage.ts";
import { useTranslation } from "react-i18next";
interface UseBackupReminderOptions {
reminderInDays?: number;
@ -36,6 +37,8 @@ export function useBackupReminder({
onAccept = () => {},
reminderInDays = REMINDER_DAYS_ONE_WEEK,
}: UseBackupReminderOptions) {
const { t } = useTranslation("dialog");
const { toast } = useToast();
const toastShownRef = useRef(false);
const [reminderState, setReminderState] = useLocalStorage<
@ -59,7 +62,7 @@ export function useBackupReminder({
toastShownRef.current = true;
const { dismiss } = toast({
title: "Backup Reminder",
title: t("pkiBackupReminder.title"),
duration: TOAST_DURATION,
delay: TOAST_APPEAR_DELAY,
description: message,
@ -75,7 +78,10 @@ export function useBackupReminder({
setReminderExpiry(reminderInDays);
}}
>
Remind me in {reminderInDays} day{reminderInDays > 1 ? "s" : ""}
{t("pkiBackupReminder.remindLaterPrefix")} {reminderInDays}{" "}
{reminderInDays > 1
? t("common:unit.day.plural").toLowerCase()
: t("common:unit.day.one").toLowerCase()}
</Button>
<Button
type="button"
@ -86,7 +92,7 @@ export function useBackupReminder({
setReminderExpiry(REMINDER_DAYS_FOREVER);
}}
>
Never remind me
{t("pkiBackupReminder.remindNever")}
</Button>
</div>
<Button
@ -99,7 +105,7 @@ export function useBackupReminder({
setReminderExpiry(REMINDER_DAYS_ONE_YEAR);
}}
>
Back up now
{t("pkiBackupReminder.backupNow")}
</Button>
</div>
),

1
src/i18n/locales/en/common.json

@ -54,6 +54,7 @@
"suffix": "ms"
},
"second": { "one": "Second", "plural": "Seconds" },
"day": { "one": "Day", "plural": "Days" },
"snr": "SNR",
"volt": { "one": "Volt", "plural": "Volts", "suffix": "V" },
"record": { "one": "Records", "plural": "Records" }

8
src/i18n/locales/en/dialog.json

@ -93,7 +93,6 @@
"unignoreNode": "Unignore node"
},
"pkiBackup": {
"description": "We recommend backing up your key data regularly. Would you like to back up now?",
"loseKeysWarning": "If you lose your keys, you will need to reset your device.",
"secureBackup": "Its important to backup your public and private keys and store your backup securely!",
"footer": "=== END OF KEYS ===",
@ -103,6 +102,13 @@
"fileName": "meshtastic_keys_{{longName}}_{{shortName}}.txt",
"title": "Backup Keys"
},
"pkiBackupReminder": {
"description": "We recommend backing up your key data regularly. Would you like to back up now?",
"title": "Backup Reminder",
"remindLaterPrefix": "Remind me in",
"remindNever": "Never remind me",
"backupNow": "Back up now"
},
"pkiRegenerate": {
"description": "Are you sure you want to regenerate key pair?",
"title": "Regenerate Key Pair"

Loading…
Cancel
Save