From: Рустам Кашапов Date: Thu, 2 Oct 2014 16:40:46 +0000 (+0400) Subject: i18n support and Russian language translation is added. X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=6ae2d5ec48ed12ad1c2f090be9c3c25c443a68f4;p=django_quiz.git i18n support and Russian language translation is added. --- diff --git a/.gitignore b/.gitignore index 31d02e5..ca4c436 100644 --- a/.gitignore +++ b/.gitignore @@ -13,4 +13,4 @@ build* /.coveragerc /coverage_html_report/ /htmlcov/ -/uploads/ \ No newline at end of file +/uploads/ diff --git a/essay/models.py b/essay/models.py index 9f0c5d1..102e68a 100644 --- a/essay/models.py +++ b/essay/models.py @@ -1,3 +1,4 @@ +from django.utils.translation import ugettext as _ from quiz.models import Question @@ -19,4 +20,5 @@ class Essay_Question(Question): return unicode(self.content) class Meta: - verbose_name = "Essay style question" + verbose_name = _("Essay style question") + verbose_name_plural = _("Essay style questions") diff --git a/multichoice/locale/ru/LC_MESSAGES/django.mo b/multichoice/locale/ru/LC_MESSAGES/django.mo new file mode 100644 index 0000000..0832d42 Binary files /dev/null and b/multichoice/locale/ru/LC_MESSAGES/django.mo differ diff --git a/multichoice/locale/ru/LC_MESSAGES/django.po b/multichoice/locale/ru/LC_MESSAGES/django.po new file mode 100644 index 0000000..3a1deab --- /dev/null +++ b/multichoice/locale/ru/LC_MESSAGES/django.po @@ -0,0 +1,72 @@ +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# +# , 2014. +msgid "" +msgstr "" +"Project-Id-Version: \n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2014-10-02 16:35+0000\n" +"PO-Revision-Date: 2014-10-02 20:35+0400\n" +"Last-Translator: \n" +"Language-Team: American English \n" +"Language: en_US\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" +"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" +"X-Generator: Lokalize 1.5\n" + +#: models.py:7 models.py:61 +msgid "Content" +msgstr "Содержание" + +#: models.py:8 +msgid "Random" +msgstr "Случайно" + +#: models.py:9 +msgid "None" +msgstr "Ничего" + +#: models.py:17 +msgid "The order in which multichoice answer options are displayed to the user" +msgstr "Порядок отображения вопросов" + +#: models.py:20 +msgid "Answer Order" +msgstr "Порядок вопросов" + +#: models.py:50 +msgid "Multiple Choice Question" +msgstr "Вопрос с несколькими вариантами ответов" + +#: models.py:51 +msgid "Multiple Choice Questions" +msgstr "Вопросы с несколькими вариантами ответов" + +#: models.py:55 +msgid "Question" +msgstr "Вопрос" + +#: models.py:59 +msgid "Enter the answer text that you want displayed" +msgstr "Введите текст ответа" + +#: models.py:65 +msgid "Is this a correct answer?" +msgstr "Это правильный ответ?" + +#: models.py:66 +msgid "Correct" +msgstr "Правильно" + +#: models.py:72 +msgid "Answer" +msgstr "Вопрос" + +#: models.py:73 +msgid "Answers" +msgstr "Вопросы" + diff --git a/multichoice/models.py b/multichoice/models.py index 4fed996..488014c 100644 --- a/multichoice/models.py +++ b/multichoice/models.py @@ -1,10 +1,12 @@ +from django.utils.translation import ugettext as _ from django.db import models from quiz.models import Question + ANSWER_ORDER_OPTIONS = ( - ('content', 'Content'), - ('random', 'Random'), - ('none', 'None'), + ('content', _('Content')), + ('random', _('Random')), + ('none', _('None')) ) @@ -12,9 +14,10 @@ class MCQuestion(Question): answer_order = models.CharField(max_length=30, null=True, blank=True, choices=ANSWER_ORDER_OPTIONS, - help_text="The order in which multichoice " - "answer options are displayed " - "to the user") + help_text=_("The order in which multichoice " + "answer options are displayed " + "to the user"), + verbose_name=_("Answer Order")) def check_if_correct(self, guess): answer = Answer.objects.get(id=guess) @@ -44,21 +47,27 @@ class MCQuestion(Question): return Answer.objects.get(id=guess).content class Meta: - verbose_name = "Multiple Choice Question" - verbose_name_plural = "Multiple Choice Questions" + verbose_name = _("Multiple Choice Question") + verbose_name_plural = _("Multiple Choice Questions") class Answer(models.Model): - question = models.ForeignKey(MCQuestion) + question = models.ForeignKey(MCQuestion, verbose_name=_("Question")) content = models.CharField(max_length=1000, blank=False, - help_text="Enter the answer text that " - "you want displayed") + help_text=_("Enter the answer text that " + "you want displayed"), + verbose_name=_("Content")) correct = models.BooleanField(blank=False, default=False, - help_text="Is this a correct answer?") + help_text=_("Is this a correct answer?"), + verbose_name=_("Correct")) def __unicode__(self): return unicode(self.content) + + class Meta: + verbose_name = _("Answer") + verbose_name_plural = _("Answers") diff --git a/quiz/locale/ru/LC_MESSAGES/django.mo b/quiz/locale/ru/LC_MESSAGES/django.mo new file mode 100644 index 0000000..2d6373a Binary files /dev/null and b/quiz/locale/ru/LC_MESSAGES/django.mo differ diff --git a/quiz/locale/ru/LC_MESSAGES/django.po b/quiz/locale/ru/LC_MESSAGES/django.po new file mode 100644 index 0000000..b6910d1 --- /dev/null +++ b/quiz/locale/ru/LC_MESSAGES/django.po @@ -0,0 +1,459 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2014-10-01 18:01+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" +"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" + +#: models.py:26 models.py:33 models.py:48 models.py:77 models.py:536 +#: templates/progress.html:19 templates/quiz/quiz_detail.html:9 +#: templates/quiz/quiz_list.html:13 templates/quiz/sitting_detail.html:10 +msgid "Category" +msgstr "Категрия" + +#: models.py:34 +msgid "Categories" +msgstr "Категрии" + +#: models.py:43 models.py:53 models.py:541 +msgid "Sub-Category" +msgstr "Под-категория" + +#: models.py:54 +msgid "Sub-Categories" +msgstr "Под-категории" + +#: models.py:63 templates/quiz/quiz_list.html:12 +msgid "Title" +msgstr "Название" + +#: models.py:67 +msgid "Description" +msgstr "Описание" + +#: models.py:68 +msgid "a description of the quiz" +msgstr "описание теста" + +#: models.py:72 +msgid "a user friendly url" +msgstr "url теста" + +#: models.py:73 +msgid "user friendly url" +msgstr "url теста" + +#: models.py:81 +msgid "Random Order" +msgstr "Случайный порядок" + +#: models.py:82 +msgid "Display the questions in a random order or as they are set?" +msgstr "Отображать вопросы в случайном порядке или в порядке добавления?" + +#: models.py:87 +msgid "Max Questions" +msgstr "Максимальное количество вопросов" + +#: models.py:88 +msgid "Number of questions to be answered on each attempt." +msgstr "" +"Количество вопросов, на которые должны быть даны ответы при каждой попытке" + +#: models.py:92 +msgid "" +"Correct answer is NOT shown after question. Answers displayed at the end." +msgstr "" +"Правильный ответ НЕ показан после вопроса. Ответы отображаются после " +"прохождения теста" + +#: models.py:94 +msgid "Answers at end" +msgstr "Ответы в конце" + +#: models.py:98 +msgid "" +"If yes, the result of each attempt by a user will be stored. Necessary for " +"marking." +msgstr "Если отмечено, результаты каждой попытки пользователя будет сохранен" + +#: models.py:101 +msgid "Exam Paper" +msgstr "Экзаменационный лист" + +#: models.py:105 +msgid "" +"If yes, only one attempt by a user will be permitted. Non users cannot sit " +"this exam." +msgstr "Если отмечено, пользователю будет разрешена только одна попытка" + +#: models.py:108 +msgid "Single Attempt" +msgstr "Единственная попытка" + +#: models.py:112 +msgid "Percentage required to pass exam." +msgstr "Процент правльных ответов для прохождения теста" + +#: models.py:116 +msgid "Displayed if user passes." +msgstr "Отображается, если пользователь успешно прошел тест" + +#: models.py:117 +msgid "Success Text" +msgstr "Текст в случае успеха" + +#: models.py:120 +msgid "Fail Text" +msgstr "Текст в случае неудачи" + +#: models.py:121 +msgid "Displayed if user fails." +msgstr "Отображается, если пользователь провалил тест" + +#: models.py:125 +msgid "Draft" +msgstr "Черновик" + +#: models.py:126 +msgid "" +"If yes, the quiz is not displayed in the quiz list and can only be taken by " +"users who can edit quizzes." +msgstr "" + +#: models.py:146 models.py:364 models.py:532 +#: templates/quiz/sitting_list.html:14 +msgid "Quiz" +msgstr "Тест" + +#: models.py:147 +msgid "Quizzes" +msgstr "Тесты" + +#: models.py:186 models.py:362 templates/quiz/sitting_detail.html:13 +#: templates/quiz/sitting_list.html:13 +msgid "User" +msgstr "Пользователь" + +#: models.py:188 templates/progress.html:60 +#: templates/quiz/sitting_detail.html:15 templates/quiz/sitting_list.html:16 +msgid "Score" +msgstr "Баллы" + +#: models.py:193 +msgid "User Progress" +msgstr "Прогресс пользователя" + +#: models.py:194 +msgid "User progress records" +msgstr "Прогресс пользователя" + +#: models.py:254 +msgid "error" +msgstr "ошибка" + +#: models.py:254 +msgid "category does not exist or invalid score" +msgstr "категории не существует или недопустимый балл" + +#: models.py:367 +msgid "Question Order" +msgstr "Порядок вопросов" + +#: models.py:370 +msgid "Question List" +msgstr "Список вопросов" + +#: models.py:373 +msgid "Incorrect questions" +msgstr "Вопросы, на которые дан неверный ответ" + +#: models.py:375 +msgid "Current Score" +msgstr "Текущий балл" + +#: models.py:378 +msgid "Complete" +msgstr "Завершен" + +#: models.py:381 +msgid "User Answers" +msgstr "Ответы пользователя" + +#: models.py:384 +msgid "Start" +msgstr "Начало" + +#: models.py:386 +msgid "End" +msgstr "Окончание" + +#: models.py:391 +msgid "Can see completed exams." +msgstr "Может просматривать оконченные тесты" + +#: models.py:548 +msgid "Figure" +msgstr "Рисунок" + +#: models.py:552 +msgid "Enter the question text that you want displayed" +msgstr "Введите текст вопроса, который должен отобразиться" + +#: models.py:554 models.py:566 templates/question.html:47 +#: templates/quiz/sitting_detail.html:21 +msgid "Question" +msgstr "Вопрос" + +#: models.py:558 +msgid "Explanation to be shown after the question has been answered." +msgstr "Объяснение показывается после того, как дан ответ на вопрос" + +#: models.py:561 templates/question.html:32 templates/result.html:21 +#: templates/result.html.py:87 +msgid "Explanation" +msgstr "Объяснение" + +#: models.py:567 +msgid "Questions" +msgstr "Вопросы" + +#: templates/base.html:7 +msgid "Example Quiz Website" +msgstr "Тесты" + +#: templates/correct_answer.html:6 +msgid "You answered the above question incorrectly" +msgstr "Вы дали неверный ответ" + +#: templates/correct_answer.html:16 +msgid "This is the correct answer" +msgstr "Это правильный ответ" + +#: templates/correct_answer.html:23 +msgid "This was your answer." +msgstr "Это был ваш ответ" + +#: templates/progress.html:6 +msgid "Progress Page" +msgstr "Страница прогесса" + +#: templates/progress.html:7 +msgid "User Progress Page" +msgstr "Страница прогресса пользователя" + +#: templates/progress.html:13 +msgid "Question Category Scores" +msgstr "Баллы по категориям вопросов" + +#: templates/progress.html:20 +msgid "Correctly answererd" +msgstr "Верных ответов" + +#: templates/progress.html:21 +msgid "Incorrect" +msgstr "Неверных ответов" + +#: templates/progress.html:50 +msgid "Previous exam papers" +msgstr "Список предыдущих экзаменов" + +#: templates/progress.html:52 +msgid "Below are the results of exams that you have sat." +msgstr "Ниже представлены результаты пройденных Вами тестов" + +#: templates/progress.html:59 +msgid "Quiz Title" +msgstr "Название теста" + +#: templates/progress.html:61 +msgid "Possible Score" +msgstr "Возможный балл" + +#: templates/question.html:13 templates/result.html:13 +msgid "The previous question" +msgstr "Предыдущий вопрос" + +#: templates/question.html:22 +msgid "Your answer was" +msgstr "Ваш ответ был" + +#: templates/question.html:47 +msgid "of" +msgstr "из" + +#: templates/question.html:52 +msgid "Question category" +msgstr "Категория вопроса" + +#: templates/question.html:74 +msgid "Check" +msgstr "Ответить" + +#: templates/result.html:7 +msgid "Exam Results for" +msgstr "Результат теста для" + +#: templates/result.html:32 +msgid "Exam results" +msgstr "Результаты тестирования" + +#: templates/result.html:34 +msgid "Exam title" +msgstr "Название теста" + +#: templates/result.html:38 +msgid "You answered" +msgstr "Ваш результат" + +#: templates/result.html:38 +msgid "questions correctly out of" +msgstr "правильных ответов из" + +#: templates/result.html:38 +msgid "giving you" +msgstr "вы дали" + +#: templates/result.html:38 +msgid "percent correct" +msgstr "процент правльных ответов" + +#: templates/result.html:48 +msgid "Review the questions below and try the exam again in the future" +msgstr "" +"Просмотрите вопросы, представленные ниже и попробуйте пройти тест еще раз" + +#: templates/result.html:52 +msgid "" +"The result of this exam will be stored in your progress section so you can " +"review and monitor your progression" +msgstr "" +"Результаты данного экзамена будут сохранены. Вы сможете просматривать ваш " +"прогресс" + +#: templates/result.html:66 +msgid "Your session score is" +msgstr "Балл вашей сессии" + +#: templates/result.html:66 +msgid "out of a possible" +msgstr "из возможных" + +#: templates/result.html:84 +msgid "Your answer" +msgstr "Ваш ответ" + +#: templates/single_complete.html:13 +msgid "You have already sat this exam and only one sitting is permitted" +msgstr "Вы уже прошли данный тест. Разрешена только одна попытка" + +#: templates/single_complete.html:15 +msgid "This exam is only accessible to signed in users" +msgstr "Этот тест доступен только зарегистрированным пользователям" + +#: templates/view_quiz_category.html:3 +msgid "Quizzes related to" +msgstr "Тесты относятся к" + +#: templates/view_quiz_category.html:6 +msgid "Quizzes in the" +msgstr "Тесты в" + +#: templates/view_quiz_category.html:6 +msgid "category" +msgstr "категория" + +#: templates/view_quiz_category.html:20 +msgid "There are no quizzes" +msgstr "Тестов нет" + +#: templates/quiz/category_list.html:3 templates/quiz/quiz_list.html:3 +#: templates/quiz/sitting_list.html:3 +msgid "All Quizzes" +msgstr "Все тесты" + +#: templates/quiz/category_list.html:6 +msgid "Category list" +msgstr "Список категорий" + +#: templates/quiz/quiz_detail.html:11 +msgid "You will only get one attempt at this quiz" +msgstr "У вас есть одна попытка для прохождения данного теста" + +#: templates/quiz/quiz_detail.html:16 +msgid "Start quiz" +msgstr "Начать тест" + +#: templates/quiz/quiz_list.html:6 +msgid "List of quizzes" +msgstr "Список тестов" + +#: templates/quiz/quiz_list.html:14 +msgid "Exam" +msgstr "Тестирование" + +#: templates/quiz/quiz_list.html:15 +msgid "Single attempt" +msgstr "Единственная попытка" + +#: templates/quiz/quiz_list.html:31 templates/quiz/sitting_list.html:42 +msgid "View details" +msgstr "Подробнее" + +#: templates/quiz/quiz_list.html:41 +msgid "There are no available quizzes" +msgstr "Доступных тестов нет" + +#: templates/quiz/sitting_detail.html:5 +msgid "Result of" +msgstr "Результаты" + +#: templates/quiz/sitting_detail.html:5 +msgid "for" +msgstr "для" + +#: templates/quiz/sitting_detail.html:9 +msgid "Quiz title" +msgstr "Назвние теста" + +#: templates/quiz/sitting_detail.html:14 templates/quiz/sitting_list.html:15 +msgid "Completed" +msgstr "Завершено" + +#: templates/quiz/sitting_detail.html:22 +msgid "User answer" +msgstr "Ответ пользователя" + +#: templates/quiz/sitting_detail.html:41 +msgid "incorrect" +msgstr "Неверно" + +#: templates/quiz/sitting_detail.html:43 +msgid "Correct" +msgstr "Верно" + +#: templates/quiz/sitting_detail.html:49 +msgid "Toggle whether correct" +msgstr "Изменить результат" + +#: templates/quiz/sitting_list.html:6 +msgid "List of complete exams" +msgstr "Список завершенных тестов" + +#: templates/quiz/sitting_list.html:52 +msgid "There are no matching quizzes" +msgstr "Подходящих тестов нет" diff --git a/quiz/models.py b/quiz/models.py index b3592b0..0614787 100644 --- a/quiz/models.py +++ b/quiz/models.py @@ -4,6 +4,7 @@ import json from django.db import models from django.core.exceptions import ValidationError from django.core.validators import MaxValueValidator +from django.utils.translation import ugettext as _ from django.utils.timezone import now from model_utils.managers import InheritanceManager @@ -21,16 +22,16 @@ class CategoryManager(models.Manager): class Category(models.Model): - category = models.CharField(max_length=250, - blank=True, - unique=True, - null=True) + category = models.CharField( + verbose_name=_("Category"), + max_length=250, blank=True, + unique=True, null=True) objects = CategoryManager() class Meta: - verbose_name = "Category" - verbose_name_plural = "Categories" + verbose_name = _("Category") + verbose_name_plural = _("Categories") def __unicode__(self): return unicode(self.category) @@ -38,18 +39,19 @@ class Category(models.Model): class SubCategory(models.Model): - sub_category = models.CharField(max_length=250, - blank=True, - null=True) + sub_category = models.CharField( + verbose_name=_("Sub-Category"), + max_length=250, blank=True, null=True) + + category = models.ForeignKey( + Category, null=True, blank=True, + verbose_name=_("Category")) - category = models.ForeignKey(Category, - null=True, - blank=True) objects = CategoryManager() class Meta: - verbose_name = "Sub-Category" - verbose_name_plural = "Sub-Categories" + verbose_name = _("Sub-Category") + verbose_name_plural = _("Sub-Categories") def __unicode__(self): return unicode(self.sub_category + " (" + self.category.category + ")") @@ -57,73 +59,74 @@ class SubCategory(models.Model): class Quiz(models.Model): - title = models.CharField(max_length=60, - blank=False) - - description = models.TextField(blank=True, - help_text="a description of the quiz") - - url = models.SlugField(max_length=60, - blank=False, - help_text="a user friendly url", - verbose_name="user friendly url") - - category = models.ForeignKey(Category, - null=True, - blank=True) - - random_order = models.BooleanField(blank=False, - default=False, - help_text="Display the questions in " - "a random order or as they " - "are set?") - - max_questions = models.PositiveIntegerField(blank=True, - null=True, - help_text="Number of questions" - " to be answered on" - " each attempt.") - - answers_at_end = models.BooleanField(blank=False, - default=False, - help_text="Correct answer is NOT" - " shown after question." - " Answers displayed at" - " the end.") - - exam_paper = models.BooleanField(blank=False, - default=False, - help_text="If yes, the result of each" - " attempt by a user will be" - " stored. Necessary for" - " marking.") - - single_attempt = models.BooleanField(blank=False, - default=False, - help_text="If yes, only one attempt" - " by a user will be" - " permitted. Non users" - " cannot sit this exam.") - - pass_mark = models.SmallIntegerField(blank=True, - default=0, - help_text="Percentage required to" - " pass exam.", - validators=[ - MaxValueValidator(100)]) - - success_text = models.TextField(blank=True, - help_text="Displayed if user passes.") - - fail_text = models.TextField(blank=True, - help_text="Displayed if user fails.") - - draft = models.BooleanField(blank=True, - default=False, - help_text="If yes, the quiz is not displayed" - " in the quiz list and can only be" - " taken by users who can edit" - " quizzes.") + title = models.CharField( + verbose_name=_("Title"), + max_length=60, blank=False) + + description = models.TextField( + verbose_name=_("Description"), + blank=True, help_text=_("a description of the quiz")) + + url = models.SlugField( + max_length=60, blank=False, + help_text=_("a user friendly url"), + verbose_name=_("user friendly url")) + + category = models.ForeignKey( + Category, null=True, blank=True, + verbose_name=_("Category")) + + random_order = models.BooleanField( + blank=False, default=False, + verbose_name=_("Random Order"), + help_text=_("Display the questions in " + "a random order or as they " + "are set?")) + + max_questions = models.PositiveIntegerField( + blank=True, null=True, verbose_name=_("Max Questions"), + help_text=_("Number of questions to be answered on each attempt.")) + + answers_at_end = models.BooleanField( + blank=False, default=False, + help_text=_("Correct answer is NOT shown after question." + " Answers displayed at the end."), + verbose_name=_("Answers at end")) + + exam_paper = models.BooleanField( + blank=False, default=False, + help_text=_("If yes, the result of each" + " attempt by a user will be" + " stored. Necessary for marking."), + verbose_name=_("Exam Paper")) + + single_attempt = models.BooleanField( + blank=False, default=False, + help_text=_("If yes, only one attempt by" + " a user will be permitted." + " Non users cannot sit this exam."), + verbose_name=_("Single Attempt")) + + pass_mark = models.SmallIntegerField( + blank=True, default=0, + help_text=_("Percentage required to pass exam."), + validators=[MaxValueValidator(100)]) + + success_text = models.TextField( + blank=True, help_text=_("Displayed if user passes."), + verbose_name=_("Success Text")) + + fail_text = models.TextField( + verbose_name=_("Fail Text"), + blank=True, help_text=_("Displayed if user fails.")) + + draft = models.BooleanField( + blank=True, default=False, + verbose_name=_("Draft"), + help_text=_("If yes, the quiz is not displayed" + " in the quiz list and can only be" + " taken by users who can edit" + " quizzes.")) def save(self, force_insert=False, force_update=False, *args, **kwargs): self.url = re.sub('\s+', '-', self.url).lower() @@ -140,8 +143,8 @@ class Quiz(models.Model): super(Quiz, self).save(force_insert, force_update, *args, **kwargs) class Meta: - verbose_name = "Quiz" - verbose_name_plural = "Quizzes" + verbose_name = _("Quiz") + verbose_name_plural = _("Quizzes") def __unicode__(self): return unicode(self.title) @@ -180,15 +183,15 @@ class Progress(models.Model): Data stored in csv using the format: category, score, possible, category, score, possible, ... """ - user = models.OneToOneField("auth.User") + user = models.OneToOneField("auth.User", verbose_name=_("User")) - score = models.CommaSeparatedIntegerField(max_length=1024) + score = models.CommaSeparatedIntegerField(max_length=1024, verbose_name=_("Score")) objects = ProgressManager() class Meta: - verbose_name = "User Progress" - verbose_name_plural = "User progress records" + verbose_name = _("User Progress") + verbose_name_plural = _("User progress records") @property def list_all_cat_scores(self): @@ -248,7 +251,7 @@ class Progress(models.Model): possible_to_add, isinstance(score_to_add, int), isinstance(possible_to_add, int)]]): - return "error", "category does not exist or invalid score" + return _("error"), _("category does not exist or invalid score") to_find = re.escape(str(question.category)) +\ r",(?P\d+),(?P\d+)," @@ -260,9 +263,12 @@ class Progress(models.Model): updated_possible = int(match.group('possible')) +\ abs(possible_to_add) - new_score = (str(question.category) + "," + - str(updated_score) + "," + - str(updated_possible) + ",") + new_score = u",".join( + [ + unicode(question.category), + unicode(updated_score), + unicode(updated_possible), u"" + ]) # swap old score for the new one self.score = self.score.replace(match.group(), new_score) @@ -270,9 +276,13 @@ class Progress(models.Model): else: # if not present but existing, add with the points passed in - self.score += (str(question.category) + "," + - str(score_to_add) + "," + - str(possible_to_add) + ",") + self.score += u",".join( + [ + unicode(question.category), + unicode(score_to_add), + unicode(possible_to_add), + u"" + ]) self.save() def show_exams(self): @@ -345,31 +355,36 @@ class Sitting(models.Model): with the answer the user gave. """ - user = models.ForeignKey('auth.User') + user = models.ForeignKey('auth.User', verbose_name=_("User")) - quiz = models.ForeignKey(Quiz) + quiz = models.ForeignKey(Quiz, verbose_name=_("Quiz")) - question_order = models.CommaSeparatedIntegerField(max_length=1024) + question_order = models.CommaSeparatedIntegerField( + max_length=1024, verbose_name=_("Question Order")) - question_list = models.CommaSeparatedIntegerField(max_length=1024) + question_list = models.CommaSeparatedIntegerField( + max_length=1024, verbose_name=_("Question List")) - incorrect_questions = models.CommaSeparatedIntegerField(max_length=1024, - blank=True) + incorrect_questions = models.CommaSeparatedIntegerField( + max_length=1024, blank=True, verbose_name=_("Incorrect questions")) - current_score = models.IntegerField() + current_score = models.IntegerField(verbose_name=_("Current Score")) - complete = models.BooleanField(default=False, blank=False) + complete = models.BooleanField(default=False, blank=False, + verbose_name=_("Complete")) - user_answers = models.TextField(blank=True, default='{}') + user_answers = models.TextField(blank=True, default='{}', + verbose_name=_("User Answers")) - start = models.DateTimeField(auto_now_add=True) + start = models.DateTimeField(auto_now_add=True, + verbose_name=_("Start")) - end = models.DateTimeField(null=True, blank=True) + end = models.DateTimeField(null=True, blank=True, verbose_name=_("End")) objects = SittingManager() class Meta: - permissions = (("view_sittings", "Can see completed exams."),) + permissions = (("view_sittings", _("Can see completed exams.")),) def get_first_question(self): """ @@ -510,36 +525,42 @@ class Question(models.Model): """ quiz = models.ManyToManyField(Quiz, + verbose_name=_("Quiz"), blank=True) category = models.ForeignKey(Category, + verbose_name=_("Category"), blank=True, null=True) sub_category = models.ForeignKey(SubCategory, + verbose_name=_("Sub-Category"), blank=True, null=True) figure = models.ImageField(upload_to='uploads/%Y/%m/%d', blank=True, - null=True) + null=True, + verbose_name=_("Figure")) content = models.CharField(max_length=1000, blank=False, - help_text="Enter the question text that " - "you want displayed", - verbose_name='Question') + help_text=_("Enter the question text that " + "you want displayed"), + verbose_name=_('Question')) explanation = models.TextField(max_length=2000, blank=True, - help_text="Explanation to be shown " - "after the question has " - "been answered.", - verbose_name='Explanation') + help_text=_("Explanation to be shown " + "after the question has " + "been answered."), + verbose_name=_('Explanation')) objects = InheritanceManager() class Meta: + verbose_name = _("Question") + verbose_name_plural = _("Questions") ordering = ['category'] def __unicode__(self): diff --git a/quiz/templates/base.html b/quiz/templates/base.html index aa953aa..6b292e4 100644 --- a/quiz/templates/base.html +++ b/quiz/templates/base.html @@ -1,25 +1,37 @@ - +{% load i18n %} +{% load staticfiles %} -Example Quiz Website | {% block title %}{% endblock %} +{% trans "Example Quiz Website" %} | {% block title %}{% endblock %} - + - +{% if user.is_authenticated %} + +{% endif %}
diff --git a/quiz/templates/correct_answer.html b/quiz/templates/correct_answer.html index 49f7c36..d98a10d 100644 --- a/quiz/templates/correct_answer.html +++ b/quiz/templates/correct_answer.html @@ -1,8 +1,9 @@ +{% load i18n %} {% if previous.answers %} {% if user_was_incorrect %}
- You answered the above question incorrectly + {% trans "You answered the above question incorrectly" %}
{% endif %} @@ -12,14 +13,14 @@ {% if answer.correct %} {{ answer.content }} - This is the correct answer + {% trans "This is the correct answer" %} {% else %} {{ answer.content }} {% if previous.question_type.MCQuestion %} {% if answer.id|add:"0" == previous.previous_answer|add:"0" %} - This was your answer. + {% trans "This was your answer." %} {% endif %} {% endif %} diff --git a/quiz/templates/progress.html b/quiz/templates/progress.html index 34be020..5337c71 100644 --- a/quiz/templates/progress.html +++ b/quiz/templates/progress.html @@ -1,23 +1,24 @@ {% extends "base.html" %} +{% load i18n %} {% load quiz_tags %} -{% block title %} Progress Page {% endblock %} -{% block description %} User Progress Page {% endblock %} +{% block title %} {% trans "Progress Page" %} {% endblock %} +{% block description %} {% trans "User Progress Page" %} {% endblock %} {% block content %} {% if cat_scores %} -

