Repository navigation
完善翻译技能:MTool 工作流、术语校验与 Unity 文本审计 - #6
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 58870812ae
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| line = line.strip() | ||
| if not line or line.startswith("//") or line.startswith("#") or "=" not in line: | ||
| continue | ||
| key, value = line.split("=", 1) | ||
| key = key.strip() | ||
| if key in entries: | ||
| duplicates.append(key) | ||
| entries[key] = value.strip() |
There was a problem hiding this comment.
Preserve edge whitespace while parsing runtime entries
When either candidate contains keys or values with leading/trailing whitespace, stripping the entire line and both fields changes the runtime entry before comparison. The existing generator explicitly allows edge-whitespace keys and emits fields verbatim, so a change such as " foo" to "foo", or a value-only whitespace change, can be reported as unchanged or as a false duplicate even though the runtime files differ.
Useful? React with 👍 / 👎.
| parsed = parse_table(table, source_file, offset, source_hash) | ||
| if parsed: | ||
| parsed["signature"] = signature.decode("utf-8", errors="replace") | ||
| results.append(parsed) |
There was a problem hiding this comment.
Deduplicate overlapping signature matches
When a table header is ID,Name,Description, both the ID,Name and Name,Description signatures match the same header. Because extract_table rewinds each match to the beginning of that line, this appends the same table twice with different offsets, doubling every occurrence and producing incorrect audit counts and identities.
Useful? React with 👍 / 👎.
| end = min(len(data), offset + 65536) | ||
| null = data.find(b"\x00\x00\x00\x00", offset, end) | ||
| if null != -1: | ||
| end = null |
There was a problem hiding this comment.
Avoid silently truncating embedded tables at 64 KiB
For an embedded CSV larger than 65,536 bytes whose terminator lies beyond this window, the extractor cuts the table at an arbitrary byte boundary but still parses and reports all complete rows before the cutoff as a valid table. Large item or dialogue tables therefore yield silently incomplete occurrence manifests rather than being fully scanned or explicitly rejected as truncated.
Useful? React with 👍 / 👎.
更新概览
本 PR 将参考技能中可复用的翻译、校验和运行时审计流程整合到
ainiee-translate与unity-text-locator。共修改 15 个文件,新增 1,586 行、删除 5 行。ainiee-translate的变动MTool 扁平 JSON 工作流
ainiee_translate.mtool,覆盖输入检查、技术项直通、分组拆分、结果验证、进度统计、译文合并和最终键验证。cache.json只能由主代理串行写入。术语候选与词典导出
extract_terms.py,从 AiNieecache.json只读提取术语候选,归一化读音、片假名和短标签,并按出现频率筛选。resource_hints,不直接进入词典。curate_terms.py,把人工确认的译名导出为 AiNiee{src,dst,info}格式。源文感知质量检查(source-aware QA)
audit_translation.py,按text_index对照源文与译文,检查重复、缺失和额外记录。apply_repairs.py。修复项必须提供replacement,且expected_before必须与当前译文完全一致。expected_before会被拒绝,不直接覆盖原始译文或共享缓存。unity-text-locator的变动Unity 内嵌 CSV 发现
extract_embedded_csv.py,扫描sharedassets*.assets和 AssetBundle 中的内嵌 CSV 数据。original_flat -> translation映射。AutoTranslator 运行时差异
diff_autotranslator_files.py,对比两份_PreTranslated.txt,统计新增、删除、修改和未变化条目,并输出样例。blocked并返回非零退出码。保留的安全边界
text_index拒绝、源文指纹校验和失败时非零退出均保持不变。验证结果
skill-creator/quick_validate.py:两个技能均通过。git diff --check通过;未发现固定个人路径或常见 GitHub 凭据。