From 713abecfe0d7b50d59b2aa25002bb1e0688886d3 Mon Sep 17 00:00:00 2001 From: benalleng Date: Mon, 12 Feb 2024 20:57:48 -0500 Subject: [PATCH] chore: transfer bare text to translation keys --- src/components/ChooseLanguage.tsx | 2 +- src/components/ContactEditor.tsx | 2 +- src/components/ContactViewer.tsx | 4 ++-- src/components/MutinyPlusCta.tsx | 3 ++- src/i18n/en/translations.ts | 21 ++++++++++++++++++--- src/routes/Search.tsx | 15 +++++++++------ src/routes/settings/Root.tsx | 10 ++++++---- src/routes/settings/SyncNostrContacts.tsx | 13 ++++++++++--- src/utils/languages.ts | 2 +- 9 files changed, 50 insertions(+), 22 deletions(-) diff --git a/src/components/ChooseLanguage.tsx b/src/components/ChooseLanguage.tsx index 360529da..f1bb7c6e 100644 --- a/src/components/ChooseLanguage.tsx +++ b/src/components/ChooseLanguage.tsx @@ -23,7 +23,7 @@ export function ChooseLanguage() { const [_chooseLanguageForm, { Form, Field }] = createForm({ initialValues: { - selectedLanguage: state.lang ?? "" + selectedLanguage: state.lang ?? i18n.language }, validate: (values) => { const errors: Record = {}; diff --git a/src/components/ContactEditor.tsx b/src/components/ContactEditor.tsx index 545cc1e1..666d0a69 100644 --- a/src/components/ContactEditor.tsx +++ b/src/components/ContactEditor.tsx @@ -68,7 +68,7 @@ export function ContactEditor(props: { previous: location.pathname }} > - Import Nostr Contacts + {i18n.t("contacts.link_to_nostr_sync")} diff --git a/src/components/ContactViewer.tsx b/src/components/ContactViewer.tsx index cf33afb4..55aae7a3 100644 --- a/src/components/ContactViewer.tsx +++ b/src/components/ContactViewer.tsx @@ -115,7 +115,7 @@ export function ContactViewer(props: { intent="red" onClick={() => setConfirmOpen(true)} > - Delete + {i18n.t("contacts.delete")} setConfirmOpen(false)} > - Are you sure you want to delete this contact? + {i18n.t("contacts.confirm_delete")} diff --git a/src/components/MutinyPlusCta.tsx b/src/components/MutinyPlusCta.tsx index de7c1f2b..58755745 100644 --- a/src/components/MutinyPlusCta.tsx +++ b/src/components/MutinyPlusCta.tsx @@ -29,7 +29,8 @@ export function MutinyPlusCta() { >
- Mutiny+ + {i18n.t("common.mutiny")} + + go
diff --git a/src/i18n/en/translations.ts b/src/i18n/en/translations.ts index 4349a78b..3eacc0cd 100644 --- a/src/i18n/en/translations.ts +++ b/src/i18n/en/translations.ts @@ -1,6 +1,7 @@ export default { common: { title: "Mutiny Wallet", + mutiny: "Mutiny", nice: "Nice", home: "Home", e_sats: "eSATS", @@ -33,6 +34,8 @@ export default { create_contact: "Create contact", edit_contact: "Edit contact", save_contact: "Save contact", + delete: "Delete", + confirm_delete: "Are you sure you want to delete this contact?", payment_history: "Payment history", no_payments: "No payments yet with", edit: "Edit", @@ -47,7 +50,8 @@ export default { email_error: "That doesn't look like a lightning address", npub_error: "That doesn't look like a nostr npub", error_ln_address_missing: "New contacts need a lightning address", - npub: "Nostr Npub" + npub: "Nostr Npub", + link_to_nostr_sync: "Import Nostr Contacts" }, receive: { receive_bitcoin: "Receive Bitcoin", @@ -112,6 +116,13 @@ export default { what_for: "What's this for?" }, send: { + search: { + placeholder: "Name, address, invoice", + paste: "Paste", + contacts: "Contacts", + global_search: "Global search", + no_results: "No results found for" + }, sending: "Sending...", confirm_send: "Confirm Send", contact_placeholder: "Add the receiver for your records", @@ -394,6 +405,8 @@ export default { } }, encrypt: { + title: "Change Password", + caption: "Backup first to unlock encryption", header: "Encrypt your seed words", hot_wallet_warning: 'Mutiny is a "hot wallet" so it needs your seed word to operate, but you can optionally encrypt those words with a password.', @@ -530,10 +543,12 @@ export default { save: "Save" }, nostr_contacts: { - title: "Nostr Contacts", + title: "Sync Nostr Contacts", npub_label: "Nostr npub", npub_required: "Npub can't be blank", - sync: "Sync" + sync: "Sync", + resync: "Resync", + remove: "Remove" }, manage_federations: { title: "Manage Federations", diff --git a/src/routes/Search.tsx b/src/routes/Search.tsx index ec6cacf5..7ed77def 100644 --- a/src/routes/Search.tsx +++ b/src/routes/Search.tsx @@ -261,7 +261,7 @@ function ActualSearch() { type="text" value={searchValue()} onInput={(e) => setSearchValue(e.currentTarget.value)} - placeholder="Name, address, invoice..." + placeholder={i18n.t("send.search.placeholder")} autofocus ref={(el) => (searchInputRef = el)} /> @@ -271,7 +271,7 @@ function ActualSearch() { onClick={handlePaste} > Paste - Paste + {i18n.t("send.search.paste")} @@ -285,14 +285,16 @@ function ActualSearch() {
-

Contacts

+

+ {i18n.t("send.search.contacts")} +

}>

- Global Search + {i18n.t("send.search.global_search")}

void; foundNpubs: (string | undefined)[]; }) { + const i18n = useI18n(); const hexpubs = createMemo(() => { const hexpubs: Set = new Set(); for (const npub of props.foundNpubs) { @@ -403,7 +406,7 @@ function GlobalSearch(props: { } >

- No results found for "{props.searchValue}" + {i18n.t("send.search.no_results") + " " + props.searchValue}

diff --git a/src/routes/settings/Root.tsx b/src/routes/settings/Root.tsx index d7e5e74c..327660b3 100644 --- a/src/routes/settings/Root.tsx +++ b/src/routes/settings/Root.tsx @@ -107,10 +107,10 @@ export function Settings() { }, { href: "/settings/encrypt", - text: "Change Password", + text: i18n.t("settings.encrypt.title"), disabled: !state.has_backed_up, caption: !state.has_backed_up - ? "Backup first to unlock encryption" + ? i18n.t("settings.encrypt.caption") : undefined }, { @@ -155,11 +155,13 @@ export function Settings() { }, { href: "/settings/syncnostrcontacts", - text: "Sync Nostr Contacts" + text: i18n.t("settings.nostr_contacts.title") }, { href: "/settings/federations", - text: "Manage Federations" + text: i18n.t( + "settings.manage_federations.title" + ) } ]} /> diff --git a/src/routes/settings/SyncNostrContacts.tsx b/src/routes/settings/SyncNostrContacts.tsx index fb938d62..b5234ba4 100644 --- a/src/routes/settings/SyncNostrContacts.tsx +++ b/src/routes/settings/SyncNostrContacts.tsx @@ -90,6 +90,7 @@ function SyncContactsForm() { } export function SyncNostrContacts() { + const i18n = useI18n(); const [state, actions] = useMegaStore(); const [loading, setLoading] = createSignal(false); const [error, setError] = createSignal(); @@ -114,7 +115,9 @@ export function SyncNostrContacts() { - Sync Nostr Contacts + + {i18n.t("settings.nostr_contacts.title")} + @@ -135,13 +138,17 @@ export function SyncNostrContacts() { onClick={resync} loading={loading()} > - Resync + {i18n.t( + "settings.nostr_contacts.resync" + )} diff --git a/src/utils/languages.ts b/src/utils/languages.ts index 1a7c6978..083549d1 100644 --- a/src/utils/languages.ts +++ b/src/utils/languages.ts @@ -14,7 +14,7 @@ export const LANGUAGE_OPTIONS: Language[] = [ shortName: "pt" }, { - value: "Korean", + value: "한국어", shortName: "ko" } ];