Skip to content

Commit

Permalink
Merge branch 'release/1.0.24'
Browse files Browse the repository at this point in the history
  • Loading branch information
felliott committed Jan 30, 2018
2 parents 9883c9a + b9cf187 commit 94b81f4
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 20 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,5 @@ env
/scripts/consent_forms/*csv
/scripts/consent_forms/**
!/scripts/consent_forms/test.csv
*.pyc
.python-version
15 changes: 13 additions & 2 deletions app/components/isp-consent-form/consentText.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "isp",
"version": "1.0.23",
"version": "1.0.24",
"description": "International Situations Project (ISP)",
"private": true,
"directories": {
Expand Down
26 changes: 11 additions & 15 deletions scripts/README.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,30 @@
# Adding/updating translations
To update the translations for a given locale, use
[`scripts/add_translation.py`](https://github.com/CenterForOpenScience/isp/blob/develop/scripts/add_translation.py)
Python library requirements for script are found in [requirements.txt](https://github.com/CenterForOpenScience/isp/blob/develop/requirements.txt)
You may need to run `pip install requirements.txt`

To update the translations for a given locale, use [`scripts/add_translation.py`](https://github.com/CenterForOpenScience/isp/blob/develop/scripts/add_translation.py). Python library requirements for these scripts are found in [requirements.txt](https://github.com/CenterForOpenScience/isp/blob/develop/requirements.txt). You may need to run `pip install requirements.txt`.

1. Run the command `python add_translation.py`, this is the main script to be used. `add_translation.py` uses both [`scripts/format_translations.py`](https://github.com/CenterForOpenScience/isp/blob/develop/scripts/format_translations.py) and [`scripts/consent_form_json.py`](https://github.com/CenterForOpenScience/isp/blob/develop/scripts/consent_form_json.py).

2. `add_translation.py` will access the main google drive folder that has all the translations and list the names of directories that correspond to each language. The folder id is stored at `TRANSLATION_FOLDER_ID`.

3. Enter the desired language ID from the list shown.

2. `add_translation.py` will first download the CSV file needed for the translation from the google drive folder. Currently, each language has its own google drive folder. The ISP project main folder can be located [`here`](https://drive.google.com/drive/u/0/folders/0BxGwKGgJtw4WYVpJVllsMk84Wms). All language translation folders are stored under `/Samples/Translations/`.
3. `add_translation.py` will first download the CSV file needed for the translation from the google drive folder. Currently, each language has its own google drive folder. The ISP project main folder can be located [`here`](https://drive.google.com/drive/u/0/folders/0BxGwKGgJtw4WYVpJVllsMk84Wms). All language translation folders are stored under `/Samples/Translations/`.

- The language translation should be in a 2-column format, where column 1 is the JSON key name, and column 2 is the translated text. This file will be located under scripts directory.
```
Key,German Translation
flag.chooseLanguage,Bitte wählen Sie eine Sprache
```

3. Once file is downloaded, `add_translation.py` will execute [`scripts/format_translations.py`] to generate `<language>.json`.

4. Review the error messages (if exist) from running the `add_translation`.
4. Once the file is downloaded, `add_translation.py` will execute `scripts/format_translations.py` to generate `<language>.json`.

5. `add_translation.py` will download the consent form translation which can be one or more csv files. The file(s) will be located under [`scripts/consent_forms`] directory. Finally, `add_translation.py` will execute [`scripts/consent_form_json.py`] that combine the contents of the files automatically into `consent.json`.
5. Review the error messages (if exist) from running the `add_translation`.

6. `add_translation.py` will download the consent form translation which can be one or more csv files. The file(s) will be located under [`scripts/consent_forms`](https://github.com/CenterForOpenScience/isp/blob/develop/scripts/consent_forms/) directory. Finally, `add_translation.py` will execute [`scripts/consent_form_json.py`](https://github.com/CenterForOpenScience/isp/blob/develop/scripts/consent_form_json.py/), which will combine the contents of the files automatically into `consent.json`.

5. If a locale does not yet exist, run `ember generate locale <code>`, using either a two or four language country
code (like `en` or `en-US`) that corresponds to items from the [language picker](https://github.com/abought/isp/blob/a5159baae38756990e5f59c6be1b0bc9e64e25be/app/components/language-picker/countries.js#L636)
7. If a locale does not yet exist, run `ember generate locale <code>`, using either a two or four language country code (like `en` or `en-US`) that corresponds to items from the [language picker](https://github.com/CenterForOpenScience/isp/blob/1.0.23/app/components/language-picker/countries.js#L686).

6. If the language is already in the List of locales that ember-i18n knows about by default: https://github.com/jamesarosen/ember-i18n/tree/master/addon/config, then don't make changes to the config.js file. You can also safely delete this file. Use it if you need to override behavior for a locale or define behavior for a locale that Ember-I18n doesn't know about. An example of config.js file should like this:
8. If the language is already in the list of locales that ember-i18n [knows about by default](https://github.com/jamesarosen/ember-i18n/tree/master/addon/config), then don't make changes to the config.js file. You can also safely delete this file. Use it if you need to override behavior for a locale or define behavior for a locale that Ember-I18n doesn't know about. An example of config.js file should like this:
```
export default {
rtl: false,
Expand All @@ -38,8 +34,8 @@ code (like `en` or `en-US`) that corresponds to items from the [language picker]
}
};
```
7. Manually add the content of `<language>.json` to `locales/<language-country-code>/translations.js`. Remember that `translations.js` should start with `export default` followed by the new content then a `;`.
9. Manually add the content of `<language>.json` to `locales/<language-country-code>/translations.js`. Remember that `translations.js` should start with `export default` followed by the new content, and end with a semicolon.

8. Manually add the content of `consent.json` to the existing [`app/components/isp-consent-form/consentText.js`](app/components/isp-consent-form/consentText.js). Remember to add a comment (e.g. `//finnish`) before the content, to differentiate it from other languages.
10. Manually add the content of `consent.json` to the existing [`app/components/isp-consent-form/consentText.js`](https://github.com/CenterForOpenScience/isp/blob/1.0.23/app/components/isp-consent-form/consentText.js). Remember to add a comment (e.g. `//finnish`) before the content to differentiate it from other languages.

9. Verify that the locale displays appropriately, including any RTL settings required.
11. Verify that the locale displays appropriately, including any RTL settings required.
6 changes: 4 additions & 2 deletions scripts/add_translation.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@
e. Rename json file to "client_secret.json"
2. In the scripts directory, create a 'credentials' folder and add the client_secret.json file
3. Run the script.
4. Move the content of the generated files as described in the Readme.md file.
a. If the OAuth login complains about not being able to find the redirect uri, rerun the script
with the --noauth_local_webserver argument. It will open a new workflow that will give you a
token you can copy and paste into your terminal window.
4. Move the content of the generated files as described in the README.md file.
The first time you run this script, you may get a message saying that you need to authorize specific APIs for use
with this project. The message will provide instructions needed to complete this process; wait several minutes
Expand Down

0 comments on commit 94b81f4

Please sign in to comment.