/* Copyright (C) 2025 QuantumNous This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import assert from 'node:assert/strict'; import { readFileSync } from 'node:fs'; import test from 'node:test'; const localeCodes = ['zh', 'zh-TW', 'en', 'fr', 'ru', 'ja', 'ko', 'vi', 'th']; const paypalKeys = [ 'PayPal 设置', '订阅 CHECKOUT.ORDER.APPROVED、PAYMENT.CAPTURE.COMPLETED、PAYMENT.CAPTURE.PENDING 和 PAYMENT.CAPTURE.DECLINED 事件', 'Sandbox 测试环境', '最低充值单位', '结算币种', '换算汇率', '更新 PayPal 设置', '隐藏 PayPal 支付', '开启后拒绝 PayPal 新订单,但仍处理已发起订单的回跳、Webhook 和主动对账', '管理员未开启 PayPal 充值!', 'PayPal 充值成功', 'PayPal 支付处理中,请稍后查看充值记录', '已取消 PayPal 支付', 'PayPal 支付确认失败,请稍后重试', '敏感信息不会显示', 'PayPal 订单创建中,请稍后重试', '汇率来源', 'manual', 'open_exchange_rates', 'manual_fallback', '报价已过期,请重新获取', '报价剩余', '汇率模式', '手工汇率', '准实时汇率', '汇率保护加点(基点)', '当前市场汇率', '暂无可用的市场汇率快照', '汇率刷新成功', '已确认手工兜底汇率', '立即刷新汇率', '确认手工兜底汇率', 'PayPal 报价已更新,请重新确认', '支付服务费', '平台承担', '实际支付', '用户承担支付服务费', '支付服务费比例(%)', '手续费策略版本', '默认由平台承担;启用后将按配置比例向用户展示并收取支付服务费', '承担方', '用户承担', '费率', '操作人', '获取手续费策略失败', '手续费比例必须在有效范围内', '手续费策略已被其他管理员更新,请重新确认', '最后更新人', 'PayPal 结算', '基础金额', 'PayPal 实际手续费', 'PayPal 净收金额', '结算状态', '待回填', '已完整', '不可获取', ]; test('PayPal UI strings are translated in every supported locale', () => { for (const code of localeCodes) { const locale = JSON.parse( readFileSync(new URL(`./locales/${code}.json`, import.meta.url), 'utf8'), ).translation; for (const key of paypalKeys) { assert.equal( typeof locale[key] === 'string' && locale[key].trim().length > 0, true, `${code} is missing translation: ${key}`, ); } } });