diff --git a/src/App.svelte b/src/App.svelte index bb40e99..5d6dbc4 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -42,6 +42,18 @@ position export let startHidden: boolean export let compactMode: boolean + export let texts: Record + export let nstartMeLanguage: string + + // Helper function to get text with fallback + function t(key: string): string { + const value = texts[key] + if (value) return value + + console.warn(`Text not found: ${key}`) + + return key + } const win = window as any const pool = new SimplePool() @@ -83,10 +95,12 @@ let metadataSub: SubCloser | null let pendingRejections: ((reason?: any) => void)[] = [] - const connectBunkerError = + $: connectBunkerError = t( 'We could not connect to a NIP-46 bunker with that url, are you sure it is set up correctly?' - const connectNip05Error = + ) + $: connectNip05Error = t( 'We were not able to connect using this address. For it to work it has to come from a NIP-46 provider.' + ) const BASE_YPOS = 20 export let right = 20 @@ -529,7 +543,7 @@ } function handleCreateAccount() { - window.location.href = `https://nstart.me?an=${currentDomain}&at=web&ac=${currentProtocol}//${currentDomain}&sfb=yes` + window.location.href = `https://nstart.me/${nstartMeLanguage}/?an=${currentDomain}&at=web&ac=${currentProtocol}//${currentDomain}&sfb=yes` } @@ -563,14 +577,14 @@ {#if connecting}
- Connecting to bunker + {t('Connecting to bunker')}
{:else if !identity} {#if compactMode}
N
{:else} -
Connect with Nostr
+
{t('Connect with Nostr')}
{/if} {:else if !compactMode}
@@ -616,51 +630,55 @@ {#if showAuth}
-
Create a Nostr account
+
{t('Create a Nostr account')}
- A new window will now open, taking you to + {t('A new window will now open, taking you to')} {new URL(showAuth).host} - where the account creation will occur. If nothing happens, ensure your - browser is not blocking popups. -
Afterward, you'll be redirected back to this page. + {t( + 'where the account creation will occur. If nothing happens, ensure your browser is not blocking popups.' + )} +
+ {t("Afterward, you'll be redirected back to this page.")}
{:else if showLogin}
-
Login into a Nostr account
+
+ {t('Login into a Nostr account')} +
- A new window will now open, taking you to {new URL(showLogin).host} - where you can login and approve the permissions. If nothing happens, - ensure your browser is not blocking popups.
- Afterward, you'll be redirected back to this page. + {t('A new window will now open, taking you to')} + {new URL(showLogin).host} + {t( + 'where you can login and approve the permissions. If nothing happens, ensure your browser is not blocking popups.' + )}
+ {t("Afterward, you'll be redirected back to this page.")}
{:else if showConfirmAction}
- An action requires your confirmation + {t('An action requires your confirmation')}
- A new window will now open, taking you to {new URL(showConfirmAction).host} - where you can approve the current action. If nothing happens, ensure - your browser is not blocking popups.
- Afterward, you'll be redirected back to this page. + {t('A new window will now open, taking you to')} + {new URL(showConfirmAction).host} + {t( + 'where you can approve the current action. If nothing happens, ensure your browser is not blocking popups.' + )}
+ {t("Afterward, you'll be redirected back to this page.")}
{:else if showInfo} -
What is that?
+
{t('What is that?')}

- This widget is created with window.nostr.js, a small script - you can drop in any page that already uses NIP-07 and make it also - work with NIP-46 automatically when the user doesn't have an - extension installed. + {t('This widget is created with')} window.nostr.js{t( + ", a small script you can drop in any page that already uses NIP-07 and make it also work with NIP-46 automatically when the user doesn't have an extension installed." + )}
- It adds a small floating button on the side of the window that users - can use to create Nostr accuonts or connect to their NIP-46 bunkers. + {t( + 'It adds a small floating button on the side of the window that users can use to create Nostr accuonts or connect to their NIP-46 bunkers.' + )}

- This tool is opensource, get the code from the project's page{t("project's page")}.

- You don't know what Nostr is? + {t("You don't know what Nostr is?")} Learn more{t('Learn more')}.

{:else if creating} -
Create a Nostr account
+
{t('Create a Nostr account')}
- To use this Nostr app you need a profile. The following button opens a - wizard that help you to create your keypair and safely manage it in a - few steps. Are you ready? + {t( + 'To use this Nostr app you need a profile. The following button opens a wizard that help you to create your keypair and safely manage it in a few steps. Are you ready?' + )}
- Do you already have a Nostr address?
+ {t('Do you already have a Nostr address?')}
{t('Login now')}
{:else if !identity}
- How do you want to connect to Nostr? + {t('How do you want to connect to Nostr?')}
{#if connecting} - Connecting to bunker + {t('Connecting to bunker')} {:else} - Connect » + {t('Connect »')} {/if} {#if connecting && takingTooLong}
- Waiting too much? + {t('Waiting too much?')} {t('Cancel the connection')}
{/if} @@ -770,16 +790,16 @@ {#if !connecting}
{#if hasTriedToConnectButFailed} - Is this bunker provider broken?
+ {t('Is this bunker provider broken?')}
{t('Clear it')} {:else} - Do you need a Nostr account?
+ {t('Do you need a Nostr account?')}
{t('Sign up now')} {/if}
@@ -788,7 +808,7 @@ {:else}