diff --git a/network-api/networkapi/campaign/views.py b/network-api/networkapi/campaign/views.py
index 071f39b31f4..c7a60df23c1 100644
--- a/network-api/networkapi/campaign/views.py
+++ b/network-api/networkapi/campaign/views.py
@@ -12,6 +12,13 @@
import json
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:
"""
@@ -128,7 +135,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', ''),
@@ -178,7 +185,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 1bd53a8b4ab..2d603747bb9 100644
--- a/network-api/networkapi/settings.py
+++ b/network-api/networkapi/settings.py
@@ -434,7 +434,7 @@
WAGTAIL_CONTENT_LANGUAGES = LANGUAGES = (
('en', gettext_lazy('English')),
('de', gettext_lazy('German')),
- ('pt', gettext_lazy('Portuguese')),
+ ('pt-BR', gettext_lazy('Portuguese (Brazil)')),
('es', gettext_lazy('Spanish')),
('fr', gettext_lazy('French')),
('fy-NL', gettext_lazy('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 f8660c1b8cc..1c4abdf855b 100644
--- a/network-api/networkapi/urls.py
+++ b/network-api/networkapi/urls.py
@@ -70,6 +70,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 5e44e591587..fa59e1320d4 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 a5a1731022d..e1f69b9ac17 100644
--- a/source/js/components/join/language-select.jsx
+++ b/source/js/components/join/language-select.jsx
@@ -20,7 +20,7 @@ class JoinUsLanguageSelect 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 0c6c92bac44..5d0c9eb4d54 100644
--- a/source/js/components/petition/locale-strings.jsx
+++ b/source/js/components/petition/locale-strings.jsx
@@ -288,7 +288,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 ec723a0a17f..8cc1ad83aa4 100644
--- a/source/sass/buyers-guide/views/product.scss
+++ b/source/sass/buyers-guide/views/product.scss
@@ -79,7 +79,7 @@
}
}
- @at-root html[lang="pt"] & {
+ @at-root html[lang="pt-BR"] & {
background-image: url(../_images/buyers-guide/icon-privacy-ding-pt.svg);
width: 53px;