Question Category Scores

+

{% trans "Question Category Scores" %}

- - - + + + @@ -46,18 +47,18 @@
-

Previous exam papers

+

{% trans "Previous exam papers" %}

- Below are the results of exams that you have sat. + {% trans "Below are the results of exams that you have sat." %}

CategoryCorrectly answererdIncorrect{% trans "Category" %}{% trans "Correctly answererd" %}{% trans "Incorrect" %} %
- - - + + + diff --git a/quiz/templates/question.html b/quiz/templates/question.html index 18d4a09..2a95b8f 100644 --- a/quiz/templates/question.html +++ b/quiz/templates/question.html @@ -1,4 +1,5 @@ {% extends "base.html" %} +{% load i18n%} {% load quiz_tags %} @@ -9,7 +10,7 @@ {% if previous.answers %} -

The previous question:

+

{% trans "The previous question" %}:

{{ previous.previous_question }}

{% if previous.previous_outcome %} @@ -18,7 +19,7 @@
{% endif %}

- Your answer was + {% trans "Your answer was" %} {{ previous.previous_outcome|yesno:"correct,incorrect" }} @@ -28,7 +29,7 @@ {% include 'correct_answer.html' %} -

Explanation:

+

{% trans "Explanation" %}:

{{ previous.previous_question.explanation }}

