Skip to content
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

l10nUtil: add downloadTranslationFile and uploadTranslationFile commands to allow downloading and uploading from Crowdin. #17708

Merged
merged 11 commits into from
Feb 19, 2025

Conversation

michaelDCurran
Copy link
Member

Link to issue number:

None.

Summary of the issue:

Currently, a translator must manually download and upload files from Crowdin. This can take time and is easy to use the wrong settings when importing and exporting.

Description of user facing changes

A translator can now download a file using the NVDA l10nUtil:

l10nUtil downloadTranslationFile <language> <crowdinFilePath> [<localFilePath>]

E.g.

l10nUtil downloadTranslationFile fr userguide.xliff

This will download the file, and preprocess it, avoiding bugs in the Crowdin exporter, including filtering of corrupt target strings.
The translator can then translate the file with Poedit as normal.
The translator can now upload the file back to Crowdin using the NVDA l10nUtil:

l10nUtil uploadTranslationFile <language> <crowdinFilePath> [<localFilePath>] [--old <oldLocalFilePath>] 

E.g.

l10nUtil uploadTranslationFile fr userguide.xliff --old userguide_old.xliff

The --old argument allows you to provide the original downloaded file before it was last translated with Poedit, so that only added / changed translations are uploaded to Crowdin, decreasing the possibility of overriding someone elses work on this language.

Note that the download and upload commands of l10nUtil require a Crowdin auth token. The first time, the token will be asked for. You will need to create a personal access token in your Crowdin settings, ensuring it has the Translations scope at a minimum.
Paste this token into the user prompt. l10nUtil will save this in `/.nvda_crowdin for future use.

Description of development approach

l10nutil.py has new commands that use the Crowdin API.

Testing strategy:

Manual testing of downloading, translating and uploading files for the n-PT (pirate English) language on Crowdin.
Much more testing very much welcome.

Known issues with pull request:

A more automated oauth style UX would be nice where a browser is opened and the auth token is fetched automatically. But at the moment that would involve storing a client secret in the source code which is not possible.

Code Review Checklist:

  • Documentation:
    • Change log entry
    • User Documentation
    • Developer / Technical Documentation
    • Context sensitive help for GUI changes
  • Testing:
    • Unit tests
    • System (end to end) tests
    • Manual testing
  • UX of all users considered:
    • Speech
    • Braille
    • Low Vision
    • Different web browsers
    • Localization in other languages / culture than English
  • API is compatible with existing add-ons.
  • Security precautions taken.

@coderabbitai summary

…nds, that use the Crowdin API. Requires a Crowdin auth token which will be prompted for the first time and stored in ~/.nvda_crowdin
@michaelDCurran michaelDCurran requested a review from a team as a code owner February 18, 2025 02:51
@AppVeyorBot
Copy link

See test results for failed build of commit 9c16ebbbbb

@seanbudd seanbudd merged commit dcf18da into master Feb 19, 2025
5 checks passed
@seanbudd seanbudd deleted the crowdin3 branch February 19, 2025 05:18
@github-actions github-actions bot added this to the 2025.1 milestone Feb 19, 2025
gexgd0419 pushed a commit to gexgd0419/nvda that referenced this pull request Feb 22, 2025
…nds to allow downloading and uploading from Crowdin. (nvaccess#17708)

Currently, a translator must manually download and upload files from Crowdin. This can take time and is easy to use the wrong settings when importing and exporting.

Description of user facing changes
A translator can now download a file using the NVDA l10nUtil:

l10nUtil downloadTranslationFile <language> <crowdinFilePath> [<localFilePath>]
E.g.

l10nUtil downloadTranslationFile fr userguide.xliff
This will download the file, and preprocess it, avoiding bugs in the Crowdin exporter, including filtering of corrupt target strings.
The translator can then translate the file with Poedit as normal.
The translator can now upload the file back to Crowdin using the NVDA l10nUtil:

l10nUtil uploadTranslationFile <language> <crowdinFilePath> [<localFilePath>] [--old <oldLocalFilePath>] 
E.g.

l10nUtil uploadTranslationFile fr userguide.xliff --old userguide_old.xliff
The --old argument allows you to provide the original downloaded file before it was last translated with Poedit, so that only added / changed translations are uploaded to Crowdin, decreasing the possibility of overriding someone elses work on this language.

Note that the download and upload commands of l10nUtil require a Crowdin auth token. The first time, the token will be asked for. You will need to create a personal access token in your Crowdin settings, ensuring it has the Translations scope at a minimum.
Paste this token into the user prompt. l10nUtil will save this in `/.nvda_crowdin for future use.

Description of development approach
l10nutil.py has new commands that use the Crowdin API.
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.

3 participants