Editing Translations and the Welcome Page

293 views
Skip to first unread message

Susanna

unread,
Jul 1, 2021, 11:29:40 AM7/1/21
to oTree help & discussion
Hi everyone,

Is there a way to edit translations of validation messages and other texts?

I changed my app's language to German and noticed that not everything that should be translated is translated - instead, many messages are still in English. I can obviously define error messages for form field validation myself, but the same is not true for some other texts. 

I would also like to customise the field label on the Welcome page (in English "Please enter your participant label", in German "Bitte geben Sie Ihr Teilnehmerlabel ein". Is there a way to do so?

Many thanks,
Susanna

Chris @ oTree

unread,
Jul 1, 2021, 11:56:18 AM7/1/21
to oTree help & discussion
It works fine for me. The room input label page is already in german. can you share your full settings file?

Chris @ oTree

unread,
Jul 1, 2021, 12:05:17 PM7/1/21
to oTree help & discussion
also try making a new project, and set the language code to 'de' there.

Susanna

unread,
Jul 1, 2021, 12:51:44 PM7/1/21
to oTree help & discussion
I tried making a new project but the problem persists.

Just to clarify, I have two separate problems/questions:

1. I would like to customise the text on the input label page. The translation from "Please enter your participant label" into German "Bitte geben Sie Ihr Teilnehmerlabel ein" works fine. However, I would like to change the word "Teilnehmerlabel" to something else ("Lab ID") because my lab requires this. 

2. Some error messages and other texts are not translated into German but are in English. For example, on the room input label page the error message on entering an incorrect label is "Invalid entry; try again".

Similarly, if I click "Next" without filling in a field on a page (e.g. in a Quiz app), the error message is "Please select one of these options". This I can obviously customise with {field_name}_error_message, but this is not the case with the first example. 



Here is the code in my settings.py:

from os import environ

SESSION_CONFIGS = [

    dict(

        name='full',

        app_sequence=['instructions', 'questions_short', 'zeroes_short', 'sliders_short',

                      'zeroes', 'questions', 'sliders', 'finish'],

        num_demo_participants=2,

    ),  

    dict(

        name='test',

        app_sequence=['zeroes'],

        num_demo_participants=2,

    )

]

ROOMS = [

    dict(

        name='test1',

        display_name='Test Room 1',

        participant_label_file='participant_hiwi_id.txt',

        # use_secure_urls=True

    )

]

SESSION_CONFIG_DEFAULTS = dict(

    real_world_currency_per_point=1.00, participation_fee=6.00, doc=""

)


PARTICIPANT_FIELDS = ['treatment']

SESSION_FIELDS = []


# ISO-639 code

# for example: de, fr, ja, ko, zh-hans

LANGUAGE_CODE = 'de'


# e.g. EUR, GBP, CNY, JPY

REAL_WORLD_CURRENCY_CODE = 'EUR'

USE_POINTS = False


ADMIN_USERNAME = 'admin'

ADMIN_PASSWORD = environ.get('OTREE_ADMIN_PASSWORD')

DEMO_PAGE_INTRO_HTML = """ """

OTREE_AUTH_LEVEL = 'STUDY'


Thank you!
Susanna

Chris @ oTree

unread,
Jul 1, 2021, 12:58:57 PM7/1/21
to Susanna, oTree help & discussion
Can you show screenshots of the English error messages? Note that some error messages are shown by your browser, not oTree. If you use a German browser they will be in German. 

Sent from my phone

On Jul 1, 2021, at 10:51 AM, Susanna <s.e.ha...@gmail.com> wrote:

I tried making a new project but the problem persists.
--
You received this message because you are subscribed to the Google Groups "oTree help & discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to otree+un...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/otree/934cbe0d-2092-4acd-8702-4c9d7a23a652n%40googlegroups.com.

Chris @ oTree

unread,
Jul 1, 2021, 1:08:49 PM7/1/21
to oTree help & discussion
Anyway, to customize the room input label page, you can use this project: https://github.com/oTree-org/custom-room-welcome-page

Susanna

unread,
Jul 1, 2021, 1:13:17 PM7/1/21
to oTree help & discussion
Thank you very much for the link!

I have attached the screenshots of the English error messages. Thanks for pointing out that the error mesages could be shown by the browser; I tried with Chrome/Safari/Firefox and changed the language to German but this did unfortunately not help.
Label page error.png
Quiz error.png

Chris @ oTree

unread,
Jul 1, 2021, 4:07:18 PM7/1/21
to oTree help & discussion
The "invalid entry; try again" is because a few sentences have not been translated to German. If you provide a German translation I could put it into an upcoming release.

As for the other message, I am not sure. Those messages are shown by the browser but I'm not sure how the browser decides the language. It's either according to the browser language or the operating system language. I tried searching "html client-side form validation language" but didn't get a clear answer.

Chris @ oTree

unread,
Jul 1, 2021, 4:08:30 PM7/1/21
to oTree help & discussion

Susanna

unread,
Jul 4, 2021, 12:59:53 PM7/4/21
to oTree help & discussion
I added a few translations - they should be visible under "Update django.po - Susanna Hassinen".

Many thanks for your help!
Reply all
Reply to author
Forward
0 new messages