Skip to content

refactor: use Crowdin API for translation checks#4

Merged
nvdaes merged 1 commit intonvdaes:l10nfrom
abdel792:l10nImprovements
Apr 26, 2026
Merged

refactor: use Crowdin API for translation checks#4
nvdaes merged 1 commit intonvdaes:l10nfrom
abdel792:l10nImprovements

Conversation

@abdel792
Copy link
Copy Markdown

Description

This PR refactors the checkTranslation.py script to officially utilize the Crowdin API for translation validation. By fetching data directly from the Crowdin API, the script now provides the real-time translation status for all addon components.

Changes

Crowdin API Integration

  • Direct API Queries: The script now connects directly to the Crowdin API, making previous dependencies such as langid and polib no longer necessary.
  • Smart File Mapping: Improved logic to bridge the gap between local files and Crowdin sources (e.g., mapping a local .po request to the .pot source template on the API).
  • Multi-format Support & Priority: For each addon, the script now considers the three possible source files: .md, .po, and .xliff.
  • Dynamic Documentation Selection: When checking documentation, the script compares the translation progress between the .md and .xliff files. It automatically selects the one with the highest translation ratio, with a built-in priority for the XLIFF format.
  • Case-Insensitive Matching: Enhanced search algorithm to ensure source files are correctly identified regardless of casing differences on Crowdin.

Technical Details

  • Dependency Cleanup: Removed reliance on langid and polib as the API provides all necessary metadata and scoring.
  • Output Variables: Standardized output for poScore, mdScore, and translationRatio to ensure seamless integration with existing CI/CD and PowerShell workflows.

Checklist

  • Verified that translation scores are fetched directly via Crowdin API calls.
  • Confirmed the logic for selecting the best translation ratio between .md and .xliff files (priority to XLIFF).
  • Confirmed correct mapping between local file extensions and Crowdin source templates.
  • Verified that the script correctly identifies files despite any casing variations on Crowdin.
  • Confirmed the script returns exit code 0 for scores above 5% and code 1 otherwise.

…lection

- Replace langid and polib dependencies with direct Crowdin API calls.
- Implement smart mapping between local filenames and Crowdin sources.
- Add support for comparing .md and .xliff documentation files.
- Prioritize XLIFF format and select the file with the highest translation ratio.
- Standardize script output for poScore, mdScore, and translationRatio.
@nvdaes
Copy link
Copy Markdown
Owner

nvdaes commented Apr 26, 2026

Thanks @abdel792 . I'll merge this, and later I'll made changes like running pre-commit.

@nvdaes nvdaes merged commit 9b5bf84 into nvdaes:l10n Apr 26, 2026
1 check failed
@abdel792 abdel792 deleted the l10nImprovements branch April 28, 2026 05:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants