Skip to content

Contribute a Translation via GitHub Codespaces

Stefan Seifert edited this page Apr 28, 2023 · 4 revisions

Overview

This page describes how to contribute a translation to a brdgm.me Solo Helper Application. It uses the Ark Nova Solo Helper as example, but works for all applications found in GitHub.

This page describes an advanced approach using GitHub Codespaces, which allows you to prepare a translation, test it in the running application and then provide a pull request to contribute it back to the main code base. All this works in your browser.

Create GitHub Account

If you do not have a GitHub account, go to https://github.com and create one via "Sign up" - it's free!

github-signup

Fork the GitHub Repository

Go to the code repository of the brdgm.me application, e.g. https://github.com/brdgm/ark-nova-solo-helper and click the "Fork" button and confirm to create the fork in the next screen. You now have a copy of the repository in your personal GitHub profile and can work on it.

github-fork-repository

Create Codespace

On your fork of the repository, create a new codespace via "Code -> Codespaces -> Create codespace on develop". It make take a bit when you open it the first time.

github-codespace-create

Identify the English master file

Each Solo Helper Application has an English master file located inside the code repository at src/locales/en.json. Open it in the tree browser.

github-codespace-open-file

Save the file under a new file name

Via "File -> Save As..." save the file in the same directory using a new name. Save it with the 2-letter ISO 639-1 language code of the target language (e.g. "fr.json" for french).

github-codespace-file-save-as

Translate the file

Translate all strings in the JSON file into the target language. Changes are saved automatically.

See JSON Translation File Semantics for details on the conventions used in the file.

Preview your changes

If you want to preview the changes, enter the following command in the "Terminal" window at the bottom of the screen:

npm run serve

This can take a bit of time to start up.

github-codespace-edit-run-serve

A message will be displayed asking you to open the application from port 8080 in a browser, confirm by clicking the "Open in Browser" button. It may take a bit until it shows the application in the new browser window. You may have to reload it.

github-codespace-open-browser

Then you can update the translation and verify them inside of the application at the same time. Changes in the JSON files are saved automatically. You need to refresh the browser window to see the changes in effect.

github-codespace-preview

Submit your Translation as Pull Request

Once you are happy with your translation, follow these steps to create a pull request.

On the bottom of the screen, click on the "develop" branch name, and choose "+ Create new branch..." from the list that pops up.

github-codespace-create-branch

On the left side, click on the "Source Control" button, and provide a commit message in the text box, then click the "Commit" button.

github-codespace-commit

You may get a message that there are now stages changes to commit. Click on "yes" or "always" to include the new translated file you created.

github-codespace-commit-stage

Then, click on the "Publish Branch" button (this uploads you changes to your copy of the GitHub repository).

githug-codespace-publish-branch

Finally, create a pull request with your changes and click on the "Create" button.

github-codespace-create-pr