From ccc4202aa406638976076c109a6e6449462d3b76 Mon Sep 17 00:00:00 2001
From: Jeremy Gallant <8975765+philon-@users.noreply.github.com>
Date: Tue, 17 Jun 2025 16:24:58 +0200
Subject: [PATCH] Minor i18n fixes (#663)
* i18n fixes
Add PKI Backup Reminder dialog + ensure en-US is UI default
* Revert edits to i18n components
---
src/components/KeyBackupReminder.tsx | 2 +-
src/core/hooks/useKeyBackupReminder.tsx | 14 ++++++++++----
src/i18n/locales/en/common.json | 1 +
src/i18n/locales/en/dialog.json | 8 +++++++-
4 files changed, 19 insertions(+), 6 deletions(-)
diff --git a/src/components/KeyBackupReminder.tsx b/src/components/KeyBackupReminder.tsx
index aefe60ec..32cacd1a 100644
--- a/src/components/KeyBackupReminder.tsx
+++ b/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,
});
diff --git a/src/core/hooks/useKeyBackupReminder.tsx b/src/core/hooks/useKeyBackupReminder.tsx
index 9e71c2fa..eaadce14 100644
--- a/src/core/hooks/useKeyBackupReminder.tsx
+++ b/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()}
),
diff --git a/src/i18n/locales/en/common.json b/src/i18n/locales/en/common.json
index efb44b14..5597f53a 100644
--- a/src/i18n/locales/en/common.json
+++ b/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" }
diff --git a/src/i18n/locales/en/dialog.json b/src/i18n/locales/en/dialog.json
index 23393156..28427867 100644
--- a/src/i18n/locales/en/dialog.json
+++ b/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"