-
Notifications
You must be signed in to change notification settings - Fork 9
feat(ci): optimize CI workflows and i18n translation system #204
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Create auto-gen-i18n.js script for automated translation - Support dynamic language loading from lib/config/language-config.ts - Add comprehensive CLI argument parsing with short/long options - Include help system with usage examples and supported languages - Add new pnpm scripts: i18n:translate, i18n:translate:full, i18n:translate:dry, i18n:translate:help - Update .gitignore to allow the new script - Update ESLint config to ignore the translation script - Use MyMemory translation API with intelligent content filtering - Support incremental and full translation modes with dry-run preview
…o-remove functionality - Add compare_keys() method for numerical baseline comparison against English - Add remove_extra_keys() method with dry-run support for safe key removal - Display quantitative differences as 0, +N (extra), -N (missing) format - Support detailed breakdown showing separate missing/extra key counts - Add new pnpm scripts: i18n:compare, i18n:compare:details, i18n:remove-extra, i18n:remove-extra:dry - Enable intelligent key management with preview and validation modes
- Simplify CI test logic, remove complex bash file matching (40+ lines → direct pnpm test) - Add timeout protection to all CI jobs (5-10 min limits) - Fix i18n translation API calls and Chinese language mapping (zh-CN → zh-Hans) - Remove dangerous translate:full functionality to preserve existing translations - Standardize all workflow scripts to use pnpm commands consistently - Ensure only missing keys are translated, protecting manual translation improvements Addresses workflow complexity and translation quality issues
- Remove i18n-validation job from CI workflow - Remove i18n checks from final status validation - Translation issues now handled by dedicated auto-i18n workflow - Prevents translation inconsistencies from blocking code merges
- Update Chinese language codes to use API-compatible format (zh-CN, zh-TW) - Replace incorrect email with project contact license@iflabx.com - Enhance rate limiting with exponential backoff for better API reliability - Increase base delay from 100ms to 200ms to reduce API pressure Addresses Copilot review suggestions for better API integration.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
- Remove gitignore restrictions on scripts/ directory for easier development - Delete unused scripts: labels-reset.sh, lint-unused.js, security-vulnerability-demo.js, test_dify_file_flow.py - Keep only essential scripts: auto-gen-i18n.js, i18n-refactor-helper.py, validate-i18n-consistency.py
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR optimizes CI/CD workflows and internationalization (i18n) translation system to improve reliability and maintainability. The changes simplify complex CI logic, fix translation API issues, and enhance workflow separation of concerns.
- Simplified CI test execution by removing complex file matching logic in favor of direct
pnpm test - Enhanced i18n translation system with fixed API integration and new automation capabilities
- Replaced browser confirmation dialogs with reusable ConfirmDialog components across admin interfaces
Reviewed Changes
Copilot reviewed 14 out of 15 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
.github/workflows/ci.yml |
Simplified test logic, added timeouts, removed i18n validation from CI pipeline |
.github/workflows/auto-i18n-translation.yml |
New dedicated workflow for automated translation updates |
scripts/auto-gen-i18n.js |
New translation script with MyMemory API integration and improved error handling |
scripts/i18n-refactor-helper.py |
Added key comparison and extra key removal functionality |
package.json |
Added new i18n npm scripts for translation management |
| Admin components | Replaced window.confirm() with consistent ConfirmDialog usage |
| Translation files | Updated with new confirmation dialog keys |
Comments suppressed due to low confidence (1)
scripts/i18n-refactor-helper.py:43
- The comment in the PR description mentions updating Chinese mapping from 'zh-CN': 'zh' to 'zh-CN': 'zh-Hans' for clarity, but this line appears to be in a fallback configuration. Consider adding a comment explaining why 'zh-Hans' is used here versus other mappings.
if not match:
Update on Copilot Review SuggestionsThanks for the review suggestions! Here's the status of each recommendation: ✅ Implemented Manually
✅ Ready to Accept
❌ Should Not Accept
🧹 Additional Cleanup
All changes have been tested and validated. The i18n automation workflow is now more robust and API-compatible. |
What & Why
What: Optimize CI/CD workflows and internationalization (i18n) translation system
Why: Simplify overly complex CI logic, fix translation API issues, and improve workflow reliability
Fixes #203
Pre-PR Checklist
Run these:
pnpm type-checkpnpm format:checkpnpm lint(existing issues unrelated to changes)pnpm build(verified locally, skipped for PR creation)pnpm i18n:check(now handled by separate workflow)Type
Changes Made
🚀 CI/CD Workflow Improvements
pnpm test🌐 i18n Translation System Enhancements
'zh-CN': 'zh'to'zh-CN': 'zh-Hans'for claritytranslate:fullto protect existing manual translationspnpmcommands consistentlyauto-i18n-translation.ymlautomatically handles translation updates📋 Code Quality & Maintenance
Workflow Logic
CI Workflow (
.github/workflows/ci.yml)Purpose: Validate code quality and prevent regressions
i18n Workflow (
.github/workflows/auto-i18n-translation.yml)Purpose: Automate translation updates
messages/en-US.jsonchanges → Clean extra keys → Translate missing keys only → Create PRImpact
Testing