From 80499dbf6ca5c1aca31c48ea0cb4bf9f6cfa9efc Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Sun, 9 Jun 2024 13:26:16 +0100 Subject: [PATCH] Fix remaining instances of package type as a gettext parameter Fixes #355 --- app/models/packages.py | 9 +++++++++ app/templates/macros/reviews.html | 4 ++-- app/templates/packages/review_create_edit.html | 2 +- app/templates/packages/translation.html | 2 +- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/app/models/packages.py b/app/models/packages.py index 96ef5833..5b82d212 100644 --- a/app/models/packages.py +++ b/app/models/packages.py @@ -108,6 +108,15 @@ class PackageType(enum.Enum): return lazy_gettext(u"%(display_name)s has a texture pack placed at #%(place)d.", display_name=display_name, place=place) + @property + def do_you_recommend(self): + if self == PackageType.MOD: + return lazy_gettext(u"Do you recommend this mod?") + elif self == PackageType.GAME: + return lazy_gettext(u"Do you recommend this game?") + elif self == PackageType.TXP: + return lazy_gettext(u"Do you recommend this texture pack?") + @classmethod def get(cls, name): try: diff --git a/app/templates/macros/reviews.html b/app/templates/macros/reviews.html index 1dc334b6..707d003f 100644 --- a/app/templates/macros/reviews.html +++ b/app/templates/macros/reviews.html @@ -114,7 +114,7 @@

- {{ _("Do you recommend this %(type)s?", type=package.type.text | lower) }} + {{ package.type.do_you_recommend }}

@@ -168,7 +168,7 @@

- {{ _("Do you recommend this %(type)s?", type=package.type.text | lower) }} + {{ package.type.do_you_recommend }}

- {{ _("Do you recommend this %(type)s?", type=package.type.text | lower) }} + {{ package.type.do_you_recommend }}

{{ render_toggle_field(form.rating, icons={"5":"fa-thumbs-up", "3": "fa-minus", "1":"fa-thumbs-down"}) }} diff --git a/app/templates/packages/translation.html b/app/templates/packages/translation.html index dd3dd8d9..354dc92b 100644 --- a/app/templates/packages/translation.html +++ b/app/templates/packages/translation.html @@ -15,7 +15,7 @@

{{ self.title() }}

{% if num == 1 %}

- {{ _("To provide translations for your %(type)s, you need to create .tr files and upload a new release.", type=package.type.text | lower) }} + {{ _("To provide translations for your package, you need to create .tr files and upload a new release.") }} {{ _("For information on how to do this, see the modding book chapter and lua_api.md") }}