package main
import (
"git.smesh.lol/smesh/web/common/jsbridge/localstorage"
)
const lsKeyLang = "smesh-lang"
var currentLang = "en"
// t returns the translated string for the given key in the current language.
func t(key string) (s string) {
if m, ok := translations[currentLang]; ok {
if s, ok := m[key]; ok {
return s
}
}
// Fallback to English.
if s, ok := translations["en"][key]; ok {
return s
}
return key
}
func setLang(lang string) {
if _, ok := translations[lang]; !ok {
return
}
currentLang = lang
localstorage.SetItem(lsKeyLang, lang)
}
func initLang() {
saved := localstorage.GetItem(lsKeyLang)
if saved != "" {
if _, ok := translations[saved]; ok {
currentLang = saved
return
}
}
}
var langNames = map[string]string{
"en": "English",
"ja": "日本語",
"pt": "Português",
}
var translations = map[string]map[string]string{
"en": {
// Login page.
"subtitle": "Sovereign Messaging, Encryption, Sync & Heuristics",
"login": "login",
"requesting": "requesting...",
"err_no_id": "no identity - open signer to add one",
"language": "Language",
"theme": "Theme",
"dark": "dark",
"light": "light",
// Top bar / nav.
"back": "\u2190 back",
"feed": "feed",
"compose": "compose",
"messaging": "messaging",
"settings": "settings",
"notifications": "notifications",
"no_notifications": "no notifications yet",
"about": "about",
// Feed.
"connecting": "connecting...",
"loading_translator": "loading translator...",
"show_more": "show more",
"show_less": "show less",
"note_not_found": "Note not found",
"reposted": "reposted",
// Thread view.
"loading_thread": "loading thread...",
"thread_empty": "thread not found",
"replying_to": "replying to...",
"reply_not_found": "note not found",
// Profile.
"notes": "notes",
"follows": "follows",
"relays": "relays",
"mutes": "mutes",
"no_follows": "no follows data",
"no_relays": "no relay data",
"no_mutes": "no mutes data",
"following": "following",
"muted": "muted",
"copy": "copy",
"qr": "qr",
"message": "message",
"loading": "loading...",
"relay_info": "relay info",
"relay_fail": "failed to fetch relay info",
// Messaging.
"new_chat": " | new chat",
"no_convos": "no conversations yet",
"npub_placeholder": "npub or hex pubkey",
"go": "go",
"msg_placeholder": "message...",
"send": "send",
"dm_notice": "encrypted DMs require the Smesh Signer extension",
"ratchet": "ratchet",
"relay_leak_warn": "some of the selected relays may leak metadata",
// About.
"developed_by": "developed by:",
"tagline": "Can Youse Paradigm?",
"about_donkey": "Every hour you don't zap, a donkey eats another cabbage. You can stop this. \U0001FABE",
// Settings.
"settings_title": "Settings",
"lang_label": "Interface language",
"theme_label": "Appearance",
// Relay settings.
"relays_section": "Relays",
"relays_active": "Active relays",
"relays_required": "Required capabilities",
"relays_req_nip42": "NIP-42 authentication",
"relays_req_nip70": "NIP-70 protected events",
"relays_block_payment": "Block payment-required relays",
"relays_block_restrict": "Block restricted-write relays",
"relays_blocklist": "Blocklist",
"relays_blocklist_empty": "(none)",
"relays_no_nip11": "(no NIP-11)",
// Signer.
"signer": "signer",
"no_signer_backend": "No signer detected. Install the extension.",
"no_vault": "No vault found. Create a new one.",
"hd_keychain": "HD Keychain",
"vault_password": "Vault password",
"generate_keychain": "Generate New Keychain",
"generating": "Generating keychain...",
"create_failed": "Failed to create vault.",
"restore_seed": "Restore from Seed Phrase",
"seed_placeholder": "12-word seed phrase",
"account_placeholder": "Account number (default: 1)",
"restore_keychain": "Restore Keychain",
"restoring": "Restoring keychain...",
"restore_failed": "Invalid seed phrase or vault creation failed.",
"deriving_n": "Deriving identity",
"import_vault": "Import Vault File",
"choose_vault": "Choose Vault File...",
"vault_imported": "Vault imported. Unlock with your password.",
"invalid_vault": "Invalid vault file.",
"write_seed": "Write Down Your Seed Phrase",
"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.",
"copy_clipboard": "Copy to Clipboard",
"copied": "Copied!",
"saved_it": "I've Saved It",
"vault_locked": "Vault is locked.",
"password": "Password",
"unlock": "Unlock",
"deriving_key": "Deriving key, this may take a minute...",
"wrong_password": "Wrong password.",
"unlock_failed_kdf": "Unlock failed - key derivation crashed. See log.",
"identities": "Identities",
"nickname_placeholder": "Nickname for new identity",
"derive_new": "Derive New Identity",
"deriving": "Deriving...",
"show_seed": "Show Seed Phrase",
"export_vault": "Export Vault",
"export_password_prompt": "Choose a password to protect the exported vault:",
"confirm_password": "Confirm password",
"password_required": "Password is required.",
"passwords_mismatch": "Passwords do not match.",
"export_failed": "Export failed.",
"cancel": "Cancel",
"lock_vault": "Lock Vault",
"logout": "Logout",
"logout_confirm": "This will erase all keys and log you out. Are you sure?",
"use": "Use",
"publish": "Publish",
"add": "Add",
"edit_profile": "edit profile",
"save": "Save",
"profile_name": "Display name",
"profile_about": "About",
"profile_picture": "Picture URL",
"profile_banner": "Banner URL",
"profile_nip05": "NIP-05 (user@domain)",
"profile_website": "Website",
"profile_lud16": "Lightning address",
"profile_saved": "Profile published",
// Wallet (NWC).
"wallet": "Wallet",
"wallet_no_wallet": "No wallet connected. Paste a Nostr Wallet Connect URI below.",
"wallet_add": "Add Wallet",
"wallet_add_another": "Add another wallet",
"wallet_add_hint": "Paste a nostr+walletconnect:// URI from Alby Hub, Mutiny, LNbits, etc.",
"wallet_alias_placeholder": "Alias (optional)",
"wallet_adding": "Adding...",
"wallet_add_failed": "Could not add wallet. Check the URI.",
"wallet_remove_confirm": "Remove this wallet connection?",
"wallet_refresh": "Refresh",
"wallet_loading_balance": "loading...",
"wallet_sats": "sats",
"wallet_send": "Send",
"wallet_recipient_placeholder": "lnbc... or user@domain",
"wallet_amount_placeholder": "Amount (sats, Lightning address only)",
"wallet_comment_placeholder": "Comment (optional)",
"wallet_pay": "Pay",
"wallet_paying": "Paying...",
"wallet_pay_ok": "Paid",
"wallet_pay_failed": "Payment failed",
"wallet_need_amount": "Amount required for Lightning addresses.",
"wallet_unknown_recipient": "Unknown recipient. Use a BOLT11 invoice or lightning address.",
},
"ja": {
"subtitle": "主権あるメッセージング、暗号化、同期 & ヒューリスティクス",
"login": "ログイン",
"requesting": "リクエスト中...",
"err_no_id": "IDがありません - 署名を開いて追加してください",
"language": "言語",
"theme": "テーマ",
"dark": "ダーク",
"light": "ライト",
"back": "\u2190 戻る",
"feed": "フィード",
"compose": "作成",
"messaging": "メッセージ",
"settings": "設定",
"notifications": "通知",
"no_notifications": "通知はまだありません",
"about": "概要",
"connecting": "接続中...",
"loading_translator": "翻訳モジュール読み込み中...",
"show_more": "もっと見る",
"show_less": "閉じる",
"note_not_found": "ノートが見つかりません",
"reposted": "リポスト",
"loading_thread": "スレッド読み込み中...",
"thread_empty": "スレッドが見つかりません",
"replying_to": "返信先...",
"reply_not_found": "ノートが見つかりません",
"notes": "ノート",
"follows": "フォロー",
"relays": "リレー",
"mutes": "ミュート",
"no_follows": "フォローデータなし",
"no_relays": "リレーデータなし",
"no_mutes": "ミュートデータなし",
"following": "フォロー中",
"muted": "ミュート中",
"copy": "コピー",
"qr": "QR",
"message": "メッセージ",
"loading": "読み込み中...",
"relay_info": "リレー情報",
"relay_fail": "リレー情報の取得に失敗しました",
"new_chat": " | 新しいチャット",
"no_convos": "会話がまだありません",
"npub_placeholder": "npubまたは16進公開鍵",
"go": "実行",
"msg_placeholder": "メッセージ...",
"send": "送信",
"dm_notice": "暗号化DMにはSmesh Signer拡張が必要です",
"ratchet": "ラチェット",
"relay_leak_warn": "選択されたリレーの一部がメタデータを漏洩する可能性があります",
"developed_by": "開発者:",
"tagline": "Can Youse Paradigm?",
"about_donkey": "zapしないと毎時間ロバがキャベツを食べてしまいます。止められるのはあなたです。\U0001FABE",
"settings_title": "設定",
"lang_label": "表示言語",
"theme_label": "外観",
"relays_section": "リレー",
"relays_active": "アクティブなリレー",
"relays_required": "必須機能",
"relays_req_nip42": "NIP-42 認証",
"relays_req_nip70": "NIP-70 保護イベント",
"relays_block_payment": "有料リレーをブロック",
"relays_block_restrict": "書き込み制限リレーをブロック",
"relays_blocklist": "ブロックリスト",
"relays_blocklist_empty": "(なし)",
"relays_no_nip11": "(NIP-11なし)",
"signer": "署名",
"no_vault": "金庫が見つかりません。新規作成してください。",
"hd_keychain": "HDキーチェーン",
"vault_password": "金庫のパスワード",
"generate_keychain": "新しいキーチェーンを生成",
"generating": "キーチェーン生成中...",
"create_failed": "金庫の作成に失敗しました。",
"restore_seed": "シードフレーズから復元",
"seed_placeholder": "12語のシードフレーズ",
"account_placeholder": "アカウント番号(デフォルト: 1)",
"restore_keychain": "キーチェーンを復元",
"restoring": "キーチェーン復元中...",
"restore_failed": "シードフレーズが無効か、金庫の作成に失敗しました。",
"deriving_n": "ID導出中",
"import_vault": "金庫ファイルをインポート",
"choose_vault": "金庫ファイルを選択...",
"vault_imported": "金庫をインポートしました。パスワードでロック解除してください。",
"invalid_vault": "無効な金庫ファイルです。",
"write_seed": "シードフレーズを書き留めてください",
"seed_warning": "これがIDを復元する唯一の方法です。これらの単語を書き留めて安全に保管してください。再表示されません。",
"copy_clipboard": "クリップボードにコピー",
"copied": "コピー済み!",
"saved_it": "保存しました",
"vault_locked": "金庫はロックされています。",
"password": "パスワード",
"unlock": "ロック解除",
"deriving_key": "鍵を導出中です。しばらくお待ちください...",
"wrong_password": "パスワードが違います。",
"identities": "ID一覧",
"nickname_placeholder": "新しいIDのニックネーム",
"derive_new": "新しいIDを導出",
"deriving": "導出中...",
"show_seed": "シードフレーズを表示",
"export_vault": "金庫をエクスポート",
"export_password_prompt": "エクスポートの保護パスワードを入力してください:",
"confirm_password": "パスワード確認",
"password_required": "パスワードが必要です。",
"passwords_mismatch": "パスワードが一致しません。",
"export_failed": "エクスポートに失敗しました。",
"cancel": "キャンセル",
"lock_vault": "金庫をロック",
"logout": "ログアウト",
"logout_confirm": "すべての鍵が削除され、ログアウトします。よろしいですか?",
"use": "使用",
"publish": "公開",
"add": "追加",
// Wallet (NWC).
"wallet": "ウォレット",
"wallet_no_wallet": "ウォレットが接続されていません。下に Nostr Wallet Connect URI を貼り付けてください。",
"wallet_add": "ウォレットを追加",
"wallet_add_another": "別のウォレットを追加",
"wallet_add_hint": "Alby Hub、Mutiny、LNbits などの nostr+walletconnect:// URI を貼り付けてください。",
"wallet_alias_placeholder": "別名(任意)",
"wallet_adding": "追加中...",
"wallet_add_failed": "ウォレットを追加できませんでした。URI を確認してください。",
"wallet_remove_confirm": "このウォレット接続を削除しますか?",
"wallet_refresh": "更新",
"wallet_loading_balance": "読み込み中...",
"wallet_sats": "sats",
"wallet_send": "送信",
"wallet_recipient_placeholder": "lnbc... または user@domain",
"wallet_amount_placeholder": "金額 (sats、Lightning アドレスのみ)",
"wallet_comment_placeholder": "コメント(任意)",
"wallet_pay": "支払う",
"wallet_paying": "支払い中...",
"wallet_pay_ok": "支払い完了",
"wallet_pay_failed": "支払い失敗",
"wallet_need_amount": "Lightning アドレスには金額が必要です。",
"wallet_unknown_recipient": "不明な受取人。BOLT11 インボイスまたは Lightning アドレスを使用してください。",
},
"pt": {
"subtitle": "Mensagens Soberanas, Encriptação, Sincronização & Heurísticas",
"login": "entrar",
"requesting": "solicitando...",
"err_no_id": "sem identidade - abra o signer para adicionar uma",
"language": "Idioma",
"theme": "Tema",
"dark": "escuro",
"light": "claro",
"back": "\u2190 voltar",
"feed": "feed",
"compose": "compor",
"messaging": "mensagens",
"settings": "configurações",
"notifications": "notificações",
"no_notifications": "nenhuma notificação ainda",
"about": "sobre",
"connecting": "conectando...",
"loading_translator": "carregando tradutor...",
"show_more": "mostrar mais",
"show_less": "mostrar menos",
"note_not_found": "Nota não encontrada",
"reposted": "repostou",
"loading_thread": "carregando thread...",
"thread_empty": "thread não encontrada",
"replying_to": "respondendo a...",
"reply_not_found": "nota não encontrada",
"notes": "notas",
"follows": "seguindo",
"relays": "relays",
"mutes": "silenciados",
"no_follows": "sem dados de seguidos",
"no_relays": "sem dados de relays",
"no_mutes": "sem dados de silenciados",
"following": "seguindo",
"muted": "silenciados",
"copy": "copiar",
"qr": "qr",
"message": "mensagem",
"loading": "carregando...",
"relay_info": "info do relay",
"relay_fail": "falha ao buscar info do relay",
"new_chat": " | novo chat",
"no_convos": "nenhuma conversa ainda",
"npub_placeholder": "npub ou chave pública hex",
"go": "ir",
"msg_placeholder": "mensagem...",
"send": "enviar",
"dm_notice": "DMs encriptadas requerem a extensão Smesh Signer",
"ratchet": "ratchet",
"relay_leak_warn": "alguns dos relays selecionados podem vazar metadados",
"developed_by": "desenvolvido por:",
"tagline": "Can Youse Paradigm?",
"about_donkey": "A cada hora que você não dá zap, um burro come outro repolho. Você pode impedir isso. \U0001FABE",
"settings_title": "Configurações",
"lang_label": "Idioma da interface",
"theme_label": "Aparência",
"relays_section": "Relays",
"relays_active": "Relays ativos",
"relays_required": "Capacidades necessárias",
"relays_req_nip42": "NIP-42 autenticação",
"relays_req_nip70": "NIP-70 eventos protegidos",
"relays_block_payment": "Bloquear relays pagos",
"relays_block_restrict": "Bloquear relays com escrita restrita",
"relays_blocklist": "Lista de bloqueio",
"relays_blocklist_empty": "(nenhum)",
"relays_no_nip11": "(sem NIP-11)",
"signer": "assinador",
"no_vault": "Nenhum cofre encontrado. Crie um novo.",
"hd_keychain": "Chaveiro HD",
"vault_password": "Senha do cofre",
"generate_keychain": "Gerar Novo Chaveiro",
"generating": "Gerando chaveiro...",
"create_failed": "Falha ao criar cofre.",
"restore_seed": "Restaurar com Frase Semente",
"seed_placeholder": "Frase semente de 12 palavras",
"account_placeholder": "Número da conta (padrão: 1)",
"restore_keychain": "Restaurar Chaveiro",
"restoring": "Restaurando chaveiro...",
"restore_failed": "Frase semente inválida ou falha ao criar cofre.",
"deriving_n": "Derivando identidade",
"import_vault": "Importar Arquivo de Cofre",
"choose_vault": "Escolher Arquivo de Cofre...",
"vault_imported": "Cofre importado. Desbloqueie com sua senha.",
"invalid_vault": "Arquivo de cofre inválido.",
"write_seed": "Anote Sua Frase Semente",
"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.",
"copy_clipboard": "Copiar para Área de Transferência",
"copied": "Copiado!",
"saved_it": "Já Salvei",
"vault_locked": "Cofre está bloqueado.",
"password": "Senha",
"unlock": "Desbloquear",
"deriving_key": "Derivando chave, isso pode levar um minuto...",
"wrong_password": "Senha incorreta.",
"identities": "Identidades",
"nickname_placeholder": "Apelido para nova identidade",
"derive_new": "Derivar Nova Identidade",
"deriving": "Derivando...",
"show_seed": "Mostrar Frase Semente",
"export_vault": "Exportar Cofre",
"export_password_prompt": "Escolha uma senha para proteger o cofre exportado:",
"confirm_password": "Confirmar senha",
"password_required": "Senha obrigatória.",
"passwords_mismatch": "As senhas não coincidem.",
"export_failed": "Falha na exportação.",
"cancel": "Cancelar",
"lock_vault": "Bloquear Cofre",
"logout": "Sair",
"logout_confirm": "Isso apagará todas as chaves e encerrará a sessão. Tem certeza?",
"use": "Usar",
"publish": "Publicar",
"add": "Adicionar",
// Wallet (NWC).
"wallet": "Carteira",
"wallet_no_wallet": "Nenhuma carteira conectada. Cole um URI Nostr Wallet Connect abaixo.",
"wallet_add": "Adicionar Carteira",
"wallet_add_another": "Adicionar outra carteira",
"wallet_add_hint": "Cole um URI nostr+walletconnect:// do Alby Hub, Mutiny, LNbits, etc.",
"wallet_alias_placeholder": "Apelido (opcional)",
"wallet_adding": "Adicionando...",
"wallet_add_failed": "Não foi possível adicionar a carteira. Verifique o URI.",
"wallet_remove_confirm": "Remover esta conexão de carteira?",
"wallet_refresh": "Atualizar",
"wallet_loading_balance": "carregando...",
"wallet_sats": "sats",
"wallet_send": "Enviar",
"wallet_recipient_placeholder": "lnbc... ou user@domain",
"wallet_amount_placeholder": "Valor (sats, apenas para endereço Lightning)",
"wallet_comment_placeholder": "Comentário (opcional)",
"wallet_pay": "Pagar",
"wallet_paying": "Pagando...",
"wallet_pay_ok": "Pago",
"wallet_pay_failed": "Falha no pagamento",
"wallet_need_amount": "Valor obrigatório para endereços Lightning.",
"wallet_unknown_recipient": "Destinatário desconhecido. Use uma fatura BOLT11 ou endereço Lightning.",
},
}