From 12f28b97375ee5ab3d1c0852fa5083024b0bb119 Mon Sep 17 00:00:00 2001 From: Rushikesh-Sonawane99 Date: Fri, 31 May 2024 11:53:15 +0530 Subject: [PATCH] ISsue #PS-384 chore: Added translations and integrated constant from config file --- app.config.ts | 2 +- public/locales/en/common.json | 11 ++++++----- public/locales/hi/common.json | 8 +++++--- public/locales/mr/common.json | 8 +++++--- src/components/LearnerAttendanceStatsListView.tsx | 3 ++- src/pages/attendance-overview.tsx | 2 +- src/pages/dashboard.tsx | 2 +- 7 files changed, 21 insertions(+), 15 deletions(-) diff --git a/app.config.ts b/app.config.ts index 3625bb6f..43317faf 100644 --- a/app.config.ts +++ b/app.config.ts @@ -1 +1 @@ -export const lowLearnerAttendanceLimit: number = 67; \ No newline at end of file +export const lowLearnerAttendanceLimit: number = 33; \ No newline at end of file diff --git a/public/locales/en/common.json b/public/locales/en/common.json index 518751fc..874ef496 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -42,10 +42,12 @@ "LAST_SIX_MONTHS": "Last Six Months", "CUSTOM_RANGE": "Custom Range", "NONE": "None", - "LEARNERS":"Learners", + "LEARNERS": "Learners", "LEARNER_NAME": "Learner Name", "DATE_RANGE": "Date Range", - "SELECT_AN_OPTION": "Select an option" + "SELECT_AN_OPTION": "Select an option", + "AND": "and", + "MORE": "more" }, "LOGIN_PAGE": { "USERNAME": "Username", @@ -78,9 +80,8 @@ "MY_TIMETABLE": "My Timetable", "MY_TEACHING_CENTERS": "My Teaching Centers", "UPCOMING_EXTRA_SESSION": "Upcoming Extra Sessions", - "BACK_TO_TOP":"Back to Top", + "BACK_TO_TOP": "Back to Top", "LAST_SEVEN_DAYS_RANGE": "Last 7 Days {{date_range}})" - }, "ATTENDANCE": { "TOTAL_STUDENTS": "Total Number of Learners: {{count}}", @@ -127,6 +128,6 @@ "VIEW_DAY_WISE": "View Day-Wise", "SUBMITTED_ON": "Submitted On", "MARK_OBTAINED": "Mark Obtained", - "TOTAL_QUESTIONS":"Total Questions" + "TOTAL_QUESTIONS": "Total Questions" } } diff --git a/public/locales/hi/common.json b/public/locales/hi/common.json index f8af3ec1..3296babe 100644 --- a/public/locales/hi/common.json +++ b/public/locales/hi/common.json @@ -41,10 +41,12 @@ "AS_OF_LAST_WEEK": "पिछले सप्ताह तक", "AS_OF_LAST_SIX_MONTH": "पिछले छह महीने से", "NONE": "कोई नहीं", - "LEARNERS":"शिक्षार्थियों", + "LEARNERS": "शिक्षार्थियों", "LEARNER_NAME": "शिक्षार्थी का नाम", "DATE_RANGE": "तिथि सीमा", - "SELECT_AN_OPTION": "कोई विकल्प चुनें" + "SELECT_AN_OPTION": "कोई विकल्प चुनें", + "AND": "और", + "MORE": "अधिक" }, "LOGIN_PAGE": { "USERNAME": "उपयोगकर्ता नाम", @@ -76,7 +78,7 @@ "CENTER_ATTENDANCE": "केंद्रीय उपस्थिति", "MY_TEACHING_CENTERS": "मेरे शिक्षण केंद्र", "UPCOMING_EXTRA_SESSION": "आगामी अतिरिक्त सत्र", - "BACK_TO_TOP":"वापस शीर्ष पर", + "BACK_TO_TOP": "वापस शीर्ष पर", "LAST_SEVEN_DAYS_RANGE": "पिछले 7 दिन {{date_range}}" }, "ATTENDANCE": { diff --git a/public/locales/mr/common.json b/public/locales/mr/common.json index 1c326041..0536e292 100644 --- a/public/locales/mr/common.json +++ b/public/locales/mr/common.json @@ -40,10 +40,12 @@ "AS_OF_LAST_WEEK": "गेल्या आठवड्याप्रमाणे", "AS_OF_LAST_SIX_MONTH": "गेल्या सहा महिन्यांपासून", "NONE": "काहीही नाही", - "LEARNERS":"शिकणारे", + "LEARNERS": "शिकणारे", "LEARNER_NAME": "शिकणाऱ्याचे नाव", "DATE_RANGE": "तारीख श्रेणी", - "SELECT_AN_OPTION": "एक पर्याय निवडा" + "SELECT_AN_OPTION": "एक पर्याय निवडा", + "AND": "आणि", + "MORE": "अधिक" }, "LOGIN_PAGE": { "USERNAME": "वापरकर्ता नाव", @@ -76,7 +78,7 @@ "MY_TIMETABLE": "माझे वेळापत्रक", "MY_TEACHING_CENTERS": "माझे शिक्षण केंद्र", "UPCOMING_EXTRA_SESSION": "आगामी अतिरिक्त सत्रे", - "BACK_TO_TOP":"परत वर जा", + "BACK_TO_TOP": "परत वर जा", "LAST_SEVEN_DAYS_RANGE": "शेवटचे 7 दिवस {{date_range}}" }, "ATTENDANCE": { diff --git a/src/components/LearnerAttendanceStatsListView.tsx b/src/components/LearnerAttendanceStatsListView.tsx index 77afedae..5bf10219 100644 --- a/src/components/LearnerAttendanceStatsListView.tsx +++ b/src/components/LearnerAttendanceStatsListView.tsx @@ -4,6 +4,7 @@ import { Box, Grid, Stack, Typography } from '@mui/material'; import { useTheme } from '@mui/material/styles'; import { useTranslation } from 'react-i18next'; import Link from 'next/link'; +import { lowLearnerAttendanceLimit } from '../../app.config'; interface StudentsStatsListProps { name: string; presentPercent: number; @@ -22,7 +23,7 @@ const StudentsStatsList: React.FC = ({ const theme = useTheme(); const { t } = useTranslation(); const textColor = - presentPercent > 60 ? theme.palette.success.main : theme.palette.error.main; + presentPercent > lowLearnerAttendanceLimit ? theme.palette.success.main : theme.palette.error.main; // const handleStudentDetails = () => { // router.push(`/student-details/${cohortId}/${userId}`); diff --git a/src/pages/attendance-overview.tsx b/src/pages/attendance-overview.tsx index c88476a6..289ff057 100644 --- a/src/pages/attendance-overview.tsx +++ b/src/pages/attendance-overview.tsx @@ -451,7 +451,7 @@ const AttendanceOverview: React.FC = () => { ))} value={ lowAttendanceLearnerList.length > 2 - ? `${lowAttendanceLearnerList[0]}, ${lowAttendanceLearnerList[1]} and ${lowAttendanceLearnerList.length - 2} more` + ? `${lowAttendanceLearnerList[0]}, ${lowAttendanceLearnerList[1]} ${t('COMMON.AND')} ${lowAttendanceLearnerList.length - 2} ${t('COMMON.MORE')}` : lowAttendanceLearnerList.length === 2 ? `${lowAttendanceLearnerList[0]}, ${lowAttendanceLearnerList[1]}` : lowAttendanceLearnerList.length === 1 diff --git a/src/pages/dashboard.tsx b/src/pages/dashboard.tsx index a8a5f28c..d61219f0 100644 --- a/src/pages/dashboard.tsx +++ b/src/pages/dashboard.tsx @@ -677,7 +677,7 @@ const Dashboard: React.FC = () => { ))} value={ lowAttendanceLearnerList.length > 2 - ? `${lowAttendanceLearnerList[0]}, ${lowAttendanceLearnerList[1]} and ${lowAttendanceLearnerList.length - 2} more` + ? `${lowAttendanceLearnerList[0]}, ${lowAttendanceLearnerList[1]} ${t('COMMON.AND')} ${lowAttendanceLearnerList.length - 2} ${t('COMMON.MORE')}` : lowAttendanceLearnerList.length === 2 ? `${lowAttendanceLearnerList[0]}, ${lowAttendanceLearnerList[1]}` : lowAttendanceLearnerList.length === 1