@@ -43,12 +44,12 @@ {% if progress %}
-Question {{ progress.0|add:1 }} of {{ progress.1 }} +{% trans "Question" %} {{ progress.0|add:1 }} {% trans "of" %} {{ progress.1 }}
{% endif %}

- Question category: + {% trans "Question category" %}: {{ question.category }}

@@ -70,7 +71,7 @@ Question {{ progress.0|add:1 }} of {{ progress.1 }} {% endfor %} - + {% endif %} diff --git a/quiz/templates/quiz/category_list.html b/quiz/templates/quiz/category_list.html index c58cd05..90ffe0a 100644 --- a/quiz/templates/quiz/category_list.html +++ b/quiz/templates/quiz/category_list.html @@ -1,8 +1,9 @@ {% extends 'base.html' %} -{% block title %}All Quizzes{% endblock %} +{% load i18n %} +{% block title %}{% trans "All Quizzes" %}{% endblock %} {% block content %} -

Category list

+

{% trans "Category list" %}

    {% for cat in category_list %} diff --git a/quiz/templates/quiz/quiz_detail.html b/quiz/templates/quiz/quiz_detail.html index b630341..2681f77 100644 --- a/quiz/templates/quiz/quiz_detail.html +++ b/quiz/templates/quiz/quiz_detail.html @@ -1,18 +1,19 @@ {% extends 'base.html' %} +{% load i18n %} {% block title %} {{ quiz.title }} {% endblock %} {% block content %}

    {{ quiz.title }}

    -

    Category: {{ quiz.category }}

    +

    {% trans "Category" %}: {{ quiz.category }}

    {% if quiz.single_attempt %} -

    You will only get one attempt at this quiz.

    +

    {% trans "You will only get one attempt at this quiz" %}.

    {% endif %}

    {{ quiz.description }}

    - Start quiz + {% trans "Start quiz" %}

    {% endblock %} diff --git a/quiz/templates/quiz/quiz_list.html b/quiz/templates/quiz/quiz_list.html index 4099581..2480c5d 100644 --- a/quiz/templates/quiz/quiz_list.html +++ b/quiz/templates/quiz/quiz_list.html @@ -1,17 +1,18 @@ {% extends 'base.html' %} -{% block title %}All Quizzes{% endblock %} +{% load i18n %} +{% block title %}{% trans "All Quizzes" %}{% endblock %} {% block content %} -

    List of quizzes

    +

    {% trans "List of quizzes" %}

    {% if quiz_list %}
