Commit b3e6a54
committed
Overhaul translation system for improved accuracy and stability
This commit improves the documentation translation system by simplifying the translation process, reducing context overhead, and making translation results more stable.
System Prompt Changes:
* Convert system prompt from Chinese to English for better AI comprehension
* Replace 4-step translation process with single-pass approach to improve output stability and reduce context
* Remove target content comparison logic to simplify process and reduce translation context
* Restructure prompt with clear baseline requirements and optional additional requirements section
Smart Terms Filtering:
* Only include terms that actually appear in source content
* Support multi-language terms mapping (English, Chinese, Russian)
Anchor Link Protection:
* Introduce anchor preprocessing mechanism to prevent translation corruption of markdown anchor links
* Replace anchors with numbered placeholders (__ANCHOR_N__) before translation
* Restore original anchors after translation completion
* Handle escaped underscores in anchor IDs to maintain compatibility with MDX processor
Title Translation:
* Replace i18n.title-based translation with built-in title translation mapping table
* Implement automatic title correction through prompt enhancement when titles exist in mapping table
* Extract first-level headings from content and apply predefined translations when available
* Fallback to AI translation for unmapped titles while preserving consistency for common terms
Frontmatter Cleanup:
* Remove i18n fields from translated documents
Content Processing:
* Add support for copy-only files configuration, with all files under apis/ directory set to copy-only by default
Technical Changes:
* Upgrade model from gpt-4o-mini to gpt-4.1-mini
* Update language constants from Chinese to English descriptions
* Add title translation mapping table for common sections1 parent 5bd0705 commit b3e6a54
2 files changed
+313
-129
lines changed
0 commit comments