i18n.mx raw
1 package main
2
3 import (
4 "git.smesh.lol/smesh/web/common/jsbridge/localstorage"
5 )
6
7 const lsKeyLang = "smesh-lang"
8
9 var currentLang = "en"
10
11 // t returns the translated string for the given key in the current language.
12 func t(key string) (s string) {
13 if m, ok := translations[currentLang]; ok {
14 if s, ok := m[key]; ok {
15 return s
16 }
17 }
18 // Fallback to English.
19 if s, ok := translations["en"][key]; ok {
20 return s
21 }
22 return key
23 }
24
25 func setLang(lang string) {
26 if _, ok := translations[lang]; !ok {
27 return
28 }
29 currentLang = lang
30 localstorage.SetItem(lsKeyLang, lang)
31 }
32
33 func initLang() {
34 saved := localstorage.GetItem(lsKeyLang)
35 if saved != "" {
36 if _, ok := translations[saved]; ok {
37 currentLang = saved
38 return
39 }
40 }
41 }
42
43 var langNames = map[string]string{
44 "en": "English",
45 "ja": "日本語",
46 "pt": "Português",
47 }
48
49 var translations = map[string]map[string]string{
50 "en": {
51 // Login page.
52 "subtitle": "Sovereign Messaging, Encryption, Sync & Heuristics",
53 "login": "login",
54 "requesting": "requesting...",
55 "err_no_id": "no identity - open signer to add one",
56 "language": "Language",
57 "theme": "Theme",
58 "dark": "dark",
59 "light": "light",
60
61 // Top bar / nav.
62 "back": "\u2190 back",
63 "feed": "feed",
64 "compose": "compose",
65 "messaging": "messaging",
66 "settings": "settings",
67 "notifications": "notifications",
68 "no_notifications": "no notifications yet",
69 "about": "about",
70
71 // Feed.
72 "connecting": "connecting...",
73 "loading_translator": "loading translator...",
74 "show_more": "show more",
75 "show_less": "show less",
76 "note_not_found": "Note not found",
77 "reposted": "reposted",
78
79 // Thread view.
80 "loading_thread": "loading thread...",
81 "thread_empty": "thread not found",
82 "replying_to": "replying to...",
83 "reply_not_found": "note not found",
84
85 // Profile.
86 "notes": "notes",
87 "follows": "follows",
88 "relays": "relays",
89 "mutes": "mutes",
90 "no_follows": "no follows data",
91 "no_relays": "no relay data",
92 "no_mutes": "no mutes data",
93 "following": "following",
94 "muted": "muted",
95 "copy": "copy",
96 "qr": "qr",
97 "message": "message",
98 "loading": "loading...",
99 "relay_info": "relay info",
100 "relay_fail": "failed to fetch relay info",
101
102 // Messaging.
103 "new_chat": " | new chat",
104 "no_convos": "no conversations yet",
105 "npub_placeholder": "npub or hex pubkey",
106 "go": "go",
107 "msg_placeholder": "message...",
108 "send": "send",
109 "dm_notice": "encrypted DMs require the <b>Smesh Signer</b> extension",
110 "ratchet": "ratchet",
111 "relay_leak_warn": "some of the selected relays may leak metadata",
112
113 // About.
114 "developed_by": "developed by:",
115 "tagline": "Can Youse Paradigm?",
116 "about_donkey": "Every hour you don't zap, a donkey eats another cabbage. You can stop this. \U0001FABE",
117
118 // Settings.
119 "settings_title": "Settings",
120 "lang_label": "Interface language",
121 "theme_label": "Appearance",
122
123 // Relay settings.
124 "relays_section": "Relays",
125 "relays_active": "Active relays",
126 "relays_required": "Required capabilities",
127 "relays_req_nip42": "NIP-42 authentication",
128 "relays_req_nip70": "NIP-70 protected events",
129 "relays_block_payment": "Block payment-required relays",
130 "relays_block_restrict": "Block restricted-write relays",
131 "relays_blocklist": "Blocklist",
132 "relays_blocklist_empty": "(none)",
133 "relays_no_nip11": "(no NIP-11)",
134
135 // Signer.
136 "signer": "signer",
137 "no_signer_backend": "No signer detected. Install the extension.",
138 "no_vault": "No vault found. Create a new one.",
139 "hd_keychain": "HD Keychain",
140 "vault_password": "Vault password",
141 "generate_keychain": "Generate New Keychain",
142 "generating": "Generating keychain...",
143 "create_failed": "Failed to create vault.",
144 "restore_seed": "Restore from Seed Phrase",
145 "seed_placeholder": "12-word seed phrase",
146 "account_placeholder": "Account number (default: 1)",
147 "restore_keychain": "Restore Keychain",
148 "restoring": "Restoring keychain...",
149 "restore_failed": "Invalid seed phrase or vault creation failed.",
150 "deriving_n": "Deriving identity",
151 "import_vault": "Import Vault File",
152 "choose_vault": "Choose Vault File...",
153 "vault_imported": "Vault imported. Unlock with your password.",
154 "invalid_vault": "Invalid vault file.",
155 "write_seed": "Write Down Your Seed Phrase",
156 "seed_warning": "This is the ONLY way to recover your identities. Write these words down and store them safely. They will not be shown again.",
157 "copy_clipboard": "Copy to Clipboard",
158 "copied": "Copied!",
159 "saved_it": "I've Saved It",
160 "vault_locked": "Vault is locked.",
161 "password": "Password",
162 "unlock": "Unlock",
163 "deriving_key": "Deriving key, this may take a minute...",
164 "wrong_password": "Wrong password.",
165 "unlock_failed_kdf": "Unlock failed - key derivation crashed. See log.",
166 "identities": "Identities",
167 "nickname_placeholder": "Nickname for new identity",
168 "derive_new": "Derive New Identity",
169 "deriving": "Deriving...",
170 "show_seed": "Show Seed Phrase",
171 "export_vault": "Export Vault",
172 "export_password_prompt": "Choose a password to protect the exported vault:",
173 "confirm_password": "Confirm password",
174 "password_required": "Password is required.",
175 "passwords_mismatch": "Passwords do not match.",
176 "export_failed": "Export failed.",
177 "cancel": "Cancel",
178 "lock_vault": "Lock Vault",
179 "logout": "Logout",
180 "logout_confirm": "This will erase all keys and log you out. Are you sure?",
181 "use": "Use",
182 "publish": "Publish",
183 "add": "Add",
184 "edit_profile": "edit profile",
185 "save": "Save",
186 "profile_name": "Display name",
187 "profile_about": "About",
188 "profile_picture": "Picture URL",
189 "profile_banner": "Banner URL",
190 "profile_nip05": "NIP-05 (user@domain)",
191 "profile_website": "Website",
192 "profile_lud16": "Lightning address",
193 "profile_saved": "Profile published",
194
195 // Wallet (NWC).
196 "wallet": "Wallet",
197 "wallet_no_wallet": "No wallet connected. Paste a Nostr Wallet Connect URI below.",
198 "wallet_add": "Add Wallet",
199 "wallet_add_another": "Add another wallet",
200 "wallet_add_hint": "Paste a nostr+walletconnect:// URI from Alby Hub, Mutiny, LNbits, etc.",
201 "wallet_alias_placeholder": "Alias (optional)",
202 "wallet_adding": "Adding...",
203 "wallet_add_failed": "Could not add wallet. Check the URI.",
204 "wallet_remove_confirm": "Remove this wallet connection?",
205 "wallet_refresh": "Refresh",
206 "wallet_loading_balance": "loading...",
207 "wallet_sats": "sats",
208 "wallet_send": "Send",
209 "wallet_recipient_placeholder": "lnbc... or user@domain",
210 "wallet_amount_placeholder": "Amount (sats, Lightning address only)",
211 "wallet_comment_placeholder": "Comment (optional)",
212 "wallet_pay": "Pay",
213 "wallet_paying": "Paying...",
214 "wallet_pay_ok": "Paid",
215 "wallet_pay_failed": "Payment failed",
216 "wallet_need_amount": "Amount required for Lightning addresses.",
217 "wallet_unknown_recipient": "Unknown recipient. Use a BOLT11 invoice or lightning address.",
218 },
219 "ja": {
220 "subtitle": "主権あるメッセージング、暗号化、同期 & ヒューリスティクス",
221 "login": "ログイン",
222 "requesting": "リクエスト中...",
223 "err_no_id": "IDがありません - 署名を開いて追加してください",
224 "language": "言語",
225 "theme": "テーマ",
226 "dark": "ダーク",
227 "light": "ライト",
228
229 "back": "\u2190 戻る",
230 "feed": "フィード",
231 "compose": "作成",
232 "messaging": "メッセージ",
233 "settings": "設定",
234 "notifications": "通知",
235 "no_notifications": "通知はまだありません",
236 "about": "概要",
237
238 "connecting": "接続中...",
239 "loading_translator": "翻訳モジュール読み込み中...",
240 "show_more": "もっと見る",
241 "show_less": "閉じる",
242 "note_not_found": "ノートが見つかりません",
243 "reposted": "リポスト",
244
245 "loading_thread": "スレッド読み込み中...",
246 "thread_empty": "スレッドが見つかりません",
247 "replying_to": "返信先...",
248 "reply_not_found": "ノートが見つかりません",
249
250 "notes": "ノート",
251 "follows": "フォロー",
252 "relays": "リレー",
253 "mutes": "ミュート",
254 "no_follows": "フォローデータなし",
255 "no_relays": "リレーデータなし",
256 "no_mutes": "ミュートデータなし",
257 "following": "フォロー中",
258 "muted": "ミュート中",
259 "copy": "コピー",
260 "qr": "QR",
261 "message": "メッセージ",
262 "loading": "読み込み中...",
263 "relay_info": "リレー情報",
264 "relay_fail": "リレー情報の取得に失敗しました",
265
266 "new_chat": " | 新しいチャット",
267 "no_convos": "会話がまだありません",
268 "npub_placeholder": "npubまたは16進公開鍵",
269 "go": "実行",
270 "msg_placeholder": "メッセージ...",
271 "send": "送信",
272 "dm_notice": "暗号化DMには<b>Smesh Signer</b>拡張が必要です",
273 "ratchet": "ラチェット",
274 "relay_leak_warn": "選択されたリレーの一部がメタデータを漏洩する可能性があります",
275
276 "developed_by": "開発者:",
277 "tagline": "Can Youse Paradigm?",
278 "about_donkey": "zapしないと毎時間ロバがキャベツを食べてしまいます。止められるのはあなたです。\U0001FABE",
279
280 "settings_title": "設定",
281 "lang_label": "表示言語",
282 "theme_label": "外観",
283
284 "relays_section": "リレー",
285 "relays_active": "アクティブなリレー",
286 "relays_required": "必須機能",
287 "relays_req_nip42": "NIP-42 認証",
288 "relays_req_nip70": "NIP-70 保護イベント",
289 "relays_block_payment": "有料リレーをブロック",
290 "relays_block_restrict": "書き込み制限リレーをブロック",
291 "relays_blocklist": "ブロックリスト",
292 "relays_blocklist_empty": "(なし)",
293 "relays_no_nip11": "(NIP-11なし)",
294
295 "signer": "署名",
296 "no_vault": "金庫が見つかりません。新規作成してください。",
297 "hd_keychain": "HDキーチェーン",
298 "vault_password": "金庫のパスワード",
299 "generate_keychain": "新しいキーチェーンを生成",
300 "generating": "キーチェーン生成中...",
301 "create_failed": "金庫の作成に失敗しました。",
302 "restore_seed": "シードフレーズから復元",
303 "seed_placeholder": "12語のシードフレーズ",
304 "account_placeholder": "アカウント番号(デフォルト: 1)",
305 "restore_keychain": "キーチェーンを復元",
306 "restoring": "キーチェーン復元中...",
307 "restore_failed": "シードフレーズが無効か、金庫の作成に失敗しました。",
308 "deriving_n": "ID導出中",
309 "import_vault": "金庫ファイルをインポート",
310 "choose_vault": "金庫ファイルを選択...",
311 "vault_imported": "金庫をインポートしました。パスワードでロック解除してください。",
312 "invalid_vault": "無効な金庫ファイルです。",
313 "write_seed": "シードフレーズを書き留めてください",
314 "seed_warning": "これがIDを復元する唯一の方法です。これらの単語を書き留めて安全に保管してください。再表示されません。",
315 "copy_clipboard": "クリップボードにコピー",
316 "copied": "コピー済み!",
317 "saved_it": "保存しました",
318 "vault_locked": "金庫はロックされています。",
319 "password": "パスワード",
320 "unlock": "ロック解除",
321 "deriving_key": "鍵を導出中です。しばらくお待ちください...",
322 "wrong_password": "パスワードが違います。",
323 "identities": "ID一覧",
324 "nickname_placeholder": "新しいIDのニックネーム",
325 "derive_new": "新しいIDを導出",
326 "deriving": "導出中...",
327 "show_seed": "シードフレーズを表示",
328 "export_vault": "金庫をエクスポート",
329 "export_password_prompt": "エクスポートの保護パスワードを入力してください:",
330 "confirm_password": "パスワード確認",
331 "password_required": "パスワードが必要です。",
332 "passwords_mismatch": "パスワードが一致しません。",
333 "export_failed": "エクスポートに失敗しました。",
334 "cancel": "キャンセル",
335 "lock_vault": "金庫をロック",
336 "logout": "ログアウト",
337 "logout_confirm": "すべての鍵が削除され、ログアウトします。よろしいですか?",
338 "use": "使用",
339 "publish": "公開",
340 "add": "追加",
341
342 // Wallet (NWC).
343 "wallet": "ウォレット",
344 "wallet_no_wallet": "ウォレットが接続されていません。下に Nostr Wallet Connect URI を貼り付けてください。",
345 "wallet_add": "ウォレットを追加",
346 "wallet_add_another": "別のウォレットを追加",
347 "wallet_add_hint": "Alby Hub、Mutiny、LNbits などの nostr+walletconnect:// URI を貼り付けてください。",
348 "wallet_alias_placeholder": "別名(任意)",
349 "wallet_adding": "追加中...",
350 "wallet_add_failed": "ウォレットを追加できませんでした。URI を確認してください。",
351 "wallet_remove_confirm": "このウォレット接続を削除しますか?",
352 "wallet_refresh": "更新",
353 "wallet_loading_balance": "読み込み中...",
354 "wallet_sats": "sats",
355 "wallet_send": "送信",
356 "wallet_recipient_placeholder": "lnbc... または user@domain",
357 "wallet_amount_placeholder": "金額 (sats、Lightning アドレスのみ)",
358 "wallet_comment_placeholder": "コメント(任意)",
359 "wallet_pay": "支払う",
360 "wallet_paying": "支払い中...",
361 "wallet_pay_ok": "支払い完了",
362 "wallet_pay_failed": "支払い失敗",
363 "wallet_need_amount": "Lightning アドレスには金額が必要です。",
364 "wallet_unknown_recipient": "不明な受取人。BOLT11 インボイスまたは Lightning アドレスを使用してください。",
365 },
366 "pt": {
367 "subtitle": "Mensagens Soberanas, Encriptação, Sincronização & Heurísticas",
368 "login": "entrar",
369 "requesting": "solicitando...",
370 "err_no_id": "sem identidade - abra o signer para adicionar uma",
371 "language": "Idioma",
372 "theme": "Tema",
373 "dark": "escuro",
374 "light": "claro",
375
376 "back": "\u2190 voltar",
377 "feed": "feed",
378 "compose": "compor",
379 "messaging": "mensagens",
380 "settings": "configurações",
381 "notifications": "notificações",
382 "no_notifications": "nenhuma notificação ainda",
383 "about": "sobre",
384
385 "connecting": "conectando...",
386 "loading_translator": "carregando tradutor...",
387 "show_more": "mostrar mais",
388 "show_less": "mostrar menos",
389 "note_not_found": "Nota não encontrada",
390 "reposted": "repostou",
391
392 "loading_thread": "carregando thread...",
393 "thread_empty": "thread não encontrada",
394 "replying_to": "respondendo a...",
395 "reply_not_found": "nota não encontrada",
396
397 "notes": "notas",
398 "follows": "seguindo",
399 "relays": "relays",
400 "mutes": "silenciados",
401 "no_follows": "sem dados de seguidos",
402 "no_relays": "sem dados de relays",
403 "no_mutes": "sem dados de silenciados",
404 "following": "seguindo",
405 "muted": "silenciados",
406 "copy": "copiar",
407 "qr": "qr",
408 "message": "mensagem",
409 "loading": "carregando...",
410 "relay_info": "info do relay",
411 "relay_fail": "falha ao buscar info do relay",
412
413 "new_chat": " | novo chat",
414 "no_convos": "nenhuma conversa ainda",
415 "npub_placeholder": "npub ou chave pública hex",
416 "go": "ir",
417 "msg_placeholder": "mensagem...",
418 "send": "enviar",
419 "dm_notice": "DMs encriptadas requerem a extensão <b>Smesh Signer</b>",
420 "ratchet": "ratchet",
421 "relay_leak_warn": "alguns dos relays selecionados podem vazar metadados",
422
423 "developed_by": "desenvolvido por:",
424 "tagline": "Can Youse Paradigm?",
425 "about_donkey": "A cada hora que você não dá zap, um burro come outro repolho. Você pode impedir isso. \U0001FABE",
426
427 "settings_title": "Configurações",
428 "lang_label": "Idioma da interface",
429 "theme_label": "Aparência",
430
431 "relays_section": "Relays",
432 "relays_active": "Relays ativos",
433 "relays_required": "Capacidades necessárias",
434 "relays_req_nip42": "NIP-42 autenticação",
435 "relays_req_nip70": "NIP-70 eventos protegidos",
436 "relays_block_payment": "Bloquear relays pagos",
437 "relays_block_restrict": "Bloquear relays com escrita restrita",
438 "relays_blocklist": "Lista de bloqueio",
439 "relays_blocklist_empty": "(nenhum)",
440 "relays_no_nip11": "(sem NIP-11)",
441
442 "signer": "assinador",
443 "no_vault": "Nenhum cofre encontrado. Crie um novo.",
444 "hd_keychain": "Chaveiro HD",
445 "vault_password": "Senha do cofre",
446 "generate_keychain": "Gerar Novo Chaveiro",
447 "generating": "Gerando chaveiro...",
448 "create_failed": "Falha ao criar cofre.",
449 "restore_seed": "Restaurar com Frase Semente",
450 "seed_placeholder": "Frase semente de 12 palavras",
451 "account_placeholder": "Número da conta (padrão: 1)",
452 "restore_keychain": "Restaurar Chaveiro",
453 "restoring": "Restaurando chaveiro...",
454 "restore_failed": "Frase semente inválida ou falha ao criar cofre.",
455 "deriving_n": "Derivando identidade",
456 "import_vault": "Importar Arquivo de Cofre",
457 "choose_vault": "Escolher Arquivo de Cofre...",
458 "vault_imported": "Cofre importado. Desbloqueie com sua senha.",
459 "invalid_vault": "Arquivo de cofre inválido.",
460 "write_seed": "Anote Sua Frase Semente",
461 "seed_warning": "Esta é a ÚNICA forma de recuperar suas identidades. Anote estas palavras e guarde-as em segurança. Elas não serão exibidas novamente.",
462 "copy_clipboard": "Copiar para Área de Transferência",
463 "copied": "Copiado!",
464 "saved_it": "Já Salvei",
465 "vault_locked": "Cofre está bloqueado.",
466 "password": "Senha",
467 "unlock": "Desbloquear",
468 "deriving_key": "Derivando chave, isso pode levar um minuto...",
469 "wrong_password": "Senha incorreta.",
470 "identities": "Identidades",
471 "nickname_placeholder": "Apelido para nova identidade",
472 "derive_new": "Derivar Nova Identidade",
473 "deriving": "Derivando...",
474 "show_seed": "Mostrar Frase Semente",
475 "export_vault": "Exportar Cofre",
476 "export_password_prompt": "Escolha uma senha para proteger o cofre exportado:",
477 "confirm_password": "Confirmar senha",
478 "password_required": "Senha obrigatória.",
479 "passwords_mismatch": "As senhas não coincidem.",
480 "export_failed": "Falha na exportação.",
481 "cancel": "Cancelar",
482 "lock_vault": "Bloquear Cofre",
483 "logout": "Sair",
484 "logout_confirm": "Isso apagará todas as chaves e encerrará a sessão. Tem certeza?",
485 "use": "Usar",
486 "publish": "Publicar",
487 "add": "Adicionar",
488
489 // Wallet (NWC).
490 "wallet": "Carteira",
491 "wallet_no_wallet": "Nenhuma carteira conectada. Cole um URI Nostr Wallet Connect abaixo.",
492 "wallet_add": "Adicionar Carteira",
493 "wallet_add_another": "Adicionar outra carteira",
494 "wallet_add_hint": "Cole um URI nostr+walletconnect:// do Alby Hub, Mutiny, LNbits, etc.",
495 "wallet_alias_placeholder": "Apelido (opcional)",
496 "wallet_adding": "Adicionando...",
497 "wallet_add_failed": "Não foi possível adicionar a carteira. Verifique o URI.",
498 "wallet_remove_confirm": "Remover esta conexão de carteira?",
499 "wallet_refresh": "Atualizar",
500 "wallet_loading_balance": "carregando...",
501 "wallet_sats": "sats",
502 "wallet_send": "Enviar",
503 "wallet_recipient_placeholder": "lnbc... ou user@domain",
504 "wallet_amount_placeholder": "Valor (sats, apenas para endereço Lightning)",
505 "wallet_comment_placeholder": "Comentário (opcional)",
506 "wallet_pay": "Pagar",
507 "wallet_paying": "Pagando...",
508 "wallet_pay_ok": "Pago",
509 "wallet_pay_failed": "Falha no pagamento",
510 "wallet_need_amount": "Valor obrigatório para endereços Lightning.",
511 "wallet_unknown_recipient": "Destinatário desconhecido. Use uma fatura BOLT11 ou endereço Lightning.",
512 },
513 }
514