Last active
October 12, 2021 09:10
-
-
Save sroccaserra/859a6210fd69d2b4074efa9105018237 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/api/lib/domain/services/mail-service.js b/api/lib/domain/services/mail-service.js | |
index 0be37bb4d5..b030bb5321 100644 | |
--- a/api/lib/domain/services/mail-service.js | |
+++ b/api/lib/domain/services/mail-service.js | |
@@ -338,7 +338,7 @@ function sendVerificationCodeEmail({ code, email, locale, translate }) { | |
}; | |
if (locale === FRENCH_SPOKEN) { | |
- options.subject = translate(frTranslations['verification-code-email'].subject, { code }); | |
+ options.subject = translate({ phrase: 'verification-code-email.subject', locale: 'fr' }, { code }); | |
options.variables = { | |
code, | |
@@ -348,7 +348,7 @@ function sendVerificationCodeEmail({ code, email, locale, translate }) { | |
...frTranslations['verification-code-email'].body, | |
}; | |
} else if (locale === FRENCH_FRANCE) { | |
- options.subject = translate(frTranslations['verification-code-email'].subject, { code }); | |
+ options.subject = translate({ phrase: 'verification-code-email.subject', locale: 'fr' }, { code }); | |
options.variables = { | |
code, | |
@@ -358,7 +358,7 @@ function sendVerificationCodeEmail({ code, email, locale, translate }) { | |
...frTranslations['verification-code-email'].body, | |
}; | |
} else if (locale === ENGLISH_SPOKEN) { | |
- options.subject = translate(enTranslations['verification-code-email'].subject, { code }); | |
+ options.subject = translate({ phrase: 'verification-code-email.subject', locale: 'en' }, { code }); | |
options.variables = { | |
code, | |
diff --git a/api/tests/tooling/i18n/i18n.js b/api/tests/tooling/i18n/i18n.js | |
index abb889b914..3881709822 100644 | |
--- a/api/tests/tooling/i18n/i18n.js | |
+++ b/api/tests/tooling/i18n/i18n.js | |
@@ -4,7 +4,7 @@ const i18n = require('i18n'); | |
function getI18n() { | |
const directory = path.resolve(path.join(__dirname, '../../../translations')); | |
i18n.configure({ | |
- locales: ['fr'], | |
+ locales: ['fr', 'en'], | |
defaultLocale: 'fr', | |
directory, | |
objectNotation: true, | |
diff --git a/api/tests/unit/domain/services/mail-service_test.js b/api/tests/unit/domain/services/mail-service_test.js | |
index a3eca5444b..3db2506f4b 100644 | |
--- a/api/tests/unit/domain/services/mail-service_test.js | |
+++ b/api/tests/unit/domain/services/mail-service_test.js | |
@@ -729,7 +729,7 @@ describe('Unit | Service | MailService', function () { | |
expected: { | |
from: '[email protected]', | |
to: userEmail, | |
- subject: translate(translationsMapping.fr.subject, { code }), | |
+ subject: translate('verification-code-email.subject', { code }), | |
template: 'test-email-verification-code-template-id', | |
tags: ['EMAIL_VERIFICATION_CODE'], | |
variables: { | |
@@ -746,7 +746,7 @@ describe('Unit | Service | MailService', function () { | |
expected: { | |
from: '[email protected]', | |
to: userEmail, | |
- subject: translate(translationsMapping.fr.subject, { code }), | |
+ subject: translate('verification-code-email.subject', { code }), | |
template: 'test-email-verification-code-template-id', | |
tags: ['EMAIL_VERIFICATION_CODE'], | |
variables: { | |
@@ -763,7 +763,7 @@ describe('Unit | Service | MailService', function () { | |
expected: { | |
from: '[email protected]', | |
to: userEmail, | |
- subject: translate(translationsMapping.en.subject, { code }), | |
+ subject: translate({ phrase: 'verification-code-email.subject', locale: 'en' }, { code }), | |
tags: ['EMAIL_VERIFICATION_CODE'], | |
template: 'test-email-verification-code-template-id', | |
variables: { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment