UNPKG

unity-find-fault

Version:

A tool to find fault in unity project.

32 lines 1.39 kB
import fg from "fast-glob"; import fs from "fs-extra"; import path from "path"; import { PrefabParser } from "../unity/PrefabParser.js"; import { toolchain } from "../toolchain.js"; export class I18NChecker { async check() { const prefabRoot = path.join(toolchain.opts.projectRoot, 'Assets'); const prefabs = await fg('**/*.prefab', { cwd: prefabRoot }); for (const prefab of prefabs) { const file = path.join(prefabRoot, prefab); const content = await fs.readFile(file, 'utf-8'); if (content.includes('m_Script: {fileID: 11500000, guid: a83dcfc8fc830b24b9ce0578a0236c03, type: 3}')) { const arr = content.split(PrefabParser.SectionHeader); for (const a of arr) { if (a.includes('m_Script: {fileID: 11500000, guid: a83dcfc8fc830b24b9ce0578a0236c03, type: 3}')) { const mchs = a.matchAll(/- GameLang: (\w+)/g); const langs = []; for (const mch of mchs) { langs.push(mch[1]); } if (!langs.includes('INA')) { console.log(file); break; } } } } } } } //# sourceMappingURL=I18NChecker.js.map