Previous Page Next Page

Workshop

The workshop consists of a set of questions and answers designed to solidify your understanding of the material covered in this hour. Try answering the questions before looking at the answers.

Quiz

1.How do you mark a string for translation in Python code?
2.How do you mark a string for translation in a template file?
3.What key in the session does the LocaleMiddleware framework look at to determine the preferred language?
4.Where are localized messages stored if you use the make-messages.py utility at the project level?

Quiz Answers

1.Pass the string to the gettext() function.
2.Add the string to a trans or blocktrans tag in the template.
3.The django_language key.
4.In the locale/language-code/LC_MESSAGES/django.po file.

Previous Page Next Page