Skip to content

Absorb `@gitterhq/translations` npm module (including history)

This MR takes the whole https://gitlab.com/gitlab-org/gitter/gitter-translations repository and moves it into modules/translations including commit history.

Why?

Every community contribution to translations brings unnecessary overhead on the Gitter team:

  1. review the change
  2. npm link the translation and test it (if it's more complex)
  3. release @gitterhq/translations module
  4. upgrade this npm module in the webapp project (another MR that needs to be reviewed)

On top of that the translations are notorious for getting out of sync https://gitlab.com/gitlab-org/gitter/gitter-translations#generating-keys-and-placeholders

However, there is no other client for this module than webapp. The original reason for the separation was (I assume) the fact that webapp had a closed source, but we still welcomed translations from the community.

How?

Since the vast majority of the commits are contributions from community members, it is critical that we keep the history and not squash the commits into one with my name on it.

  1. roughly follow this gist to move everything in gitter-translations repo to modules/translations subfolder

    git filter-branch --tree-filter 'mkdir -p /tmp/gitter; mv * /tmp/gitter; mkdir -p modules/translations; mv /tmp/gitter/* modules/translations/' --tag-name-filter cat --prune-empty -- --all
  2. then add the gitter-translations repo as a remote to webapp (assuming both repos are in the same parent directory)

    git remote add translations ../gitter-translations
    git fetch translations
  3. then rebase all the translations on webapp develop branch

    git co develop
    git co -b absorb-translations-with-history translations/master
    git rebase develop
  4. at this stage there were a couple of rebase conflicts (no idea why) I resolved them but then at the end had to create 3273ff06 to make sure that the modules/translations is identical to the master branch of gitter-translations

  5. make webapp use the subfolder as translations module 5dcad4e8 and add translations to eslint and prettier ignore files

Testing

  1. checkout this branch absorb-translations-with-history
  2. test multiple translations according to the links mentioned in https://gitlab.com/gitlab-org/gitter/gitter-translations#generating-keys-and-placeholders

Note: The auto generating of translations placeholders is causing nodemon to restart the webapp because it notices the change in modules/translation. This behaviour is only showing in development and it's not an issue. I've used it to generate all the missing keys f9184598.

Next steps

Edited by Tomas Vik (OOO back on 2024-08-12)

Merge request reports