-
Notifications
You must be signed in to change notification settings - Fork 5
Adding a new language
Add language to webcdi/static/json/instruments.json
(this is the data that populates the researcher_UI_instrument table)
Add csv with items to webcdi/cdi_form_csv
. Remember to format the name of the csv correctly
Add meta json file to webcdi/cdi_forms/form_data
. This is used to describe the form sections
Add scoring json to webcdi/cdi_forms/scoring
. This is used to describe scoring to be done. See https://github.com/langcog/web-cdi/wiki/Scoring for more information.
Create internationalization / localization files in webcdi/locale
Run django-admin.py makemessages -l fr
to create .po files (example for french)
Translate every individual line in the .po file (see french for example)
Run django-admin.py compilemessages -l fr
to compile .po file into .mo file
In cdi_forms>templates>cdi_forms>cdi_base.html
, add the appropriate datepicker library. This is just to use the right calendar, and may be added later
Example (french):
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.7.1/locales/bootstrap-datepicker.fr.min.js"></script>
Useful: https://stackoverflow.com/questions/3191664/list-of-all-locales-and-their-short-codes#3191729
In cdi_forms>templates>cdi_forms>cdi_base.html
, you may also want to add the appropriate time format (around line 80)
Example: if ("{{language}}" == 'French (Quebec)') {var due_date_local = moment(due_date_utc).local().locale('fr_CA').format("lll");}
In webcdi/settings.py
find LANGUAGES and add the relevant language, for example ('fr-ca', _('French (Quebec)')),
.
Add the language to cdi_forms_csv>choice_options.csv
with appropriate translations.
Run webcdi/manage.py makemigrations
. This will produce a new migration in cdi_forms/migrations
. Edit the new file to include updateChoiceModel
. Use migration 0056_choices_choice_set_nl.py
as a template.
Run webcdi/manage.py migrate
. This will popluate the choice fields.
Edit cdi_forms/static/data_csv/word_categories.csv
and add the relevant forms and translations.
On server, run webcdi/manage.py populate_instrument -l Spanish
. This will add a row to the researcher_UI_instrument table. File can be found at webcdi/researcher_UI/management/commands/populate_instrument.py
On server, run webcdi/manage.py populate_scoring -l Spanish
. This will add rows to the research_ui_instrumentscore
table. File can be found at webcdi/research_UI/management/commands/populate_scoring.py
On server, run webcdi/manage.py populate_items -l Spanish
. This will add rows to the cdi_forms_instrument_forms table. File can be found at webcdi/cdi_forms/management/commands/populate_items.py
Run webcdi/manage.py collectstatic
to add the new static files (namely word_categories.csv) so that the results tables show for respondents.
Allocate permissions to this instrument through the admin interface (home -> Users -> (pick User) -> Researchers section -> “Instruments this researcher has access to”
Review forms on webcdi to make sure everything looks OK