Skip to content

Commit 206b0d4

Browse files
committed
feat(mon-pix): leverage new isSupportedLocale in localeService for supportHomeUrl in urlService
1 parent 1fb81e6 commit 206b0d4

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

mon-pix/app/services/url.js

+11-10
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ const SPANISH_INTERNATIONAL_LOCALE = 'es';
88
export default class Url extends Service {
99
@service currentDomain;
1010
@service intl;
11+
@service locale;
1112

1213
definedHomeUrl = ENV.rootURL;
1314

@@ -108,22 +109,22 @@ export default class Url extends Service {
108109
}
109110

110111
get supportHomeUrl() {
111-
const currentLanguage = this.intl.primaryLocale;
112+
const currentLocale = this.intl.primaryLocale;
112113

113114
if (this.currentDomain.isFranceDomain) {
114115
return 'https://pix.fr/support';
115116
}
116117

117-
switch (currentLanguage) {
118-
case ENGLISH_INTERNATIONAL_LOCALE:
119-
return 'https://pix.org/en/support';
120-
case DUTCH_INTERNATIONAL_LOCALE:
121-
return 'https://pix.org/nl-be/support';
122-
case SPANISH_INTERNATIONAL_LOCALE:
123-
return 'https://pix.org/en/support';
124-
default:
125-
return 'https://pix.org/fr/support';
118+
let locale;
119+
if (currentLocale == 'nl') {
120+
locale = 'nl-BE';
121+
} else if (this.locale.isSupportedLocale(currentLocale)) {
122+
locale = currentLocale;
123+
} else {
124+
locale = ENGLISH_INTERNATIONAL_LOCALE;
126125
}
126+
127+
return `https://pix.org/${locale}/support`;
127128
}
128129

129130
get serverStatusUrl() {

mon-pix/tests/unit/services/url-test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ module('Unit | Service | url', function (hooks) {
496496
const service = this.owner.lookup('service:url');
497497
service.currentDomain = { isFranceDomain: false };
498498
service.intl = { primaryLocale: DUTCH_INTERNATIONAL_LOCALE };
499-
const expectedSupportHomeUrl = 'https://pix.org/nl-be/support';
499+
const expectedSupportHomeUrl = 'https://pix.org/nl-BE/support';
500500

501501
// when
502502
const supportHomeUrl = service.supportHomeUrl;

0 commit comments

Comments
 (0)