Skip to content

Commit

Permalink
feat(api): add support for Ukrainian language
Browse files Browse the repository at this point in the history
  • Loading branch information
rhahao committed Aug 15, 2023
1 parent 8ed0121 commit 0bc21d1
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/controllers/congregation-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { validationResult } from 'express-validator';
import { decryptData } from '../utils/encryption-utils.js';
import { users } from '../classes/Users.js';
import { congregations } from '../classes/Congregations.js';
import { LANGUAGE_LIST } from '../locales/langList.js';

export const getLastCongregationBackup = async (req, res, next) => {
try {
Expand Down Expand Up @@ -1286,8 +1287,9 @@ export const getCountries = async (req, res, next) => {

language = language.toUpperCase();

const langsAllowed = ['E', 'MG', 'T'];
if (langsAllowed.includes(language) === false) {
const isLangValid = LANGUAGE_LIST.find((lang) => lang.code.toUpperCase() === language);

if (!isLangValid) {
res.locals.type = 'warn';
res.locals.message = `invalid language`;

Expand Down Expand Up @@ -1346,8 +1348,9 @@ export const getCongregations = async (req, res, next) => {
language = language.toUpperCase();
country = country.toUpperCase();

const langsAllowed = ['E', 'MG', 'T'];
if (langsAllowed.includes(language) === false) {
const isLangValid = LANGUAGE_LIST.find((lang) => lang.code.toUpperCase() === language);

if (!isLangValid) {
res.locals.type = 'warn';
res.locals.message = `invalid language`;

Expand Down
1 change: 1 addition & 0 deletions src/locales/langList.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ export const LANGUAGE_LIST = [
{ code: 'e', locale: 'en', name: 'English' },
{ code: 'mg', locale: 'mg-MG', name: 'Malagasy' },
{ code: 't', locale: 'pt-BR', name: 'Português (Brasil)' },
{ code: 'k', locale: 'uk-UA', name: 'українська' },
];
13 changes: 13 additions & 0 deletions src/locales/uk-UA/main.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"emailPasswordlessSubject": "Passwordless Link to Sign in to CPE app",
"greetingsNoName": "Hello,",
"passwordLessIntro": "We received a request to sign in to Congregation Program for Everyone using this email address. If you want to sign in with your {{ email }} account, please use the link below.",
"signIn": "Sign in",
"passwordLessIgnore": "If you did not request this link, you can safely ignore this email.",
"passwordLessLinkFull": "If you are having trouble opening the link above, please use the following link. Make sure the link is not cropped when you are opening it.",
"thankYou": "Thank you",
"sws2appsTeam": "The Scheduling Workbox System Team",
"emailOTPCodeSubject": "Verification Code for for sign in to CPE app",
"emailOTPCodeTemplate": "<p>Hello</p>\n<p>Here’s your verification code to sign in to Congregation Program for Everyone:</p>\n<p class='otp-code'>{{ emailOTPCode }}</p>\n<p>Please make sure you never share this code with anyone.\n<br><strong>Note:</strong> The code will expire in 5 minutes.</p>",
"emailFooter": "<p>Thank you\n<br>The Scheduling Workbox System Team</p>"
}

0 comments on commit 0bc21d1

Please sign in to comment.