metamask-mobile icon indicating copy to clipboard operation
metamask-mobile copied to clipboard

[Feat]: Improve localization workflow such that it allows for branch/PR focused translation

Open desi opened this issue 1 year ago • 0 comments

What is this about?

Currently, translation only happens once changes to the en.json file are merged to main. These changes could include new keys being added or changes to english text. What this means is that there is no way currently to require that translations be in place before the feature goes live. It could make it through translation before being released but there is currently no way to require that we wait for translations.

Scenario

  • GIVEN I am a MM mobile dev
  • WHEN I have a feature that requires translations before release
  • THEN I should be able to work within a BRANCH/PR workflow

Design

N/A

Technical Details

TODO

Threat Modeling Framework

N/A

Acceptance Criteria

  • Github action that allows the developer to add a label to the PR which will trigger a push to crowdin
  • Github action that will periodically check the status of the translations and when 100% translated will pull down a PR against the branch for the developer to merge.
  • Merging to main should push up the latest in source and translations
  • Once the original PR with the label is merged to main a github action should trigger which removes the associated branch from crowdin
    • Developers should not ever have to login to crowdin
  • If a developer chooses not to go through the branch flow for translations then on merge to main with changes to the locales/en file then it should push the source and translations to crowdin's main branch.
  • A github action should exist which triggers periodically to check for any translations on main. This will not have the same 100% translation completion requirement because we want to pull any translations we have as soon as we have them in the case of main.

Functionality for future PR:

  • Once the localization PR is merged to the branch a github action should trigger that deletes the localization branch for that branch and removes the label from that merged PR (so its not picked up again)
  • Add proper triggers for actions (all are manually trigger right now while we test)
  • Remove TODOs

Testing Plan:

Use case 1 (feature branch requires translation):

  • Developer creates a branch for feature which requires translations
  • They add keys or change english source and when they are ready for translations to be done they create a PR and add the label “ready-for-translation”
  • Manually trigger crowdin-branch-pr-ready-for-translation.yml ON THE BRANCH
  • Confirm branch created in crowdin with just the untranslated keys (plus any untranslated ones from main or any translated but not merged keys from main) - This is where we could get confusion on the BLEND side.
  • Wait for translations (Desi will likely have to talk to BLEND to let them know what we are doing and get these translations done so that we can finish out the test)
  • Manually trigger the translation check before translations complete (confirm no translation PR created)
  • Manually trigger the translation check after translations complete (confirm PR created off this branch)
  • Merge translation PR into branch, manually remove label (later PR will do this automatically), manually delete localization branch for this branch (later PR will do this automatically)
  • Merge PR for feature to main
  • Manually trigger crowdin-upload-both-sources-translations.yml and ensure translations show on main in crowdin.
  • Manually trigger crowdin-branch-cleanup.yml and make sure the branch is removed from crowdin

Use Case 2 (main branch translations):

  • Developer is working just normally and adds new keys or changes english version in some way.
  • They go through normal PR flow once they merge to main
  • Manually trigger crowdin-upload-both-sources-translations.yml
  • Confirm new keys are on main
  • Work with Blend to get one thing translated so we can see crowdin-pull-branch-pr-completed-translations.yml pull down the partial translation
  • Manually trigger crowdin-pull-branch-pr-completed-translations.yml and check the localization PR has the translations.

BLOCKER

  • Mobile repo must be updated to use newest version of the crowdin github action (see crowdin-sandbox ) For reference of the action id to change to.

Stakeholder review needed before the work gets merged

  • [X] Engineering (needed in most cases)
  • [ ] Design
  • [x] Product
  • [x] QA (automation tests are required to pass before merging PRs but not all changes are covered by automation tests - please review if QA is needed beyond automation tests)
  • [ ] Security
  • [ ] Legal
  • [ ] Marketing
  • [ ] Management (please specify)
  • [ ] Other (please specify)

References

desi avatar Feb 11 '24 18:02 desi