/** * i18n测试用例 */ import fs from 'node:fs'; import { readdir, readFile, writeFile } from 'node:fs/promises'; import test from 'node:test'; import assert from 'node:assert'; import common from '../common.mjs'; import I18N from '../i18n.mjs'; /* //根据模板文件生成默认语言包 test('Init test', async (t) => { const i18n = new I18N(); const res = await i18n.init(); assert.ok(res); }); */ //根据语言包生成对应语言的html test('Build test', async (t) => { const i18n = new I18N(); const res = await i18n.build(); assert.ok(res); }); /* test('Lang file content get test', async (t) => { const i18n = new I18N(); let langFiles = await i18n.getLangFiles('en-us'); const langJson = await readFile(i18n.langDir + langFiles[0], { encoding: 'utf8' }); if (langJson) { let langData = JSON.parse(langJson); for (const key in langData) { console.log(key); } } assert.ok(langJson); }); */