diff --git a/src/components/Activity.tsx b/src/components/Activity.tsx index 3c7044e7..48223113 100644 --- a/src/components/Activity.tsx +++ b/src/components/Activity.tsx @@ -141,7 +141,9 @@ export function CombinedActivity(props: { limit?: number }) {
- {i18n.t("receive_some_sats_to_get_started")} + {i18n.t( + "activity.receive_some_sats_to_get_started" + )}
@@ -173,7 +175,7 @@ export function CombinedActivity(props: { limit?: number }) { href="/activity" class="text-m-red active:text-m-red/80 font-semibold no-underline self-center" > - {i18n.t("view_all")} + {i18n.t("activity.view_all")} diff --git a/src/components/ActivityItem.tsx b/src/components/ActivityItem.tsx index 57511eb7..d2ea69c7 100644 --- a/src/components/ActivityItem.tsx +++ b/src/components/ActivityItem.tsx @@ -10,6 +10,7 @@ import { generateGradient } from "~/utils/gradientHash"; import { useMegaStore } from "~/state/megaStore"; import { Contact } from "@mutinywallet/mutiny-wasm"; import { Amount } from "~/components/Amount"; +import { useI18n } from "~/i18n/context"; export const ActivityAmount: ParentComponent<{ amount: string; @@ -93,6 +94,7 @@ export function ActivityItem(props: { onClick?: () => void; }) { const [state, _actions] = useMegaStore(); + const i18n = useI18n(); const firstContact = () => props.contacts?.length ? props.contacts[0] : null; @@ -135,12 +137,12 @@ export function ActivityItem(props: { - Channel Close + {i18n.t("activity.channel_close")} - Channel Open + {i18n.t("activity.channel_open")} {" "} @@ -155,13 +157,13 @@ export function ActivityItem(props: { - Unknown + {i18n.t("activity.unknown")} - Unknown + {i18n.t("activity.unknown")} diff --git a/src/components/Amount.tsx b/src/components/Amount.tsx index 1c134e1d..16e53910 100644 --- a/src/components/Amount.tsx +++ b/src/components/Amount.tsx @@ -3,6 +3,7 @@ import { useMegaStore } from "~/state/megaStore"; import { satsToUsd } from "~/utils/conversions"; import bolt from "~/assets/icons/bolt.svg"; import chain from "~/assets/icons/chain.svg"; +import { useI18n } from "~/i18n/context"; function prettyPrintAmount(n?: number | bigint): string { if (!n || n.valueOf() === 0) { @@ -22,6 +23,7 @@ export function Amount(props: { green?: boolean; }) { const [state, _] = useMegaStore(); + const i18n = useI18n(); const amountInUsd = () => satsToUsd(state.price, Number(props.amountSats) || 0, true); @@ -76,7 +78,7 @@ export function Amount(props: { Number(props.amountSats) === 0 } > - SATS + {i18n.t("common.sats")} - SAT + {i18n.t("common.sat")} @@ -113,7 +115,7 @@ export function Amount(props: { "text-base": props.size === "large" }} > -  USD +  {i18n.t("common.usd")} @@ -124,13 +126,14 @@ export function Amount(props: { export function AmountSmall(props: { amountSats: bigint | number | undefined; }) { + const i18n = useI18n(); return ( {prettyPrintAmount(props.amountSats)}  {props.amountSats === 1 || props.amountSats === 1n - ? "SAT" - : "SATS"} + ? `${i18n.t("common.sat")}` + : `${i18n.t("common.sats")}`} ); diff --git a/src/components/AmountEditable.tsx b/src/components/AmountEditable.tsx index 1d9734fc..34bccd26 100644 --- a/src/components/AmountEditable.tsx +++ b/src/components/AmountEditable.tsx @@ -24,21 +24,6 @@ import { FeesModal } from "./MoreInfoModal"; import { useNavigate } from "@solidjs/router"; import { useI18n } from "~/i18n/context"; -const CHARACTERS = [ - "1", - "2", - "3", - "4", - "5", - "6", - "7", - "8", - "9", - ".", - "0", - "DEL" -]; - const FIXED_AMOUNTS_SATS = [ { label: "10k", amount: "10000" }, { label: "100k", amount: "100000" }, @@ -128,6 +113,7 @@ function SingleDigitButton(props: { function BigScalingText(props: { text: string; fiat: boolean }) { const chars = () => props.text.length; + const i18n = useI18n(); return (

{props.text}  - {props.fiat ? "USD" : "SATS"} + + {props.fiat ? "USD" : `${i18n.t("common.sats")}`} +

); } function SmallSubtleAmount(props: { text: string; fiat: boolean }) { + const i18n = useI18n(); return (

~{props.text}  - {props.fiat ? "USD" : "SATS"} + + {props.fiat ? "USD" : `${i18n.t("common.sats")}`} + toDisplayHandleNaN(localSats(), false); const displayFiat = () => `$${toDisplayHandleNaN(localFiat(), true)}`; diff --git a/src/components/BalanceBox.tsx b/src/components/BalanceBox.tsx index ae32a4b2..9856f3bb 100644 --- a/src/components/BalanceBox.tsx +++ b/src/components/BalanceBox.tsx @@ -4,6 +4,7 @@ import { useMegaStore } from "~/state/megaStore"; import { Amount } from "./Amount"; import { A, useNavigate } from "solid-start"; import shuffle from "~/assets/icons/shuffle.svg"; +import { useI18n } from "~/i18n/context"; export function LoadingShimmer() { return ( @@ -23,6 +24,7 @@ const STYLE = export default function BalanceBox(props: { loading?: boolean }) { const [state, _actions] = useMegaStore(); + const i18n = useI18n(); const emptyBalance = () => (state.balance?.confirmed || 0n) === 0n && @@ -85,14 +87,14 @@ export default function BalanceBox(props: { loading?: boolean }) { disabled={emptyBalance() || props.loading} intent="green" > - Send + {i18n.t("common.send")} diff --git a/src/components/successfail/SuccessModal.tsx b/src/components/successfail/SuccessModal.tsx index 5aaa9f00..6715ec70 100644 --- a/src/components/successfail/SuccessModal.tsx +++ b/src/components/successfail/SuccessModal.tsx @@ -2,6 +2,7 @@ import { Dialog } from "@kobalte/core"; import { JSX } from "solid-js"; import { Button } from "~/components/layout"; import { DIALOG_CONTENT, DIALOG_POSITIONER } from "~/styles/dialogs"; +import { useI18n } from "~/i18n/context"; type SuccessModalProps = { open: boolean; @@ -12,6 +13,7 @@ type SuccessModalProps = { }; export function SuccessModal(props: SuccessModalProps) { + const i18n = useI18n(); const onNice = () => { props.onConfirm ? props.onConfirm() : props.setOpen(false); }; @@ -27,7 +29,8 @@ export function SuccessModal(props: SuccessModalProps) {
diff --git a/src/i18n/en/translations.ts b/src/i18n/en/translations.ts index d5454bc1..e7c8339d 100644 --- a/src/i18n/en/translations.ts +++ b/src/i18n/en/translations.ts @@ -1,7 +1,41 @@ export default { + common: { + nice: "Nice", + home: "Home", + sats: "SATS", + sat: "SAT", + usd: "USD", + fee: "Fee", + send: "Send", + receive: "Receive" + }, + char: { + del: "DEL" + }, + receive: { + receive_bitcoin: "Receive Bitcoin", + edit: "Edit", + checking: "Checking", + choose_format: "Choose format", + payment_received: "Payment Received", + payment_initiated: "Payment Initiated", + receive_add_the_sender: "Add the sender for your records" + }, + send: { + sending: "Sending...", + confirm_send: "Confirm Send", + contact_placeholder: "Add the receiver for your records", + start_over: "Start Over" + }, + activity: { + view_all: "View all", + receive_some_sats_to_get_started: "Receive some sats to get started", + channel_open: "Channel Open", + channel_close: "Channel Close", + unknown: "Unknown" + }, create_an_issue: "Create an issue", - view_all: "View all", - receive_some_sats_to_get_started: "Receive some sats to get started", + feedback: "Bugs? Feedback?", send_bitcoin: "Send Bitcoin", view_transaction: "View Transaction", amount_editable_first_payment_10k_or_greater: @@ -15,9 +49,7 @@ export default { set_amount: "Set amount", whats_with_the_fees: "What's with the fees?", private_tags: "Private tags", - receive_add_the_sender: "Add the sender for your records", continue: "Continue", - receive_bitcoin: "Receive Bitcoin", keep_mutiny_open: "Keep Mutiny open to complete the payment.", too_big_for_beta: "That's a lot of sats. You do know Mutiny Wallet is still in beta, yeah?" diff --git a/src/routes/Receive.tsx b/src/routes/Receive.tsx index 1756d653..7738a661 100644 --- a/src/routes/Receive.tsx +++ b/src/routes/Receive.tsx @@ -344,18 +344,20 @@ export default function Receive() { > setReceiveState("edit")} - title="Edit" + title={`${i18n.t("receive.edit")}`} showOnDesktop /> Checking + + {i18n.t("receive.checking")} + ) } > - {i18n.t("receive_bitcoin")} + {i18n.t("receive.receive_bitcoin")} @@ -373,7 +375,7 @@ export default function Receive() { selectedValues={selectedValues()} setSelectedValues={setSelectedValues} placeholder={i18n.t( - "receive_add_the_sender" + "receive.receive_add_the_sender" )} /> @@ -406,7 +408,9 @@ export default function Receive() { class="font-bold text-m-grey-400 flex gap-2 p-2 items-center mx-auto" onClick={() => setMethodChooserOpen(true)} > - Choose format + + {i18n.t("receive.choose_format")} + {receiveState() === "paid" && paidState() === "lightning_paid" - ? "Payment Received" - : "Payment Initiated"} + ? i18n.t("receive.payment_received") + : i18n.t("receive.payment_initiated")}

- Fee + {i18n.t("common.fee")}

- View payment details + {i18n.t("view_transaction")} diff --git a/src/routes/Send.tsx b/src/routes/Send.tsx index 5915eabc..7a41d8b2 100644 --- a/src/routes/Send.tsx +++ b/src/routes/Send.tsx @@ -574,12 +574,16 @@ export default function Send() { > clearAll()} - title="Start Over" + title={`${i18n.t("send.start_over")}`} /> {i18n.t("send_bitcoin")} { if (!open) setSentDetails(undefined); @@ -616,7 +620,7 @@ export default function Send() {

- Fees + {i18n.t("common.fee")}

@@ -714,7 +720,9 @@ export default function Send() { onClick={handleSend} loading={sending()} > - {sending() ? "Sending..." : "Confirm Send"} + {sending() + ? i18n.t("send.sending") + : i18n.t("send.confirm_send")}