Add GitHub Action for non-blocking translation validation on PRs #7025
+375
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This PR adds automated translation validation that checks for common translation issues in ARB files. As requested in #5903, the validation is non-blocking and serves as informational annotations on translation pull requests rather than blocking CI/CD.
Problem
Translation files can have several common issues that are difficult to catch manually:
These issues affect consistency and quality but shouldn't necessarily block translation updates, as some may be intentional based on language requirements.
Solution
Added a GitHub Action workflow that automatically validates translations and posts results as PR comments:
Validation Script (
.github/scripts/validate_translations.py): Python script that validates:app_nameshould always be"Open Food Facts"(not translated)Nutri-Score,NOVA,Open Food Facts,Open Products Facts,Open Beauty Facts, andOpen Pet Food Factsshould be preservedGitHub Workflow (
.github/workflows/translation-validation.yml):.arb) are modified in PRsNon-Blocking Behavior
The workflow always succeeds but posts informative comments on PRs with validation results:
This approach allows:
Files Added
.github/workflows/translation-validation.yml- GitHub Action workflow that runs on translation PRs.github/scripts/validate_translations.py- Python validation scriptBenefits
Example Output
The workflow posts a detailed report directly on the PR, making it easy for reviewers to spot issues:
Future Enhancements
The validation script makes it easy to add new validation rules as needed. The modular structure allows adding checks for:
Fixes #5903
Original prompt
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.