Quiz TitleScorePossible Score{% trans "Quiz Title" %}{% trans "Score" %}{% trans "Possible Score" %} %
- - - - + + + + @@ -27,7 +28,7 @@ @@ -37,6 +38,6 @@
TitleCategoryExamSingle attempt{% trans "Title" %}{% trans "Category" %}{% trans "Exam" %}{% trans "Single attempt" %}
{{ quiz.single_attempt }} - View details + {% trans "View details" %}
{% else %} -

There are no available quizzes.

+

{% trans "There are no available quizzes" %}.

{% endif %} {% endblock %} diff --git a/quiz/templates/quiz/sitting_detail.html b/quiz/templates/quiz/sitting_detail.html index f8c1238..fe8da8c 100644 --- a/quiz/templates/quiz/sitting_detail.html +++ b/quiz/templates/quiz/sitting_detail.html @@ -1,24 +1,25 @@ {% extends 'base.html' %} +{% load i18n %} {% load quiz_tags %} {% block title %} -Result of {{ sitting.quiz.title }} for {{ sitting.user }} +{% trans "Result of" %} {{ sitting.quiz.title }} {% trans "for" %} {{ sitting.user }} {% endblock %} {% block content %} -

Quiz title: {{ sitting.quiz.title }}

-

Category: {{ sitting.quiz.category }}

