diff --git a/network-api/networkapi/campaign/views.py b/network-api/networkapi/campaign/views.py
index 316e1eafbde..5b32aba57ec 100644
--- a/network-api/networkapi/campaign/views.py
+++ b/network-api/networkapi/campaign/views.py
@@ -12,6 +12,14 @@
from networkapi.wagtailpages.models import Petition, Signup
+def process_lang_code(lang):
+ # Salesforce expects "pt" instead of "pt-BR".
+ # See https://github.com/mozilla/foundation.mozilla.org/issues/5993
+ if lang == 'pt-BR':
+ return 'pt'
+ return lang
+
+
class SQSProxy:
"""
We use a proxy class to make sure that code that
@@ -107,7 +115,7 @@ def signup_submission(request, signup):
"format": "html",
"source_url": source,
"newsletters": signup.newsletter,
- "lang": rq.get('lang', 'en'),
+ "lang": process_lang_code(rq.get('lang', 'en')),
"country": rq.get('country', ''),
# Empty string instead of None due to Basket issues
"first_name": rq.get('givenNames', ''),
@@ -150,7 +158,7 @@ def petition_submission(request, petition):
"email": request.data['email'],
"email_subscription": request.data['newsletterSignup'],
"source_url": request.data['source'],
- "lang": request.data['lang'],
+ "lang": process_lang_code(request.data['lang']),
}
if petition:
diff --git a/network-api/networkapi/settings.py b/network-api/networkapi/settings.py
index 61c6b5e7e7b..eedf6ee5b44 100644
--- a/network-api/networkapi/settings.py
+++ b/network-api/networkapi/settings.py
@@ -412,7 +412,7 @@
LANGUAGES = (
('en', 'English'),
('de', 'German'),
- ('pt', 'Portuguese'),
+ ('pt-BR', 'Portuguese (Brazil)'),
('es', 'Spanish'),
('fr', 'French'),
('fy-NL', 'Frisian'),
diff --git a/network-api/networkapi/templates/fragments/canonical_url.html b/network-api/networkapi/templates/fragments/canonical_url.html
index 8aa9be44f9a..bc1c206fea6 100644
--- a/network-api/networkapi/templates/fragments/canonical_url.html
+++ b/network-api/networkapi/templates/fragments/canonical_url.html
@@ -28,7 +28,7 @@
{% elif CODE == 'pa-IN' %}
- {% elif CODE == 'pt' %}
+ {% elif CODE == 'pt-BR' %}
diff --git a/network-api/networkapi/urls.py b/network-api/networkapi/urls.py
index 4e8c0afb95e..890ce7e8ca6 100644
--- a/network-api/networkapi/urls.py
+++ b/network-api/networkapi/urls.py
@@ -65,6 +65,9 @@
# Wagtail Footnotes package
path("footnotes/", include(footnotes_urls)),
+
+ # redirect /pt to /pt-BR. See https://github.com/mozilla/foundation.mozilla.org/issues/5993
+ re_path(r'^pt/(?P.*)', RedirectView.as_view(url='/pt-BR/%(rest)s', query_string=True)),
]))
# Anything that needs to respect the localised
diff --git a/network-api/networkapi/wagtailpages/templatetags/localization.py b/network-api/networkapi/wagtailpages/templatetags/localization.py
index f4fb0ef95de..5e3b3b12f95 100644
--- a/network-api/networkapi/wagtailpages/templatetags/localization.py
+++ b/network-api/networkapi/wagtailpages/templatetags/localization.py
@@ -17,7 +17,7 @@
'fy-NL': 'fy_NL',
'nl': 'nl_NL',
'pl': 'pl_PL',
- 'pt': 'pt_BR', # our main focus is Brazilian Portuguese
+ 'pt-BR': 'pt_BR',
}
diff --git a/source/js/components/join/language-select.jsx b/source/js/components/join/language-select.jsx
index d77fa66099a..4a563f4e863 100644
--- a/source/js/components/join/language-select.jsx
+++ b/source/js/components/join/language-select.jsx
@@ -17,7 +17,7 @@ export default class LanguageSelect extends Component {
es: `Español`,
fr: `Français`,
pl: `Polski`,
- pt: `Português`,
+ "pt-BR": `Português`,
};
let lang_codes = Object.keys(languages);
diff --git a/source/js/components/petition/locale-strings.jsx b/source/js/components/petition/locale-strings.jsx
index 5e5d08b5f71..3f91261adaa 100644
--- a/source/js/components/petition/locale-strings.jsx
+++ b/source/js/components/petition/locale-strings.jsx
@@ -258,7 +258,7 @@ export default {
},
// Portuguese
- pt: {
+ "pt-BR": {
"First name": `Nome`,
"Please enter your given name(s)": `Insira seu nome`,
"Last name": `Sobrenome`,
diff --git a/source/sass/buyers-guide/views/product.scss b/source/sass/buyers-guide/views/product.scss
index fba547d9539..297fa459786 100644
--- a/source/sass/buyers-guide/views/product.scss
+++ b/source/sass/buyers-guide/views/product.scss
@@ -81,7 +81,7 @@ $pni-product-breakpoint-larger: $bp-md;
}
}
- @at-root html[lang="pt"] & {
+ @at-root html[lang="pt-BR"] & {
background-image: url(../_images/buyers-guide/icon-privacy-ding-pt.svg);
width: 53px;