Strumenti Utente

Strumenti Sito


Questa è una vecchia versione del documento!

My tips with oTree

Override oTree localization

Problem: I have a session in few days, and my language's localization is not complete. I have already contributed new strings, but too late for them being included in time in a new release.

Solution: it is easy to provide additional localization strings in Django. Just follow these steps:

  1. Inside your project root, create a locale/LANG/LC_MESSAGES folder, replacing LANG with your language code (e.g. it for Italian).
  2. Download the strings file (django.po) in the desired language to that folder. If your language is not supported, download another one.
  3. Edit the file with poedit or with a simple text editor. Change/update everything applicable.
  4. Compile it to a .mo file (this can be done from inside poedit with FileCompile to MO), saved in the same folder.
  5. Inside your, add a line with the following content:

LOCALE_PATHS = ['locale']

That's it! The strings will be shown next time you start oTree - including in Heroku (remember to git add and git commit the file).

Using labels

When a room is set up for participant labels, I should _not_ distribute the auto-generated links available under Participant-specific URLs in the session page. These will result in player.participant.label being None, and in new participants using the provided labels to get an error message when the room is full.

otree_mytips.1599731521.txt.gz · Ultima modifica: 2020/09/10 11:52 da pietro