+

{% trans "Quiz title" %}: {{ sitting.quiz.title }}

+

{% trans "Category" %}: {{ sitting.quiz.category }}

{{ sitting.quiz.description }}


-

User: {{ sitting.user }}

-

Completed: {{ sitting.end|date }}

-

Score: {{ sitting.get_percent_correct }}%

+

{% trans "User" %}: {{ sitting.user }}

+

{% trans "Completed" %}: {{ sitting.end|date }}

+

{% trans "Score" %}: {{ sitting.get_percent_correct }}%

- - + + @@ -37,15 +38,15 @@ Result of {{ sitting.quiz.title }} for {{ sitting.user }} diff --git a/quiz/templates/quiz/sitting_list.html b/quiz/templates/quiz/sitting_list.html index e838ee1..915c8a8 100644 --- a/quiz/templates/quiz/sitting_list.html +++ b/quiz/templates/quiz/sitting_list.html @@ -1,18 +1,19 @@ {% extends 'base.html' %} -{% block title %}All Quizzes{% endblock %} +{% load i18n %} +{% block title %}{% trans "All Quizzes" %}{% endblock %} {% block content %} -

List of complete exams

+

{% trans "List of complete exams" %}

{% if sitting_list %}
QuestionUser answer{% trans "Question" %}{% trans "User answer" %}
{{ question|answer_choice_to_string:question.user_answer }} {% if question.id in sitting.get_incorrect_questions %} -

