opencommit
opencommit copied to clipboard
fix(commitlint): Support i18n translations in consistency prompt generation
trafficstars
Problem
When generating .opencommit-commitlint configuration with OCO_LANGUAGE=zh_TW (or other non-English languages), the LLM was generating consistency examples in English instead of using the translated content from the corresponding i18n JSON files (e.g., zh_TW.json).
Solution
- Modified
GEN_COMMITLINT_CONSISTENCY_PROMPTfunction to accept translation parameter - Added explicit instructions and reference examples to guide LLM to use correct language
Changes
src/modules/commitlint/prompts.ts: Added translation parameter and reference examplessrc/modules/commitlint/config.ts: Pass translation object to prompt generation
Testing
OCO_LANGUAGE=zh_TW OCO_PROMPT_MODULE=@commitlint oco commitlint force