Date

Contributing translation to the website

2 Likes · 6.3k Views · 5 minute read · 0 Comments · Website

First of all; thank you for considering contributing to the project! All contributions are very welcome and appreciated ❤️

What you need

  • Github Account
  • Some knowledge of (all will be in the guide):
    • Using Github
    • Working with JSON-files

Step One: Forking

  1. Log into your Github account
  2. Find the P3D-Legacy/pokemon3d.net repository: https://github.com/P3D-Legacy/pokemon3d.net
  3. Click the "Fork"-button on the top right:
  4. Select your user in the popup and wait for it to finish:
  5. You should now see the project "forked" under your username:

Step Two: Editing

  1. Now switch branch to the "develop"-branch:
  2. Browse to the JSON-file, should be under /lang/ (Previously the location was /resources/lang/):

Side notes

  • If your language file is not present send a message in #translation_contribution with a @Website Developer on Discord.
  • If your language is zh_TW or zh_CN you should not edit the cn or tw files these files are overwritten by the files from zh_CN or zh_TW. So edit the the long language code files not the short ones. This only applies to these two languages.
  1. Now click the desired language you would like to edit. Let's do en.json as an example:
  2. Click the pencil/edit button on the top right of the file view:

Are you not familiar with editing JSON files? Jump down in this post for a quick guide on that.

  1. Once you have updated the file you will need to "save" it. Scroll down until you see a "Commit changes" box like this:
  2. You do not have to type a lot here. It already has prefilled "Update xx.json" in the first input there. But if you for example fixed a typo of a word you could type "Fixed typo for xx word" or anything similar to that. Once that is done click the "Commit changes"-button.
  3. Go back to the main page of the repository by clicking the title of the repository:
  4. Here you will see that your repository is ahead of the main repository, let's jump to the next step.

Step Three: Contributing

Now that you have edited the file we need to add these changes to the main repository.

  1. In the repository view of your project (done in the last step), click the "Contribute" button then click on "Open pull request".
  2. You will now see a new page that looks like the image below.
    • First you see the "Title of pull request", sometimes this is prefilled. If not; you could fill this with "Updated XX language" or similar
    • At the bottom, you will see the changes made to the file(s) in your project.
  3. In the middle of the image above you will see the "Create pull request" button, click this when you are done. But if you are not done with the pull request, let's say you want to continue your work at a later point, you would create a draft. Do this by clicking the arrow-down button beside "Create pull request" then click "Create draft pull request".

Now there will be a pull request open for your changes in the main repository. Once someone merges these changes into the project you will have contributed some work to the website! Thank you!

Step Four: More Contributions

If and when there is an update to the files in the future you would need to update your repository. In the main view of your repository click "Fetch upstream" and then "Fetch and merge", this will update your repository to the latest from the main repository.


Editing JSON-files: A quick guide

Important note: For languages with special codes like zh-TW, zh-CN and pt-BR; do not edit the short name json files for example cn.json, tw.json or pt-BR.json, you need to edit the json-files that has an underscore ("_") it its name. For example: zh_CN.json, zh_TW.json or pt_BR.json.

There are many ways to format a JSON file, you could have a key but no value, you could have a key and many sub-keys. But for our translation files, we have made it easy to use and understand for most users.

A JSON file starts with a { and ends with a }. Between these two brackets, there are keys and values formatted like this: "About": "About". Within the first quotation is the key and within the second quotation is the value.

A larger JSON file will have a lot of lines with keys and values like this:

{
	"About": "About",
	"Close": "Close",
	"Edit": "Edit",
	"Name": "Name"
}

So for our translation files, the key is always the same across all the languages, the English translation if you will, this key is referenced in the code of the website and will never change. Do not edit the key, only the value!

If I were to edit the example JSON file above to Norwegian it would look something like this:

{
	"About": "Om",
	"Close": "Lukk",
	"Edit": "Endre",
	"Name": "Navn"
}

And there you can see that I did not change the key, only the value.

If there is at any point you see a word with a colon in front of it, do not edit that word, it is a variable and will be changed by the application. It should look something like this:

{
 "I agree to the :terms and :privacy": "I agree to the :terms and :privacy",
}

And when translated to Norwegian:

{
 "I agree to the :terms and :privacy": "Jeg er enig i :terms og :privacy",
}

Comments (0)

Comment

No comments yet.