From de92b2262c52b02fb3b7c62824c1fb835c333f28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Chevalier?= Date: Mon, 4 Oct 2021 15:39:07 +0200 Subject: [PATCH 1/4] New localization approach for People voted --- .../fragments/most_voted_rating.html | 40 ++++++++++--------- 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/network-api/networkapi/wagtailpages/templates/fragments/most_voted_rating.html b/network-api/networkapi/wagtailpages/templates/fragments/most_voted_rating.html index 6cfd99654c4..db62365457f 100644 --- a/network-api/networkapi/wagtailpages/templates/fragments/most_voted_rating.html +++ b/network-api/networkapi/wagtailpages/templates/fragments/most_voted_rating.html @@ -1,19 +1,23 @@ -{% load i18n localization %} +{% load i18n %} -{% comment %} - -{% endcomment %} - - {% trans "People voted" context "This string is followed by the creepiness that most people voted, as well as the percentage of people that voted for that ranking" %} - {{ people_voted|floatformat:"0" }}% - {% if most_voted_rating == 4 %} - {% trans "super creepy" %} - {% elif most_voted_rating == 3 %} - {% trans "very creepy" %} - {% elif most_voted_rating == 2 %} - {% trans "somewhat creepy" %} - {% elif most_voted_rating == 1 %} - {% trans "a little creepy" %} - {% elif most_voted_rating == 0 %} - {% trans "not creepy" %} - {% endif %} +{% if most_voted_rating == 4 %} + {% blocktrans with link_attrs=' class="body-small" href="#creepiness-vote"' vote_percent=people_voted|floatformat:"0" vote_attrs=' class="body-small pl-1"' rating_attrs=' class="body-small pl-1 people-voted super-creepy"' trimmed %} + People voted {{ vote_percent }}% super creepy + {% endblocktrans %} +{% elif most_voted_rating == 3 %} + {% blocktrans with link_attrs=' class="body-small" href="#creepiness-vote"' vote_percent=people_voted|floatformat:"0" vote_attrs=' class="body-small pl-1"' rating_attrs=' class="body-small pl-1 people-voted very-creepy"' trimmed %} + People voted {{ vote_percent }}% very creepy + {% endblocktrans %} +{% elif most_voted_rating == 2 %} + {% blocktrans with link_attrs=' class="body-small" href="#creepiness-vote"' vote_percent=people_voted|floatformat:"0" vote_attrs=' class="body-small pl-1"' rating_attrs=' class="body-small pl-1 people-voted somewhat-creepy"' trimmed %} + People voted {{ vote_percent }}% somewhat creepy + {% endblocktrans %} +{% elif most_voted_rating == 1 %} + {% blocktrans with link_attrs=' class="body-small" href="#creepiness-vote"' vote_percent=people_voted|floatformat:"0" vote_attrs=' class="body-small pl-1"' rating_attrs=' class="body-small pl-1 people-voted a-little-creepy"' trimmed %} + People voted {{ vote_percent }}% a little creepy + {% endblocktrans %} +{% elif most_voted_rating == 0 %} + {% blocktrans with link_attrs=' class="body-small" href="#creepiness-vote"' vote_percent=people_voted|floatformat:"0" vote_attrs=' class="body-small pl-1"' rating_attrs=' class="body-small pl-1 people-voted not-creepy"' trimmed %} + People voted {{ vote_percent }}% not creepy + {% endblocktrans %} +{% endif %} From decb470ba5f62b3b73aa4487d2ae567ece8940a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Chevalier?= Date: Mon, 4 Oct 2021 17:23:07 +0200 Subject: [PATCH 2/4] remove extra spaces --- .../templates/fragments/most_voted_rating.html | 13 ++++++------- source/sass/buyers-guide/views/product.scss | 2 +- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/network-api/networkapi/wagtailpages/templates/fragments/most_voted_rating.html b/network-api/networkapi/wagtailpages/templates/fragments/most_voted_rating.html index db62365457f..f854b3cdef2 100644 --- a/network-api/networkapi/wagtailpages/templates/fragments/most_voted_rating.html +++ b/network-api/networkapi/wagtailpages/templates/fragments/most_voted_rating.html @@ -1,23 +1,22 @@ {% load i18n %} {% if most_voted_rating == 4 %} - {% blocktrans with link_attrs=' class="body-small" href="#creepiness-vote"' vote_percent=people_voted|floatformat:"0" vote_attrs=' class="body-small pl-1"' rating_attrs=' class="body-small pl-1 people-voted super-creepy"' trimmed %} + {% blocktrans with link_attrs=' class="body-small" href="#creepiness-vote"' vote_percent=people_voted|floatformat:"0" vote_attrs=' class="body-small"' rating_attrs=' class="body-small people-voted super-creepy"' trimmed %} People voted {{ vote_percent }}% super creepy {% endblocktrans %} {% elif most_voted_rating == 3 %} - {% blocktrans with link_attrs=' class="body-small" href="#creepiness-vote"' vote_percent=people_voted|floatformat:"0" vote_attrs=' class="body-small pl-1"' rating_attrs=' class="body-small pl-1 people-voted very-creepy"' trimmed %} + {% blocktrans with link_attrs=' class="body-small" href="#creepiness-vote"' vote_percent=people_voted|floatformat:"0" vote_attrs=' class="body-small"' rating_attrs=' class="body-small people-voted very-creepy"' trimmed %} People voted {{ vote_percent }}% very creepy {% endblocktrans %} {% elif most_voted_rating == 2 %} - {% blocktrans with link_attrs=' class="body-small" href="#creepiness-vote"' vote_percent=people_voted|floatformat:"0" vote_attrs=' class="body-small pl-1"' rating_attrs=' class="body-small pl-1 people-voted somewhat-creepy"' trimmed %} + {% blocktrans with link_attrs=' class="body-small" href="#creepiness-vote"' vote_percent=people_voted|floatformat:"0" vote_attrs=' class="body-small"' rating_attrs=' class="body-small people-voted somewhat-creepy"' trimmed %} People voted {{ vote_percent }}% somewhat creepy {% endblocktrans %} {% elif most_voted_rating == 1 %} - {% blocktrans with link_attrs=' class="body-small" href="#creepiness-vote"' vote_percent=people_voted|floatformat:"0" vote_attrs=' class="body-small pl-1"' rating_attrs=' class="body-small pl-1 people-voted a-little-creepy"' trimmed %} + {% blocktrans with link_attrs=' class="body-small" href="#creepiness-vote"' vote_percent=people_voted|floatformat:"0" vote_attrs=' class="body-small"' rating_attrs=' class="body-small people-voted a-little-creepy"' trimmed %} People voted {{ vote_percent }}% a little creepy {% endblocktrans %} {% elif most_voted_rating == 0 %} - {% blocktrans with link_attrs=' class="body-small" href="#creepiness-vote"' vote_percent=people_voted|floatformat:"0" vote_attrs=' class="body-small pl-1"' rating_attrs=' class="body-small pl-1 people-voted not-creepy"' trimmed %} + {% blocktrans with link_attrs=' class="body-small" href="#creepiness-vote"' vote_percent=people_voted|floatformat:"0" vote_attrs=' class="body-small"' rating_attrs=' class="body-small people-voted not-creepy"' trimmed %} People voted {{ vote_percent }}% not creepy - {% endblocktrans %} -{% endif %} + {% endblocktrans %} \ No newline at end of file diff --git a/source/sass/buyers-guide/views/product.scss b/source/sass/buyers-guide/views/product.scss index 424c084921f..39cf6c8c581 100644 --- a/source/sass/buyers-guide/views/product.scss +++ b/source/sass/buyers-guide/views/product.scss @@ -213,7 +213,7 @@ .mozilla-says, .people-voted { &::after { - content: " "; + content: ""; display: inline-block; width: 1.5em; height: 1.5em; From e623d07cddea4a0a3d67649c3a048fb75496f217 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Chevalier?= Date: Mon, 4 Oct 2021 17:37:30 +0200 Subject: [PATCH 3/4] Simplify string --- .../fragments/most_voted_rating.html | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/network-api/networkapi/wagtailpages/templates/fragments/most_voted_rating.html b/network-api/networkapi/wagtailpages/templates/fragments/most_voted_rating.html index f854b3cdef2..290b5506132 100644 --- a/network-api/networkapi/wagtailpages/templates/fragments/most_voted_rating.html +++ b/network-api/networkapi/wagtailpages/templates/fragments/most_voted_rating.html @@ -1,22 +1,25 @@ {% load i18n %} + {% if most_voted_rating == 4 %} - {% blocktrans with link_attrs=' class="body-small" href="#creepiness-vote"' vote_percent=people_voted|floatformat:"0" vote_attrs=' class="body-small"' rating_attrs=' class="body-small people-voted super-creepy"' trimmed %} - People voted {{ vote_percent }}% super creepy + {% blocktrans with link_attrs=' class="body-small" href="#creepiness-vote"' vote_percent=people_voted|floatformat:"0" rating_attrs=' class="people-voted super-creepy"' trimmed %} + People voted {{ vote_percent }}% super creepy {% endblocktrans %} {% elif most_voted_rating == 3 %} - {% blocktrans with link_attrs=' class="body-small" href="#creepiness-vote"' vote_percent=people_voted|floatformat:"0" vote_attrs=' class="body-small"' rating_attrs=' class="body-small people-voted very-creepy"' trimmed %} - People voted {{ vote_percent }}% very creepy + {% blocktrans with link_attrs=' class="body-small" href="#creepiness-vote"' vote_percent=people_voted|floatformat:"0" rating_attrs=' class="people-voted very-creepy"' trimmed %} + People voted {{ vote_percent }}% very creepy {% endblocktrans %} {% elif most_voted_rating == 2 %} - {% blocktrans with link_attrs=' class="body-small" href="#creepiness-vote"' vote_percent=people_voted|floatformat:"0" vote_attrs=' class="body-small"' rating_attrs=' class="body-small people-voted somewhat-creepy"' trimmed %} - People voted {{ vote_percent }}% somewhat creepy + {% blocktrans with link_attrs=' class="body-small" href="#creepiness-vote"' vote_percent=people_voted|floatformat:"0" rating_attrs=' class="people-voted somewhat-creepy"' trimmed %} + People voted {{ vote_percent }}% somewhat creepy {% endblocktrans %} {% elif most_voted_rating == 1 %} - {% blocktrans with link_attrs=' class="body-small" href="#creepiness-vote"' vote_percent=people_voted|floatformat:"0" vote_attrs=' class="body-small"' rating_attrs=' class="body-small people-voted a-little-creepy"' trimmed %} - People voted {{ vote_percent }}% a little creepy + {% blocktrans with link_attrs=' class="body-small" href="#creepiness-vote"' vote_percent=people_voted|floatformat:"0" rating_attrs=' class="people-voted a-little-creepy"' trimmed %} + People voted {{ vote_percent }}% a little creepy {% endblocktrans %} {% elif most_voted_rating == 0 %} - {% blocktrans with link_attrs=' class="body-small" href="#creepiness-vote"' vote_percent=people_voted|floatformat:"0" vote_attrs=' class="body-small"' rating_attrs=' class="body-small people-voted not-creepy"' trimmed %} - People voted {{ vote_percent }}% not creepy - {% endblocktrans %} \ No newline at end of file + {% blocktrans with link_attrs=' class="body-small" href="#creepiness-vote"' vote_percent=people_voted|floatformat:"0" rating_attrs=' class="people-voted not-creepy"' trimmed %} + People voted {{ vote_percent }}% not creepy + {% endblocktrans %} +{% endif %} + \ No newline at end of file From d870200e12789914d532e48fb03ed4e602d798c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Chevalier?= Date: Mon, 4 Oct 2021 18:53:23 +0200 Subject: [PATCH 4/4] Update most_voted_rating.html --- .../wagtailpages/templates/fragments/most_voted_rating.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/network-api/networkapi/wagtailpages/templates/fragments/most_voted_rating.html b/network-api/networkapi/wagtailpages/templates/fragments/most_voted_rating.html index 290b5506132..356f9f32c71 100644 --- a/network-api/networkapi/wagtailpages/templates/fragments/most_voted_rating.html +++ b/network-api/networkapi/wagtailpages/templates/fragments/most_voted_rating.html @@ -22,4 +22,4 @@ People voted {{ vote_percent }}% not creepy {% endblocktrans %} {% endif %} - \ No newline at end of file +