From 9957a65ae67fc21ef9077a1c8306421a744959cc Mon Sep 17 00:00:00 2001 From: Alex Lewin Date: Mon, 13 Jan 2025 17:32:51 -0400 Subject: [PATCH] fix: merge locales from legacy gateway app into router --- apps/router/src/languages/ca.json | 14 ++++- apps/router/src/languages/de.json | 38 +++++++++++++- apps/router/src/languages/es.json | 17 +++++- apps/router/src/languages/fr.json | 14 ++++- apps/router/src/languages/hu.json | 14 ++++- apps/router/src/languages/it.json | 38 +++++++++++++- apps/router/src/languages/ja.json | 14 ++++- apps/router/src/languages/ko.json | 22 +++++++- apps/router/src/languages/pt.json | 19 ++++++- apps/router/src/languages/ru.json | 14 ++++- apps/router/src/languages/zh.json | 16 +++++- scripts/merge-locales.js | 86 +++++++++++++++++++++++++++++++ 12 files changed, 294 insertions(+), 12 deletions(-) create mode 100644 scripts/merge-locales.js diff --git a/apps/router/src/languages/ca.json b/apps/router/src/languages/ca.json index 7694d263b..c14930c81 100644 --- a/apps/router/src/languages/ca.json +++ b/apps/router/src/languages/ca.json @@ -481,7 +481,8 @@ "pubkey": "Clau pública", "network": "Xarxa", "block-height": "Alçada del bloc", - "synced-to-chain": "Sincronitzat a la Cadena" + "synced-to-chain": "Sincronitzat a la Cadena", + "card_header": "ID de Node Lightning" }, "withdraw-card": { "address-label": "La teva adreça:", @@ -535,5 +536,16 @@ "title": "Edita {{type}}", "url-label": "URL" } + }, + "deposit-card": { + "bitcoin-deposit": "Dipòsit de Bitcoin", + "card_header": "Dipòsit Bitcoin", + "confirmations": "Confirmacions:", + "header": "Dipòsit de Bitcoin a la Federació", + "receiving-address": "Adreça de recepció", + "required": "requerit", + "sentence-one": "Dipòsit a l'adreça o escaneja el codi QR", + "transaction-id": "ID de transacció", + "create-pegin-address": "Crea adreça Peg-in" } } diff --git a/apps/router/src/languages/de.json b/apps/router/src/languages/de.json index 93fbc8533..e93370834 100644 --- a/apps/router/src/languages/de.json +++ b/apps/router/src/languages/de.json @@ -481,7 +481,8 @@ "pubkey": "Pubkey", "network": "Netzwerk", "block-height": "Blockhöhe", - "synced-to-chain": "Synchronisiert mit Kette" + "synced-to-chain": "Synchronisiert mit Kette", + "card_header": "Lightning-Knoten-ID" }, "withdraw-card": { "address-label": "Ihre Adresse:", @@ -535,5 +536,40 @@ "title": "Bearbeiten {{type}}", "url-label": "URL" } + }, + "address-label": "Ihre Adresse:", + "address-placeholder": "Geben Sie Ihre BTC-Adresse ein", + "amount-label": "Betrag (sats):", + "amount-placeholder": "Gib den Betrag in Sats ein", + "card-header": "Bitcoin abheben", + "close": "Schließen", + "confirm-withdraw": "Abhebung bestätigen", + "error": "Fehler", + "error-address": "Betrag oder Adresse dürfen nicht leer sein", + "error-amount": "Der Betrag darf nicht leer oder gleich null sein.", + "error-request": "Abheben-Anfrage fehlgeschlagen", + "request-from": "Beantragte Abhebung von", + "requested-withdrawal": "Beantragte Abhebung", + "to": "zu", + "total_bitcoin": "Gesamt-Bitcoin:", + "transaction-sent": "Transaktion gesendet!", + "view": "Ansicht", + "view-it-on": "Ansicht auf", + "withdraw": "Abheben", + "withdraw-all": "Alle abheben", + "withdrawal-created": "Abhebung erstellt.", + "withdrawal-created-description": "Bitte überprüfen Sie Ihre Transaktionshistorie", + "withdrawal-history": "Auszahlungsverlauf", + "your-transaction": "Ihre Transaktions-ID:", + "deposit-card": { + "bitcoin-deposit": "Bitcoin Einzahlung", + "card_header": "Bitcoin einzahlen", + "confirmations": "Bestätigungen:", + "header": "Bitcoin-Einzahlung an die Föderation", + "receiving-address": "Empfangsadresse", + "required": "erforderlich", + "sentence-one": "Zahle an die Adresse oder scanne den QR-Code", + "transaction-id": "Transaktions-ID", + "create-pegin-address": "Peg-in-Adresse erstellen" } } diff --git a/apps/router/src/languages/es.json b/apps/router/src/languages/es.json index 63c80a7c2..f05c10219 100644 --- a/apps/router/src/languages/es.json +++ b/apps/router/src/languages/es.json @@ -481,7 +481,8 @@ "pubkey": "Clave pública", "network": "Red", "block-height": "Altura de Bloque", - "synced-to-chain": "Sincronizado con la Cadena" + "synced-to-chain": "Sincronizado con la Cadena", + "card_header": "ID de Nodo Lightning" }, "withdraw-card": { "address-label": "Tu dirección:", @@ -535,5 +536,19 @@ "title": "Editar {{tipo}}", "url-label": "URL" } + }, + "card_header": "saldo de eCash", + "sentence": "Denominado en Sats", + "your-balance": "Tu saldo de eCash en esta federación:", + "deposit-card": { + "bitcoin-deposit": "Depósito de Bitcoin", + "card_header": "Depositar Bitcoin", + "confirmations": "Confirmaciones:", + "header": "Depósito de Bitcoin a la Federación", + "receiving-address": "Dirección de Recepción", + "required": "requerido", + "sentence-one": "Deposita en la dirección o escanea el código QR", + "transaction-id": "ID de transacción", + "create-pegin-address": "Crear dirección Peg-in" } } diff --git a/apps/router/src/languages/fr.json b/apps/router/src/languages/fr.json index 681688b76..d2029a301 100644 --- a/apps/router/src/languages/fr.json +++ b/apps/router/src/languages/fr.json @@ -481,7 +481,8 @@ "pubkey": "Clé publique", "network": "Réseau", "block-height": "Hauteur de bloc", - "synced-to-chain": "Synchronisé à la Chaîne" + "synced-to-chain": "Synchronisé à la Chaîne", + "card_header": "ID de nœud Lightning" }, "withdraw-card": { "address-label": "Votre adresse :", @@ -535,5 +536,16 @@ "title": "Modifier {{type}}", "url-label": "URL" } + }, + "deposit-card": { + "bitcoin-deposit": "Dépôt Bitcoin", + "card_header": "Déposer des Bitcoin", + "confirmations": "Confirmations :", + "header": "Dépôt Bitcoin à la Fédération", + "receiving-address": "Adresse de réception", + "required": "exigé", + "sentence-one": "Déposez à l'adresse ou scannez le code QR", + "transaction-id": "ID de transaction", + "create-pegin-address": "Créer une adresse Peg-in" } } diff --git a/apps/router/src/languages/hu.json b/apps/router/src/languages/hu.json index 8bc19abcf..067b4fe38 100644 --- a/apps/router/src/languages/hu.json +++ b/apps/router/src/languages/hu.json @@ -481,7 +481,8 @@ "pubkey": "Publikus kulcs", "network": "Hálózat", "block-height": "Blokk magasság", - "synced-to-chain": "Szinkronizálva a láncra" + "synced-to-chain": "Szinkronizálva a láncra", + "card_header": "Villámcsomópont azonosító" }, "withdraw-card": { "address-label": "Az Ön címe:", @@ -535,5 +536,16 @@ "title": "Szerkesztés {{type}}", "url-label": "URL" } + }, + "deposit-card": { + "bitcoin-deposit": "Bitcoin Betét", + "card_header": "Bitcoin betét", + "confirmations": "Megerősítések:", + "header": "Bitcoin befizetés a Szövetséghez", + "receiving-address": "Fogadó cím", + "required": "kötelező", + "sentence-one": "Fizess az címre, vagy olvasd be a QR kódot.", + "transaction-id": "Tranzakciós azonosító", + "create-pegin-address": "Hozzon létre Peg-in címet" } } diff --git a/apps/router/src/languages/it.json b/apps/router/src/languages/it.json index faa272997..19991ecf0 100644 --- a/apps/router/src/languages/it.json +++ b/apps/router/src/languages/it.json @@ -481,7 +481,8 @@ "pubkey": "Chiave pubblica", "network": "Rete", "block-height": "Altezza del blocco", - "synced-to-chain": "Sincronizzato alla Catena" + "synced-to-chain": "Sincronizzato alla Catena", + "card_header": "ID de Nodo Lightning" }, "withdraw-card": { "address-label": "Il tuo indirizzo:", @@ -535,5 +536,40 @@ "title": "Modifica {{type}}", "url-label": "URL" } + }, + "address-label": "Tu dirección:", + "address-placeholder": "Введите ваш btc-адрес", + "amount-label": "Montant (sats) :", + "amount-placeholder": "Ingresa la cantidad en sats", + "card-header": "Retirar Bitcoin", + "close": "Chiudi", + "confirm-withdraw": "Confirmar Retiro", + "error": "Erro", + "error-address": "L'importo o l'indirizzo non possono essere vuoti", + "error-amount": "El monto no puede estar vacío ni ser igual a cero", + "error-request": "Solicitud de retiro fallida", + "request-from": "Retiro Solicitado de", + "requested-withdrawal": "Retiro Solicitado", + "to": "à", + "total_bitcoin": "Total Bitcoin:", + "transaction-sent": "Transacción Enviada!", + "view": "Vista", + "view-it-on": "Véalo en", + "withdraw": "Retirar", + "withdraw-all": "Retirar todo", + "withdrawal-created": "Retiro creado.", + "withdrawal-created-description": "Si prega di controllare la cronologia delle transazioni", + "withdrawal-history": "Historique des retraits", + "your-transaction": "Tu ID de transacción:", + "deposit-card": { + "bitcoin-deposit": "Bitcoin Einzahlung", + "card_header": "Depositar Bitcoin", + "confirmations": "Confirmaciones:", + "header": "Bitcoin Einzahlung in die Föderation", + "receiving-address": "Dirección de Recepción", + "required": "requis", + "sentence-one": "Depósito a la dirección o escanea el código QR", + "transaction-id": "ID de transacción", + "create-pegin-address": "Crear dirección Peg-in" } } diff --git a/apps/router/src/languages/ja.json b/apps/router/src/languages/ja.json index a415f4112..9696447bc 100644 --- a/apps/router/src/languages/ja.json +++ b/apps/router/src/languages/ja.json @@ -481,7 +481,8 @@ "pubkey": "公開鍵", "network": "ネットワーク", "block-height": "ブロックの高さ", - "synced-to-chain": "チェーンに同期済み" + "synced-to-chain": "チェーンに同期済み", + "card_header": "ライトニングノードID" }, "withdraw-card": { "address-label": "あなたの住所:", @@ -535,5 +536,16 @@ "title": "{{type}}を編集する", "url-label": "URL" } + }, + "deposit-card": { + "bitcoin-deposit": "ビットコイン入金", + "card_header": "ビットコインを入金する", + "confirmations": "確認事項:", + "header": "ビットコインの連邦への入金", + "receiving-address": "受取先住所", + "required": "必要な", + "sentence-one": "アドレスに入金するか、QRコードをスキャンしてください。", + "transaction-id": "取引ID", + "create-pegin-address": "ペグインアドレスを作成する" } } diff --git a/apps/router/src/languages/ko.json b/apps/router/src/languages/ko.json index 2a3165390..a6ca2e0eb 100644 --- a/apps/router/src/languages/ko.json +++ b/apps/router/src/languages/ko.json @@ -481,7 +481,8 @@ "pubkey": "공개키", "network": "네트워크", "block-height": "블록 높이", - "synced-to-chain": "체인에 동기화됨" + "synced-to-chain": "체인에 동기화됨", + "card_header": "라이트닝 노드 ID" }, "withdraw-card": { "address-label": "당신의 주소:", @@ -535,5 +536,24 @@ "title": "{{type}} 편집", "url-label": "URL" } + }, + "bitcoin-deposit": "비트코인 예금", + "card_header": "비트코인 입금", + "confirmations": "확인:", + "receiving-address": "수신주소", + "required": "필수의", + "sentence-one": "해당 주소로 입금하거나 QR코드를 스캔하세요.", + "transaction-id": "거래 ID", + "create-pegin-address": "페그인 주소 생성", + "deposit-card": { + "bitcoin-deposit": "비트코인 입금", + "card_header": "비트코인 입금", + "confirmations": "확인 사항:", + "header": "연합에 비트코인 입금", + "receiving-address": "수신 주소", + "required": "필수", + "sentence-one": "주소로 입금하거나 QR 코드를 스캔하세요.", + "transaction-id": "거래 ID", + "create-pegin-address": "페그인 주소 생성" } } diff --git a/apps/router/src/languages/pt.json b/apps/router/src/languages/pt.json index fe2b52b7b..f6afd6677 100644 --- a/apps/router/src/languages/pt.json +++ b/apps/router/src/languages/pt.json @@ -481,7 +481,8 @@ "pubkey": "Chave pública", "network": "Rede", "block-height": "Altura do Bloco", - "synced-to-chain": "Sincronizado com a Corrente" + "synced-to-chain": "Sincronizado com a Corrente", + "card_header": "ID do Nó Lightning" }, "withdraw-card": { "address-label": "O seu endereço:", @@ -535,5 +536,21 @@ "title": "Editar {{type}}", "url-label": "URL" } + }, + "connect": "Conectar 🚀", + "connect-federation-button": "Adicionar Federação", + "connection-string-placeholder": "Cole o código de convite da federação", + "heading": "Conecte-se a uma federação usando um código de convite", + "information-bar-text": "O número de federações que você pode conectar é limitado a uma. A conexão com várias federações será suportada em breve.", + "deposit-card": { + "bitcoin-deposit": "Depósito de Bitcoin", + "card_header": "Depositar Bitcoin", + "confirmations": "Confirmações:", + "header": "Depósito de Bitcoin para a Federação", + "receiving-address": "Endereço de Recebimento", + "required": "obrigatório", + "sentence-one": "Deposite no endereço ou escaneie o código QR", + "transaction-id": "ID da Transação", + "create-pegin-address": "Criar Endereço Peg-in" } } diff --git a/apps/router/src/languages/ru.json b/apps/router/src/languages/ru.json index 4d38a19ae..671a423f4 100644 --- a/apps/router/src/languages/ru.json +++ b/apps/router/src/languages/ru.json @@ -481,7 +481,8 @@ "pubkey": "Публичный ключ", "network": "Сеть", "block-height": "Высота блока", - "synced-to-chain": "Синхронизировано с цепью" + "synced-to-chain": "Синхронизировано с цепью", + "card_header": "Идентификатор узла Lightning" }, "withdraw-card": { "address-label": "Ваш адрес:", @@ -535,5 +536,16 @@ "title": "Редактировать {{type}}", "url-label": "URL" } + }, + "deposit-card": { + "bitcoin-deposit": "Депозит Биткойн", + "card_header": "Внести биткойн", + "confirmations": "Подтверждения:", + "header": "Депозит биткойнов в Федерацию", + "receiving-address": "Адрес получения", + "required": "требуется", + "sentence-one": "Переведите на адрес или отсканируйте QR-код.", + "transaction-id": "Идентификатор транзакции", + "create-pegin-address": "Создать адрес Peg-in" } } diff --git a/apps/router/src/languages/zh.json b/apps/router/src/languages/zh.json index b543b4c4e..951823129 100644 --- a/apps/router/src/languages/zh.json +++ b/apps/router/src/languages/zh.json @@ -481,7 +481,8 @@ "pubkey": "公钥", "network": "网络", "block-height": "区块高度", - "synced-to-chain": "同步到链条" + "synced-to-chain": "同步到链条", + "card_header": "闪电节点 ID" }, "withdraw-card": { "address-label": "您的地址:", @@ -535,5 +536,16 @@ "title": "编辑{{type}}", "url-label": "网址" } + }, + "deposit-card": { + "bitcoin-deposit": "比特币存款", + "card_header": "存入比特币", + "confirmations": "确认:", + "header": "比特币存款到联邦", + "receiving-address": "接收地址", + "required": "必需的", + "sentence-one": "存款到该地址或扫描二维码", + "transaction-id": "交易ID", + "create-pegin-address": "创建 Peg-in 地址" } -} +} \ No newline at end of file diff --git a/scripts/merge-locales.js b/scripts/merge-locales.js new file mode 100644 index 000000000..8b72f13bc --- /dev/null +++ b/scripts/merge-locales.js @@ -0,0 +1,86 @@ +const fs = require('fs'); +const path = require('path'); + +const GATEWAY_LOCALES_PATH = path.join( + __dirname, + '../apps/router/src/gateway-ui/languages' +); +const ROUTER_LOCALES_PATH = path.join( + __dirname, + '../apps/router/src/languages' +); + +// Get all JSON files from a directory +const getLocaleFiles = (dir) => { + return fs + .readdirSync(dir) + .filter((file) => file.endsWith('.json')) + .map((file) => ({ + name: file, + path: path.join(dir, file), + })); +}; + +// Read and parse JSON file +const readJsonFile = (filePath) => { + const content = fs.readFileSync(filePath, 'utf-8'); + return JSON.parse(content); +}; + +// Write JSON file +const writeJsonFile = (filePath, data) => { + fs.writeFileSync(filePath, JSON.stringify(data, null, 2), 'utf-8'); +}; + +// Deep merge two objects +const deepMerge = (target, source) => { + const output = { ...target }; + + for (const key in source) { + if (source.hasOwnProperty(key)) { + if (source[key] instanceof Object && key in target) { + output[key] = deepMerge(target[key], source[key]); + } else if ( + typeof target[key] === 'string' && + typeof source[key] === 'string' + ) { + // If both are strings, use the existing value (no-op) + // output[key] = target[key]; + } else { + output[key] = source[key]; + } + } + } + + return output; +}; + +// Merge locales +const mergeLocales = () => { + const gatewayLocales = getLocaleFiles(GATEWAY_LOCALES_PATH); + const routerLocales = getLocaleFiles(ROUTER_LOCALES_PATH); + + gatewayLocales.forEach((gatewayLocale) => { + if (gatewayLocale.name === 'index.ts') return; + + const routerLocale = routerLocales.find( + (rl) => rl.name === gatewayLocale.name + ); + if (!routerLocale) { + console.log(`No matching router locale found for ${gatewayLocale.name}`); + return; + } + + const gatewayContent = readJsonFile(gatewayLocale.path); + const routerContent = readJsonFile(routerLocale.path); + + // Deep merge the contents + const mergedContent = deepMerge(routerContent, gatewayContent); + + writeJsonFile(routerLocale.path, mergedContent); + console.log(`✅ Merged ${gatewayLocale.name}`); + }); +}; + +// Run the merge +mergeLocales();