Add GitHub Action to push translation sources to Crowdin #12580
Merged
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.
Description
This PR adds the Crowdin GitHub Action to push language source changes to Crowdin.
In detail:
develop
will kick off the included GitHub Action and push any changes in the source translation files (/lang/en/**/*.php
as defined incrowdin.yml
) to Crowdin./lang/en/auth.php
contained a key that is removed in a commit todevelop
, Crowdin would still contain that key even though it is no longer used in the app.upload_sources_args: '--delete-obsolete'
to thewith
section./lang/en/**/*.php
) that has previously been translated and marked as Approved in Crowdin will mark the string as untranslated in once the change is merged to develop (see note below).Adding Secrets
This action requires adding keys to the repository's Actions Secrets Variables (via the
New repository secret
button)CROWDIN_PROJECT_ID
: displayed publicly on Snipe-IT's Crowdin page:67597
CROWDIN_PERSONAL_TOKEN
: Acquired from the personal account settings api page.Projects > Projects (List, Get, Create, Edit)
andProjects > Source files & strings
but you can click the option forGranular access
andGrant access to selected projects
to scope the token to this project.How This Was Tested
To avoid winging it in this repo and accidentally screwing up the existing translations I created a sample repository and Crowdin project to test on that you can view if curious. I copied snipe-it's
/resources/lang
directory into the project in/lang
(Laravel 10's folder structure) and pushed a bunch of commits to confirm the behavior listed above.Updating Sources...
A little more clarification on the note about strings being marked as untranslated:
Taking the key:value
auth.failed:These credentials do not match our records.
as an example and assuming the string is marked as approved in Crowdin. If a subsequent PR gets merged that changesThese credentials do not match our records.
toThese credentials do not match our records!!
the string will be marked as untranslated and require re-approval.Potential Future Improvements
This action only handles pushing source changes to Crowdin but not pulling translations into the app. We can look into using an Action to create pull requests with translation changes on a schedule, when a release is tagged, or manually (check the Triggers section of the Action's docs for details).
Please question any hesitations that pop up. I really don't want to invalid our existing translations (although any mistakes should be able to be reverted in the project's Activity Stream 馃馃従)