Skip to content

Commit

Permalink
Make suggested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
lunars97 committed May 27, 2024
1 parent 84b3169 commit 9924d25
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 22 deletions.
6 changes: 3 additions & 3 deletions integreat_cms/cms/forms/languages/language_form.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ def __init__(self, *args: Any, **kwargs: Any) -> None:
used_colors = []
unused_colors = []
for color in language_color.COLORS:
code, name = color
if language := Language.objects.filter(language_color=code).first():
color_code, name = color
if language := Language.objects.filter(language_color=color_code).first():
modified_name = name + " (" + language.translated_name + ")"
used_colors += [(code, modified_name)]
used_colors += [(color_code, modified_name)]
else:
unused_colors += [color]
used_colors = sorted(used_colors, key=lambda x: x[1])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class Migration(migrations.Migration):
"""

dependencies = [
("cms", "0089_add_language_color"),
("cms", "0088_rename_mt_related_fields"),
]

operations = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class Migration(migrations.Migration):
"""

dependencies = [
("cms", "0088_rename_mt_related_fields"),
("cms", "0089_add_poicategory_icons"),
]

operations = [
Expand Down Expand Up @@ -53,7 +53,7 @@ class Migration(migrations.Migration):
("#FFDAB9", "Almond"),
("#D62728", "Cherry"),
],
help_text="This is used to represent the color label of the chosen language",
help_text="This color is used to represent the color label of the chosen language",
max_length=7,
verbose_name="language color",
),
Expand Down
4 changes: 3 additions & 1 deletion integreat_cms/cms/models/languages/language.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,9 @@ class Language(AbstractBaseModel):
max_length=7,
verbose_name=_("language color"),
blank=False,
help_text=_("This is used to represent the color label of the chosen language"),
help_text=_(
"This color is used to represent the color label of the chosen language"
),
)
created_date = models.DateTimeField(
default=timezone.now,
Expand Down
18 changes: 9 additions & 9 deletions integreat_cms/locale/de/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -1257,7 +1257,7 @@ msgstr "Dunkelblau"

#: cms/constants/language_color.py
msgid "Green blue"
msgstr "Grün-blau"
msgstr "Grünblau"

#: cms/constants/language_color.py cms/constants/poicategory.py
msgid "Yellow"
Expand Down Expand Up @@ -1305,7 +1305,7 @@ msgstr "Braun"

#: cms/constants/language_color.py
msgid "Pink orange"
msgstr "Rosa-orange"
msgstr "Rosaorange"

#: cms/constants/language_color.py
msgid "Pastel pink"
Expand Down Expand Up @@ -1337,7 +1337,7 @@ msgstr "Fjord"

#: cms/constants/language_color.py
msgid "Quicksand"
msgstr "Traibsand"
msgstr "Treibsand"

#: cms/constants/language_color.py cms/constants/poicategory.py
msgid "Grey"
Expand Down Expand Up @@ -2962,7 +2962,7 @@ msgstr ""

#: cms/models/languages/language.py
msgid "This flag is used to represent the language graphically."
msgstr "Diese Flagge wird verwendet, um die Sprache graphisch darzustellen."
msgstr "Diese Flagge wird in der Sprach-Auswahl verwendet."

#: cms/models/languages/language.py
msgid "secondary country flag"
Expand All @@ -2978,11 +2978,11 @@ msgstr "Diese Flagge wird in der Sprach-Auswahl verwendet."

#: cms/models/languages/language.py
msgid "language color"
msgstr "Sprache Farbe"
msgstr "Farbe der Sprache"

#: cms/models/languages/language.py
msgid "This is used to represent the color label of the chosen language"
msgstr "Diese Flagge wird verwendet, um die Sprache graphisch darzustellen."
msgid "This color is used to represent the color label of the chosen language"
msgstr "Diese Farbe wird verwendet, um die Sprache graphisch darzustellen."

#: cms/models/languages/language.py
msgid "\"Table of contents\" in this language"
Expand Down Expand Up @@ -6025,7 +6025,7 @@ msgstr "Länderflaggen"

#: cms/templates/languages/language_list.html
msgid "Language Color"
msgstr "Sprache Farbe"
msgstr "Farbe der Sprache"

#: cms/templates/languages/language_list.html
#: cms/templates/languagetreenodes/languagetreenode_list.html
Expand Down Expand Up @@ -6119,7 +6119,7 @@ msgstr "Hierarchie"

#: cms/templates/languagetreenodes/languagetreenode_list.html
msgid "Language color"
msgstr "Sprache Farbe"
msgstr "Farbe der Sprache"

#: cms/templates/languagetreenodes/languagetreenode_list.html
msgid "No language tree available yet."
Expand Down
4 changes: 2 additions & 2 deletions integreat_cms/release_notes/current/unreleased/2390.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
en: Add color to the language model
de: Füge einer Farbe zum Sprachmodell hinzu
en: Add fixed colors to the languages in the statistics
de: Füge den Sprachen in den Statistiken eine feste Farbe hinzu
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
const renderLanguageColorPreview = ({ target }: Event) => {
const colorSelect = target as HTMLSelectElement;
const languageColorSelectFromChoices = target as HTMLSelectElement;
const colorPreview = document.getElementById("language-color-preview");
const selectedColor = colorSelect.options[colorSelect.selectedIndex].value;
const selectedColor = languageColorSelectFromChoices.options[languageColorSelectFromChoices.selectedIndex].value;
if (selectedColor) {
colorPreview.style.backgroundColor = selectedColor;
colorPreview.classList.remove("hidden");
colorSelect.classList.add("rounded-none", "rounded-r", "border-l-0");
languageColorSelectFromChoices.classList.add("rounded-none", "rounded-r", "border-l-0");
} else {
colorPreview.classList.add("hidden");
colorSelect.classList.remove("rounded-none", "rounded-r", "border-l-0");
languageColorSelectFromChoices.classList.remove("rounded-none", "rounded-r", "border-l-0");
}
};

Expand Down

0 comments on commit 9924d25

Please sign in to comment.