refactor: modernize translation workflow and integrate language mappings#5
Open
abdel792 wants to merge 3 commits intonvdaes:l10nfrom
Open
refactor: modernize translation workflow and integrate language mappings#5abdel792 wants to merge 3 commits intonvdaes:l10nfrom
abdel792 wants to merge 3 commits intonvdaes:l10nfrom
Conversation
This commit significantly improves the synchronization process between Crowdin and the local repository, with a primary focus on the integration of the 'languageMappings.json' file originally implemented by @nvdaes. Key changes include: - Integrated languageMappings.json: Now used as the source of truth for Crowdin-specific language identifiers during the upload process. - Added langCodes.py: Implemented a symmetrical Python helper to map Crowdin export codes back to standard NVDA directory names (e.g., handling 'es-ES' -> 'es', 'ar-SA' -> 'ar_SA', 'sr-CS' -> 'sr'). - Fixed API Pagination: Updated checkTranslation.py to handle recursive API calls. This ensures all languages (including those beyond the initial 25 results, such as Turkish) are correctly processed and scored. - Enhanced crowdinSync.ps1: * Implemented bi-directional synchronization to upload local legacy files (.po and .md) when remote translation quality is low. * Added comprehensive debug and success logging for documentation conversions (XLIFF/MD) and scoring. * Improved decision logic for readme.md updates based on score comparison. Special thanks to @nvdaes for the mapping implementation.
- Add instructions for requesting developer access to the Crowdin project via the NVDA add-on mailing list. - Document required GitHub Secrets (crowdinAuthToken and CROWDIN_PROJECT_ID). - List necessary scripts and workflow files for the translation infrastructure. - Clarify the initial export and periodic download processes.
Owner
|
Thanks so much @abdel792.
I think that we can use the with_fetch_all also to check translation score,
for readability. I'll test it.
El mar, 28 abr 2026 a las 7:57, abdel792 ***@***.***>)
escribió:
… refactor: modernize translation workflow and integrate language mappings
Summary
This PR consolidates and optimizes the translation synchronization
workflow between Crowdin and NVDA add-on repositories. It focuses on
technical stability, proper handling of all supported languages, and
bi-directional synchronization to prevent data loss.
Key Improvements 1. Robust Language Mapping
- *Centralized Configuration:* Integrated
.github/scripts/languageMappings.json to manage Crowdin-specific
language codes.
- *New Helper Script (langCodes.py):* Added a dedicated Python script
to handle the reverse mapping (Crowdin IDs to local NVDA directory
structure). This ensures regional variants (e.g., es-ES → es, ar-SA →
ar_SA, sr-CS → sr) are handled correctly without manual intervention
or directory duplicates.
2. Fixed API Pagination in checkTranslation.py
- *Issue:* The previous implementation only retrieved the first 25
results from the Crowdin API.
- *Fix:* Rewrote the script to use recursive pagination (looping
through offsets). This ensures that languages appearing later in the
alphabet (like Turkish tr) are now correctly tracked and scored.
3. Intelligent Bi-directional Sync
- *PO & Documentation Fallback:* Updated crowdinSync.ps1 to check the
quality of remote translations via the API.
- *Local Upload:* If Crowdin has no translation or the quality is
below the defined threshold, the script automatically uploads the local
legacy .po or .md files to Crowdin. This populates the Crowdin project
immediately with existing local work.
- *Smart Selection:* Logic improved to compare MD and XLIFF scores,
selecting the best available source to update the local readme.md.
4. Enhanced Debugging & Logging
- Added explicit DEBUG, SUCCESS, and WARNING messages throughout the
PowerShell workflow to provide clear logs in GitHub Actions, making it
easier to monitor the scoring and conversion process.
Technical Changes
- *Modified:* .github/scripts/crowdinSync.ps1
- *Modified:* .github/scripts/checkTranslation.py (added pagination
and US English logging)
- *Added:* .github/scripts/langCodes.py (symmetrical mapping helper)
------------------------------
*Special thanks to @nvdaes <https://github.com/nvdaes> for the initial
mapping implementation and @seanbudd <https://github.com/seanbudd> /
@wmhn1872265132 <https://github.com/wmhn1872265132> for their valuable
feedback.*
------------------------------
You can view, comment on, or merge this pull request online at:
#5
Commit Summary
- 1f8eb84
<1f8eb84>
refactor: modernize translation workflow and integrate language mappings
File Changes
(3 files <https://github.com/nvdaes/AddonTemplate/pull/5/files>)
- *M* .github/scripts/checkTranslation.py
<https://github.com/nvdaes/AddonTemplate/pull/5/files#diff-683942c70f68b6ae663839ea1b78d926b09d12a4c65604e4944ca3c28df95610>
(133)
- *M* .github/scripts/crowdinSync.ps1
<https://github.com/nvdaes/AddonTemplate/pull/5/files#diff-19dc7f0385f3c83ac3b059c383b00fa1411f5f82741cec98602d54e84c7df1dd>
(107)
- *A* .github/scripts/langCodes.py
<https://github.com/nvdaes/AddonTemplate/pull/5/files#diff-f849b7e0ee403d76c65c1c9efa364b3f930ffb3542c9509f18fa82f56570a2fc>
(60)
Patch Links:
- https://github.com/nvdaes/AddonTemplate/pull/5.patch
- https://github.com/nvdaes/AddonTemplate/pull/5.diff
—
Reply to this email directly, view it on GitHub
<#5>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADYTVZGXVOQIHLR3BHUNZWL4YBB4BAVCNFSM6AAAAACYI3PYOCVHI2DSMVQWIX3LMV43ASLTON2WKOZUGM2DAOJTGEYTGNA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
refactor: modernize translation workflow and integrate language mappings
Summary
This PR consolidates and optimizes the translation synchronization workflow between Crowdin and NVDA add-on repositories. It focuses on technical stability, proper handling of all supported languages, and bi-directional synchronization to prevent data loss.
Key Improvements
1. Robust Language Mapping
.github/scripts/languageMappings.jsonto manage Crowdin-specific language codes.langCodes.py): Added a dedicated Python script to handle the reverse mapping (Crowdin IDs to local NVDA directory structure). This ensures regional variants (e.g.,es-ES→es,ar-SA→ar_SA,sr-CS→sr) are handled correctly without manual intervention or directory duplicates.2. Fixed API Pagination in
checkTranslation.pytr) are now correctly tracked and scored.3. Intelligent Bi-directional Sync
crowdinSync.ps1to check the quality of remote translations via the API..poor.mdfiles to Crowdin. This populates the Crowdin project immediately with existing local work.readme.md.4. Enhanced Debugging & Logging
DEBUG,SUCCESS, andWARNINGmessages throughout the PowerShell workflow to provide clear logs in GitHub Actions, making it easier to monitor the scoring and conversion process.Technical Changes
.github/scripts/crowdinSync.ps1.github/scripts/checkTranslation.py(added pagination and US English logging).github/scripts/langCodes.py(symmetrical mapping helper)Special thanks to @nvdaes for the initial mapping implementation and @seanbudd / @wmhn1872265132 for their valuable feedback.