Skip to content
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
11 changes: 9 additions & 2 deletions network-api/networkapi/campaign/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
"""
Expand Down Expand Up @@ -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', ''),
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion network-api/networkapi/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
{% elif CODE == 'pa-IN' %}
<link rel="alternate" hreflang="pa" href="{{ CANONICAL_SITE_URL }}/{{ CODE }}{{ CANONICAL_PATH }}" title="{{ lang.name_local|safe }}">
<link rel="alternate" hreflang="pa-IN" href="{{ CANONICAL_SITE_URL }}/{{ CODE }}{{ CANONICAL_PATH }}" title="{{ lang.name_local|safe }}">
{% elif CODE == 'pt' %}
{% elif CODE == 'pt-BR' %}
<link rel="alternate" hreflang="pt" href="{{ CANONICAL_SITE_URL }}/{{ CODE }}{{ CANONICAL_PATH }}" title="{{ lang.name_local|safe }}">
<link rel="alternate" hreflang="pt-PT" href="{{ CANONICAL_SITE_URL }}/{{ CODE }}{{ CANONICAL_PATH }}" title="{{ lang.name_local|safe }}">
<link rel="alternate" hreflang="pt-BR" href="{{ CANONICAL_SITE_URL }}/{{ CODE }}{{ CANONICAL_PATH }}" title="{{ lang.name_local|safe }}">
Expand Down
3 changes: 3 additions & 0 deletions network-api/networkapi/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -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<rest>.*)', RedirectView.as_view(url='/pt-BR/%(rest)s', query_string=True)),
]))

# Anything that needs to respect the localised
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
}


Expand Down
2 changes: 1 addition & 1 deletion source/js/components/join/language-select.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion source/js/components/petition/locale-strings.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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`,
Expand Down
2 changes: 1 addition & 1 deletion source/sass/buyers-guide/views/product.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down