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

Update euro currency formatting for English locales (Issue #13476) #13479

Merged
merged 1 commit into from
Aug 2, 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
56 changes: 37 additions & 19 deletions bedrock/products/tests/test_helper_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@
"monthly": {"id": "price_1N7PQIJNcmPzuWtR2BQdQbtL", "price": "9,99 €", "total": None, "saving": None},
},
"en": { # English
"12-month": {"id": "price_1JcdvBJNcmPzuWtROLbEH9d2", "price": "4,99 €", "total": "59,88 €", "saving": 50},
"monthly": {"id": "price_1JcdsSJNcmPzuWtRGF9Y5TMJ", "price": "9,99 €", "total": None, "saving": None},
"12-month": {"id": "price_1JcdvBJNcmPzuWtROLbEH9d2", "price": "4.99 €", "total": "59.88 €", "saving": 50},
"monthly": {"id": "price_1JcdsSJNcmPzuWtRGF9Y5TMJ", "price": "9.99 €", "total": None, "saving": None},
},
"es": { # Spanish
"12-month": {"id": "price_1J5JCdJNcmPzuWtRrvQMFLlP", "price": "4,99 €", "total": "59,88 €", "saving": 50},
Expand Down Expand Up @@ -1011,13 +1011,19 @@ def test_vpn_monthly_price_usd_ca(self):

def test_vpn_monthly_price_euro(self):
"""Should return expected markup"""
markup = self._render(plan="monthly", country_code="DE", lang="de")
markup = self._render(plan="monthly", country_code="DE", lang="en-US")
Copy link
Member Author

@alexgibson alexgibson Aug 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note for reviewer: updating lang here to match the locale of the request used in the test (en-US) to make things a bit clearer. The lang param is only used for selecting a stripe plan, rather than anything to do with the string translation.

expected = '<span class="vpn-monthly-price-display">9,99 €<span>/month</span></span>'
self.assertEqual(markup, expected)

def test_vpn_monthly_price_euro_fi(self):
"""Should return expected markup"""
markup = self._render(plan="monthly", country_code="FI", lang="en-US")
expected = '<span class="vpn-monthly-price-display">9.99 €<span>/month</span></span>'
self.assertEqual(markup, expected)

def test_vpn_monthly_price_chf(self):
"""Should return expected markup"""
markup = self._render(plan="monthly", country_code="CH", lang="de")
markup = self._render(plan="monthly", country_code="CH", lang="en-US")
expected = '<span class="vpn-monthly-price-display">CHF 10.99<span>/month</span></span>'
self.assertEqual(markup, expected)

Expand All @@ -1035,13 +1041,19 @@ def test_vpn_12_month_price_usd_ca(self):

def test_vpn_12_month_price_euro(self):
"""Should return expected markup"""
markup = self._render(plan="12-month", country_code="DE", lang="de")
markup = self._render(plan="12-month", country_code="DE", lang="en-US")
expected = '<span class="vpn-monthly-price-display">4,99 €<span>/month</span></span>'
self.assertEqual(markup, expected)

def test_vpn_12_month_price_euro_fi(self):
"""Should return expected markup"""
markup = self._render(plan="12-month", country_code="FI", lang="en-US")
expected = '<span class="vpn-monthly-price-display">4.99 €<span>/month</span></span>'
self.assertEqual(markup, expected)

def test_vpn_12_month_price_chf(self):
"""Should return expected markup"""
markup = self._render(plan="12-month", country_code="CH", lang="de")
markup = self._render(plan="12-month", country_code="CH", lang="en-US")
expected = '<span class="vpn-monthly-price-display">CHF 5.99<span>/month</span></span>'
self.assertEqual(markup, expected)

Expand All @@ -1059,13 +1071,13 @@ def test_vpn_12_month_price_czk(self):

def test_vpn_monthly_price_dkk(self):
"""Should return expected markup"""
markup = self._render(plan="monthly", country_code="DK", lang="da")
markup = self._render(plan="monthly", country_code="DK", lang="en-US")
expected = '<span class="vpn-monthly-price-display">kr. 75<span>/month</span></span>'
self.assertEqual(markup, expected)

def test_vpn_12_month_price_dkk(self):
"""Should return expected markup"""
markup = self._render(plan="12-month", country_code="DK", lang="da")
markup = self._render(plan="12-month", country_code="DK", lang="en-US")
expected = '<span class="vpn-monthly-price-display">kr. 37<span>/month</span></span>'
self.assertEqual(markup, expected)

Expand Down Expand Up @@ -1108,25 +1120,31 @@ def test_vpn_12_month_total_price_usd_ca(self):

def test_vpn_12_month_total_price_euro(self):
"""Should return expected markup"""
markup = self._render(country_code="DE", lang="de")
markup = self._render(country_code="DE", lang="en-US")
expected = "59,88 € total"
self.assertEqual(markup, expected)

def test_vpn_12_month_total_price_euro_fi(self):
"""Should return expected markup"""
markup = self._render(country_code="FI", lang="en-US")
expected = "59.88 € total"
self.assertEqual(markup, expected)

def test_vpn_12_month_total_price_chf(self):
"""Should return expected markup"""
markup = self._render(country_code="CH", lang="de")
markup = self._render(country_code="CH", lang="en-US")
expected = "CHF 71.88 total"
self.assertEqual(markup, expected)

def test_vpn_12_month_total_price_czk(self):
"""Should return expected markup"""
markup = self._render(country_code="CZ", lang="cs")
markup = self._render(country_code="CZ", lang="en-US")
expected = "1,428 Kč total"
self.assertEqual(markup, expected)

def test_vpn_12_month_total_price_dkk(self):
"""Should return expected markup"""
markup = self._render(country_code="DK", lang="da")
markup = self._render(country_code="DK", lang="en-US")
expected = "kr. 444 total"
self.assertEqual(markup, expected)

Expand All @@ -1144,7 +1162,7 @@ def test_vpn_relay_bundle_12_month_total_price_usd(self):

def test_vpn_relay_bundle_12_month_total_price_ca(self):
"""Should return expected markup"""
markup = self._render(country_code="CA", lang="en-CA", bundle_relay=True)
markup = self._render(country_code="CA", lang="en-US", bundle_relay=True)
expected = "US$83.88 total + tax"
self.assertEqual(markup, expected)

Expand All @@ -1169,13 +1187,13 @@ def test_vpn_12_month_saving_usd(self):

def test_vpn_12_month_saving_euro(self):
"""Should return expected markup"""
markup = self._render(country_code="DE", lang="de")
markup = self._render(country_code="DE", lang="en-US")
expected = "Save 50%"
self.assertEqual(markup, expected)

def test_vpn_12_month_saving_chf(self):
"""Should return expected markup"""
markup = self._render(country_code="CH", lang="de")
markup = self._render(country_code="CH", lang="en-US")
expected = "Save 45%"
self.assertEqual(markup, expected)

Expand All @@ -1187,19 +1205,19 @@ def test_vpn_12_month_saving_bgn(self):

def test_vpn_12_month_saving_czk(self):
"""Should return expected markup"""
markup = self._render(country_code="CZ", lang="cz")
markup = self._render(country_code="CZ", lang="en-US")
expected = "Save 50%"
self.assertEqual(markup, expected)

def test_vpn_12_month_saving_dkk(self):
"""Should return expected markup"""
markup = self._render(country_code="DK", lang="da")
markup = self._render(country_code="DK", lang="en-US")
expected = "Save 50%"
self.assertEqual(markup, expected)

def test_vpn_12_month_saving_huf(self):
"""Should return expected markup"""
markup = self._render(country_code="HU", lang="hu")
markup = self._render(country_code="HU", lang="en-US")
expected = "Save 50%"
self.assertEqual(markup, expected)

Expand All @@ -1223,7 +1241,7 @@ def test_vpn_relay_bundle_12_month_saving_usd(self):

def test_vpn_relay_bundle_12_month_saving_ca(self):
"""Should return expected markup"""
markup = self._render(country_code="CA", lang="en-CA", bundle_relay=True)
markup = self._render(country_code="CA", lang="en-US", bundle_relay=True)
expected = "Save 50%"
self.assertEqual(markup, expected)

Expand Down
6 changes: 3 additions & 3 deletions bedrock/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1328,14 +1328,14 @@ def before_send(event, hint):
"en": { # English
"12-month": {
"id": "price_1JcuArKb9q6OnNsLXAnkCSUE" if DEV else "price_1JcdvBJNcmPzuWtROLbEH9d2",
"price": "4,99 €",
"total": "59,88 €",
"price": "4.99 €",
"total": "59.88 €",
"saving": 50,
"analytics": {"brand": "vpn", "plan": "vpn", "currency": "EUR", "discount": "60.00", "price": "59.88", "period": "yearly"},
},
"monthly": {
"id": "price_1Jcu7uKb9q6OnNsLG4JAAXuw" if DEV else "price_1JcdsSJNcmPzuWtRGF9Y5TMJ",
"price": "9,99 €",
"price": "9.99 €",
"total": None,
"saving": None,
"analytics": {"brand": "vpn", "plan": "vpn", "currency": "EUR", "discount": "0", "price": "9.99", "period": "monthly"},
Expand Down