TUD translations
This page describes two approaches to updating the Time Use Diary tool to support a new language. Both approaches involve editing a JSON file and replacing English text with the correct translations.
In this approach, the user is provided with a link to the file that needs editing.
- Open the provided url in a browser
- On the top toolbar, click on the Edit icon to edit file.
- Go through the file line by line, replacing the text on the right of double colons with the appropriate translation.
- Once you have finished editing, scroll to the bottom of the page to the "Commit changes" section.
- In the text box, type a short description of what you have done. For example:
Added Spanish translations
- Select create new branch and enter the name of the branch. For example:
task-add-spanish-translations
- Click on the Propose changes button. This will redirect to a page where you can open a pull request.
- Click on the Create pull request button.
At this point the changes are ready for review by the team.
In this approach, the user will create a new folder and add a translation.json
file to the folder. The name of the folder is unique to each language and corresponds to the ISO Language Code. For example, Swedish translations will be put in a folder named sv.
-
Visit http://www.lingoes.net/en/translator/langcode.htm and look up the code of the language you want to translate.
-
On Github, navigate to https://github.com/openlattice/chronicle-web/tree/develop/src/core/i18n
-
On the toolbar, click on Add file button and select Create new file from the drop down list.
-
In the top input text box, enter the name of the folder followed immediately by a
/
(There should be no space before the/
). This should create a new folder and reveal an empty text box to the right. -
Type
translation.json
in the text box and press Enter. -
Copy English translations to the new page.
- Open https://github.com/openlattice/chronicle-web/blob/develop/src/core/i18n/en/translation.json in a new tab
- On the toolbar click on the Raw button.
- Select all the text in the opened page. Right click and select copy. For Mac users, this can be achieved by pressing command + A followed by command + C on the keyboard. Windows users can press Ctrl + A followed by Ctrl + C
-
Paste the copied text to the new page edit window.
-
Follow steps 3 - 8 in Approach 1 above to provide the correct translations and create a pull request.
Please note the following:
- Most of the entries in the translation.json file have a
key:value
format. When editing, you should only provide translation for thevalue
text. For example:
Here you would only need to translate the lines: "Thank you for taking the time..." and "To get started, ..."
-
If the
value
is a list, ensure the order of the translated list exactly matches the original. For example: In the translated version, the first item will correspond to "Monday" and the last item will correspond to "Sunday". -
Some of the text that needs to be translated contains {{ }}. You shouldn't modify any text between these double brackets. This text will eventually be replaced with actual values when a participant fills out the survey. For example: In this case, {{time}} will be replaced with the end time of the previously selected activity and should appear in your translated version.
-
In the event of a nested object, only translate the values that are on the right of the
:
For example: Here you would only need to translate "Attending school/childcare", "Napping/sleeping" etc