Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question & Quiz : homogénéiser les langues #1941

Merged
merged 5 commits into from
Feb 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions core/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,16 @@
(CONTRIBUTION_STATUS_IGNORED, "Ignoré"),
]

LANGUAGE_FRENCH = "Français"
LANGUAGE_ENGLISH = "English"
LANGUAGE_GERMAN = "Deutsch"
LANGUAGE_CHOICE_LIST = [
LANGUAGE_FRENCH,
LANGUAGE_ENGLISH,
LANGUAGE_GERMAN,
LANGUAGE_FRENCH = "FRENCH"
LANGUAGE_ENGLISH = "ENGLISH"
LANGUAGE_GERMAN = "GERMAN"
LANGUAGE_OPTIONS = [
(LANGUAGE_FRENCH, _("French"), "fr", "🇫🇷"),
(LANGUAGE_ENGLISH, _("English"), "en", "🇬🇧"),
(LANGUAGE_GERMAN, _("German"), "de", "🇩🇪"),
]
LANGUAGE_CHOICES = [(lang, lang) for lang in LANGUAGE_CHOICE_LIST]
LANGUAGE_CHOICES = [(language[0], language[1]) for language in LANGUAGE_OPTIONS]
LANGUAGE_CHOICE_LIST = [language[0] for language in LANGUAGE_CHOICES]

NOTION_QUESTIONS_IMPORT_SCOPE_CHOICES = [
(0, "100 dernières questions modifiées"),
Expand Down
30 changes: 17 additions & 13 deletions locale/en/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-02-16 22:38+0100\n"
"POT-Creation-Date: 2023-02-18 22:24+0100\n"
"PO-Revision-Date: 2023-02-12 20:12+0100\n"
"Last-Translator: Didier Quirin <[email protected]>\n"
"Language-Team: \n"
Expand All @@ -19,11 +19,11 @@ msgstr ""
"X-Generator: Poedit 3.2.2\n"
"X-Translated-Using: django-rosetta 0.9.8\n"

#: app/settings.py:178
#: app/settings.py:178 core/constants.py:115
msgid "English"
msgstr ""

#: app/settings.py:179
#: app/settings.py:179 core/constants.py:114
msgid "French"
msgstr ""

Expand All @@ -39,43 +39,47 @@ msgstr ""
msgid "True or False"
msgstr ""

#: core/constants.py:20
#: core/constants.py:23
msgid "Junior"
msgstr ""

#: core/constants.py:21
#: core/constants.py:24
msgid "Easy"
msgstr ""

#: core/constants.py:22
#: core/constants.py:25
msgid "Medium"
msgstr ""

#: core/constants.py:23
#: core/constants.py:26
msgid "Hard"
msgstr ""

#: core/constants.py:24
#: core/constants.py:27
msgid "Expert"
msgstr ""

#: core/constants.py:132
#: core/constants.py:116
msgid "German"
msgstr ""

#: core/constants.py:136
msgid "Public (exported and the application)"
msgstr ""

#: core/constants.py:133
#: core/constants.py:137
msgid "Hidden (exported but not visible in the application)"
msgstr ""

#: core/constants.py:134
#: core/constants.py:138
msgid "Private (not exported and not in the application)"
msgstr ""

#: core/constants.py:137
#: core/constants.py:141
msgid "True"
msgstr ""

#: core/constants.py:137
#: core/constants.py:141
msgid "False"
msgstr ""

Expand Down
Binary file modified locale/fr/LC_MESSAGES/django.mo
Binary file not shown.
32 changes: 18 additions & 14 deletions locale/fr/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-02-16 22:38+0100\n"
"PO-Revision-Date: 2023-02-16 22:44+0100\n"
"POT-Creation-Date: 2023-02-18 22:24+0100\n"
"PO-Revision-Date: 2023-02-18 22:24+0100\n"
"Last-Translator: Didier Quirin <[email protected]>\n"
"Language-Team: \n"
"Language: fr\n"
Expand All @@ -19,11 +19,11 @@ msgstr ""
"X-Generator: Poedit 3.2.2\n"
"X-Translated-Using: django-rosetta 0.9.8\n"

#: app/settings.py:178
#: app/settings.py:178 core/constants.py:115
msgid "English"
msgstr "Anglais"

#: app/settings.py:179
#: app/settings.py:179 core/constants.py:114
msgid "French"
msgstr "Français"

Expand All @@ -39,43 +39,47 @@ msgstr "Questionnaire à choix multiples avec réponses multiples"
msgid "True or False"
msgstr "Vrai ou Faux"

#: core/constants.py:20
#: core/constants.py:23
msgid "Junior"
msgstr "Junior"

#: core/constants.py:21
#: core/constants.py:24
msgid "Easy"
msgstr "Facile"

#: core/constants.py:22
#: core/constants.py:25
msgid "Medium"
msgstr "Moyen"

#: core/constants.py:23
#: core/constants.py:26
msgid "Hard"
msgstr "Difficule"

#: core/constants.py:24
#: core/constants.py:27
msgid "Expert"
msgstr "Expert"

#: core/constants.py:132
#: core/constants.py:116
msgid "German"
msgstr "Allemand"

#: core/constants.py:136
msgid "Public (exported and the application)"
msgstr "Publique (dans l'export et dans l'application)"

#: core/constants.py:133
#: core/constants.py:137
msgid "Hidden (exported but not visible in the application)"
msgstr "Caché (dans l'export mais pas visible dans l'application)"

#: core/constants.py:134
#: core/constants.py:138
msgid "Private (not exported and not in the application)"
msgstr "Privé (pas dans l'export ni dans l'application)"

#: core/constants.py:137
#: core/constants.py:141
msgid "True"
msgstr "Vrai"

#: core/constants.py:137
#: core/constants.py:141
msgid "False"
msgstr "Faux"

Expand Down
29 changes: 29 additions & 0 deletions questions/migrations/0022_question_language_migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Generated by Django 4.1.5 on 2023-02-18 19:54

from django.db import migrations


def migrate_question_language(apps, schema_editor):
Question = apps.get_model("questions", "Question")
Question.objects.filter(language="Français").update(language="FRENCH")
Question.objects.filter(language="English").update(language="ENGLISH")
Question.objects.filter(language="Deutsch").update(language="GERMAN")


def migrate_historical_question_language(apps, schema_editor):
HistoricalQuestion = apps.get_model("questions", "HistoricalQuestion")
HistoricalQuestion.objects.filter(language="Français").update(language="FRENCH")
HistoricalQuestion.objects.filter(language="English").update(language="ENGLISH")
HistoricalQuestion.objects.filter(language="Deutsch").update(language="GERMAN")


class Migration(migrations.Migration):

dependencies = [
("questions", "0021_alter_historicalquestion_answer_audio_url_and_more"),
]

operations = [
migrations.RunPython(migrate_question_language),
migrations.RunPython(migrate_historical_question_language),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
# Generated by Django 4.1.5 on 2023-02-18 21:10

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("questions", "0022_question_language_migration"),
]

operations = [
migrations.AlterField(
model_name="historicalquestion",
name="difficulty",
field=models.IntegerField(
choices=[(0, "Junior"), (1, "Easy"), (2, "Medium"), (3, "Hard"), (4, "Expert")],
default=1,
verbose_name="Difficulty level",
),
),
migrations.AlterField(
model_name="historicalquestion",
name="language",
field=models.CharField(
choices=[("FRENCH", "French"), ("ENGLISH", "English"), ("GERMAN", "German")],
default="FRENCH",
max_length=50,
verbose_name="Language",
),
),
migrations.AlterField(
model_name="historicalquestion",
name="type",
field=models.CharField(
choices=[
("QCM", "Multiple choice questionnaire"),
("QCM-RM", "Multiple choice questionnaire with multiple answers"),
("VF", "True or False"),
],
default="QCM",
max_length=50,
verbose_name="Type",
),
),
migrations.AlterField(
model_name="historicalquestion",
name="visibility",
field=models.CharField(
choices=[
("PUBLIC", "Public (exported and the application)"),
("HIDDEN", "Hidden (exported but not visible in the application)"),
("PRIVATE", "Private (not exported and not in the application)"),
],
default="PUBLIC",
max_length=50,
verbose_name="Visibility",
),
),
migrations.AlterField(
model_name="question",
name="difficulty",
field=models.IntegerField(
choices=[(0, "Junior"), (1, "Easy"), (2, "Medium"), (3, "Hard"), (4, "Expert")],
default=1,
verbose_name="Difficulty level",
),
),
migrations.AlterField(
model_name="question",
name="language",
field=models.CharField(
choices=[("FRENCH", "French"), ("ENGLISH", "English"), ("GERMAN", "German")],
default="FRENCH",
max_length=50,
verbose_name="Language",
),
),
migrations.AlterField(
model_name="question",
name="type",
field=models.CharField(
choices=[
("QCM", "Multiple choice questionnaire"),
("QCM-RM", "Multiple choice questionnaire with multiple answers"),
("VF", "True or False"),
],
default="QCM",
max_length=50,
verbose_name="Type",
),
),
migrations.AlterField(
model_name="question",
name="visibility",
field=models.CharField(
choices=[
("PUBLIC", "Public (exported and the application)"),
("HIDDEN", "Hidden (exported but not visible in the application)"),
("PRIVATE", "Private (not exported and not in the application)"),
],
default="PUBLIC",
max_length=50,
verbose_name="Visibility",
),
),
]
29 changes: 29 additions & 0 deletions quizs/migrations/0021_quiz_language_migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Generated by Django 4.1.5 on 2023-02-18 19:54

from django.db import migrations


def migrate_quiz_language(apps, schema_editor):
Quiz = apps.get_model("quizs", "Quiz")
Quiz.objects.filter(language="Français").update(language="FRENCH")
Quiz.objects.filter(language="English").update(language="ENGLISH")
Quiz.objects.filter(language="Deutsch").update(language="GERMAN")


def migrate_historical_quiz_language(apps, schema_editor):
HistoricalQuiz = apps.get_model("quizs", "HistoricalQuiz")
HistoricalQuiz.objects.filter(language="Français").update(language="FRENCH")
HistoricalQuiz.objects.filter(language="English").update(language="ENGLISH")
HistoricalQuiz.objects.filter(language="Deutsch").update(language="GERMAN")


class Migration(migrations.Migration):

dependencies = [
("quizs", "0020_remove_historicalquiz_author_and_more"),
]

operations = [
migrations.RunPython(migrate_quiz_language),
migrations.RunPython(migrate_historical_quiz_language),
]
Loading