incorrect

+

{% trans "incorrect" %}

{% else %} -

Correct

+

{% trans "Correct" %}

{% endif %}
{% csrf_token %} - +
- - - - + + + + @@ -24,7 +25,7 @@ - + @@ -38,7 +39,7 @@ @@ -48,6 +49,6 @@
UserQuizCompletedScore (%){% trans "User" %}{% trans "Quiz" %}{% trans "Completed" %}{% trans "Score" %}(%)
{{ sitting.get_percent_correct }} - View details + {% trans "View details" %}
{% else %} -

There are no matching quizzes.

+

{% trans "There are no matching quizzes" %}.

{% endif %} {% endblock %} diff --git a/quiz/templates/result.html b/quiz/templates/result.html index ea202a4..e99e793 100644 --- a/quiz/templates/result.html +++ b/quiz/templates/result.html @@ -1,15 +1,16 @@ {% extends "base.html" %} +{% load i18n %} {% load quiz_tags %} {% block title %} {{ quiz.title}} {% endblock %} -{% block description %} Exam Results for {{ quiz.title }} {% endblock %} +{% block description %} {% trans "Exam Results for" %} {{ quiz.title }} {% endblock %} {% block content %} {% if previous.answers %} -

The previous question:

+

{% trans "The previous question" %}:

{{ previous.previous_question }}

Your answer was @@ -17,7 +18,7 @@

{% include 'correct_answer.html' %} -

Explanation:

+

{% trans "Explanation" %}:

{{ previous.previous_question.explanation }}

@@ -28,13 +29,13 @@ {% if max_score %}
-

Exam results

+

{% trans "Exam results" %}

- Exam title: + {% trans "Exam title" %}: {{ quiz.title }}

- You answered {{ score }} questions correctly out of {{ max_score }}, giving you {{ percent }} percent correct + {% trans "You answered" %} {{ score }} {% trans "questions correctly out of" %} {{ max_score }}, {% trans "giving you" %} {{ percent }} {% trans "percent correct" %}

{% if quiz.pass_mark %} @@ -44,11 +45,11 @@ {% endif %} -

Review the questions below and try the exam again in the future.

+

{% trans "Review the questions below and try the exam again in the future"%}.

{% if user.is_authenticated %} -

The result of this exam will be stored in your progress section so you can review and monitor your progression.

+

{% trans "The result of this exam will be stored in your progress section so you can review and monitor your progression" %}.

{% endif %}
@@ -62,7 +63,7 @@ {% if possible %}

- Your session score is {{ session }} out of a possible {{ possible }} + {% trans "Your session score is" %} {{ session }} {% trans "out of a possible" %} {{ possible }}


@@ -80,10 +81,10 @@ {% correct_answer_for_all question %} {% if question.user_answer %} -

Your answer: {{ question|answer_choice_to_string:question.user_answer }}

+

{% trans "Your answer" %}: {{ question|answer_choice_to_string:question.user_answer }}

{% endif %} -

Explanation:

+

{% trans "Explanation" %}:

{{ question.explanation }}

diff --git a/quiz/templates/single_complete.html b/quiz/templates/single_complete.html index 6856a70..9b016f9 100644 --- a/quiz/templates/single_complete.html +++ b/quiz/templates/single_complete.html @@ -1,4 +1,5 @@ {% extends "base.html" %} +{% load i18n %} {% load quiz_tags %} @@ -9,10 +10,9 @@ {% if user.is_authenticated %} -

You have already sat this exam and only one sitting is permitted.

+

{% trans "You have already sat this exam and only one sitting is permitted" %}.

{% else %} -

This exam is only accessible to signed in users.

+

{% trans "This exam is only accessible to signed in users" %}.

{% endif %} - {% endblock %} diff --git a/quiz/templates/view_quiz_category.html b/quiz/templates/view_quiz_category.html index 067cbbb..29aeda6 100644 --- a/quiz/templates/view_quiz_category.html +++ b/quiz/templates/view_quiz_category.html @@ -1,8 +1,9 @@ {% extends 'base.html' %} -{% block title %}Quizzes related to {{ category.category }}{% endblock %} +{% load i18n %} +{% block title %}{% trans "Quizzes related to" %} {{ category.category }}{% endblock %} {% block content %} -

Quizzes in the {{ category.category }} category

+

{% trans "Quizzes in the" %} {{ category.category }} {% trans "category" %}

{% with object_list as quizzes %} {% if quizzes %} @@ -16,7 +17,7 @@ {% endfor %} {% else %} -

There are no quizzes

+

{% trans "There are no quizzes" %}

{% endif %} {% endwith %} {% endblock %} diff --git a/true_false/locale/ru/LC_MESSAGES/django.mo b/true_false/locale/ru/LC_MESSAGES/django.mo new file mode 100644 index 0000000..002a75c Binary files /dev/null and b/true_false/locale/ru/LC_MESSAGES/django.mo differ diff --git a/true_false/locale/ru/LC_MESSAGES/django.po b/true_false/locale/ru/LC_MESSAGES/django.po new file mode 100644 index 0000000..8087300 --- /dev/null +++ b/true_false/locale/ru/LC_MESSAGES/django.po @@ -0,0 +1,36 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2014-10-01 17:56+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" +"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" + +#: models.py:9 +msgid "Tick this if the question is true. Leave it blank for false." +msgstr "Отметьте, если ответ на вопрос 'Да'. Оставьте пустым, если ответ 'Нет'" + +#: models.py:12 +msgid "Correct" +msgstr "Правльно" + +#: models.py:40 +msgid "True/False Question" +msgstr "Вопрос с ответом Да/Нет" + +#: models.py:41 +msgid "True/False Questions" +msgstr "Вопросы с ответом Да/Нет" diff --git a/true_false/models.py b/true_false/models.py index da79d6e..5b9c531 100644 --- a/true_false/models.py +++ b/true_false/models.py @@ -1,3 +1,4 @@ +from django.utils.translation import ugettext as _ from django.db import models from quiz.models import Question @@ -5,9 +6,10 @@ from quiz.models import Question class TF_Question(Question): correct = models.BooleanField(blank=False, default=False, - help_text="Tick this if the question " - "is true. Leave it blank for" - " false.") + help_text=_("Tick this if the question " + "is true. Leave it blank for" + " false."), + verbose_name=_("Correct")) def check_if_correct(self, guess): if guess == "True": @@ -35,6 +37,6 @@ class TF_Question(Question): return str(guess) class Meta: - verbose_name = "True/False Question" - verbose_name_plural = "True/False Questions" + verbose_name = _("True/False Question") + verbose_name_plural = _("True/False Questions") ordering = ['category']