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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add GitHub Action to push translation sources to Crowdin #12580

Merged
merged 1 commit into from
Mar 1, 2023

Conversation

marcusmoore
Copy link
Collaborator

Description

This PR adds the Crowdin GitHub Action to push language source changes to Crowdin.

In detail:

  • If merged, pushes to develop will kick off the included GitHub Action and push any changes in the source translation files (/lang/en/**/*.php as defined in crowdin.yml) to Crowdin.
  • Only new or modified keys will be pushed to Crowdin. Keys that are removed will not be removed from Crowdin.
    • For instance, if /lang/en/auth.php contained a key that is removed in a commit to develop, Crowdin would still contain that key even though it is no longer used in the app.
    • If we would like to remove keys that have been deleted we can add upload_sources_args: '--delete-obsolete' to the with section.
  • Changing a source string (/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.
    • The permissions required for the token is unfortunately broad: Projects > Projects (List, Get, Create, Edit) and Projects > Source files & strings but you can click the option for Granular access and Grant access to selected projects to scope the token to this project.
      image

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 changes These credentials do not match our records. to These 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 馃馃従)

@what-the-diff
Copy link

what-the-diff bot commented Feb 28, 2023

  • Added a new file
  • The name of the workflow is Crowdin Action
  • It will run on push to develop branch only (not master)
  • There's one job called upload-sources-to-crowdin that runs on ubuntu latest image and has two steps: checkout and crowdin push

@snipe
Copy link
Owner

snipe commented Mar 1, 2023

This looks AMAZING - thank you so much @marcusmoore!

@snipe snipe merged commit 70d0347 into snipe:develop Mar 1, 2023
@marcusmoore marcusmoore deleted the feature/crowdin-source-upload branch March 1, 2023 19:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants