Skip to content

Commit

Permalink
[Improvement]: Global | Translations (#2917)
Browse files Browse the repository at this point in the history
* feat: add missing translate on Dailyplan

* feat: translation of plans Menu

* feat: Outstading Header

* feat: email on Invite Popup

* fix: default Issue Type Translation

* feat: Manual time Popup
  • Loading branch information
Cedric921 authored Aug 19, 2024
1 parent 7a9df76 commit ae832b5
Show file tree
Hide file tree
Showing 19 changed files with 372 additions and 41 deletions.
3 changes: 0 additions & 3 deletions apps/web/app/[locale]/profile/[memberId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,6 @@ const Profile = React.memo(function ProfilePage({ params }: { params: { memberId
{t('common.MEMBER')} {t('common.NOT_FOUND')}!
</Text>

<Text className=" font-light text-center text-gray-400">
{t('pages.profile.MEMBER_NOT_FOUND_MSG_1')}
</Text>
<Text className=" font-light text-center text-gray-400">
{t('pages.profile.MEMBER_NOT_FOUND_MSG_1')}
</Text>
Expand Down
24 changes: 12 additions & 12 deletions apps/web/lib/features/manual-time/add-manual-time-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ export function AddManualTimeModal(props: IAddManualTimeModalProps) {
<form onSubmit={handleSubmit} className="text-sm w-[90%] md:w-full flex flex-col justify-between gap-4">
<div className="flex flex-col">
<label className="block text-gray-500 mb-1">
Date<span className="text-[#de5505e1] ml-1">*</span>
{t('manualTime.DATE')}<span className="text-[#de5505e1] ml-1">*</span>
</label>
<DatePicker
buttonVariant={'link'}
Expand All @@ -167,7 +167,7 @@ export function AddManualTimeModal(props: IAddManualTimeModalProps) {
"w-[230px] justify-start text-left font-normal text-black h-10 border border-transparent dark:border-transparent",
!date && "text-muted-foreground"
)}>
{date ? format(date, "PPP") : <span>Pick a date</span>}
{date ? format(date, "PPP") : <span>{t('manualTime.PICK_A_DATE')}</span>}
</Button>
</>
}
Expand Down Expand Up @@ -198,7 +198,7 @@ export function AddManualTimeModal(props: IAddManualTimeModalProps) {
<div className="flex items-center">
<div className=" w-[48%] mr-[4%]">
<label className="block text-gray-500 mb-1">
Start time<span className="text-[#de5505e1] ml-1">*</span>
{t('manualTime.START_TIME')}<span className="text-[#de5505e1] ml-1">*</span>
</label>
<input
type="time"
Expand All @@ -211,7 +211,7 @@ export function AddManualTimeModal(props: IAddManualTimeModalProps) {

<div className=" w-[48%]">
<label className="block text-gray-500 mb-1">
End time<span className="text-[#de5505e1] ml-1">*</span>
{t('manualTime.END_TIME')}<span className="text-[#de5505e1] ml-1">*</span>
</label>

<input
Expand All @@ -225,7 +225,7 @@ export function AddManualTimeModal(props: IAddManualTimeModalProps) {
</div>

<div className=" flex items-center">
<label className="block text-primary mb-1">{`${params === 'AddManuelTime' ? 'Total hours' : 'Added hours'}`}: </label>
<label className="block text-primary mb-1">{`${params === 'AddManuelTime' ? t('timer.TOTAL_HOURS') : t('manualTime.ADDED_HOURS')}`}: </label>
<div className="ml-[10px] p-1 flex items-center font-semibold dark:border-regal-rose pr-3">
<div className="mr-[10px] bg-gradient-to-tl text-[#3826A6] rounded-full ">
<IoTime
Expand All @@ -239,7 +239,7 @@ export function AddManualTimeModal(props: IAddManualTimeModalProps) {

<div className="">
<label className="block text-gray-500 mb-1">
Team<span className="text-[#de5505e1] ml-1">*</span>
{t('manualTime.TEAM')}<span className="text-[#de5505e1] ml-1">*</span>
</label>
<SelectItems
defaultValue={activeTeam!}
Expand All @@ -257,7 +257,7 @@ export function AddManualTimeModal(props: IAddManualTimeModalProps) {

<div className="">
<label className="block text-gray-500 mb-1">
Employee<span className="text-[#de5505e1] ml-1">*</span>
{t('manualTime.EMPLOYEE')}<span className="text-[#de5505e1] ml-1">*</span>
</label>
<SelectItems
items={activeTeam?.members ?? []}
Expand All @@ -270,7 +270,7 @@ export function AddManualTimeModal(props: IAddManualTimeModalProps) {

<div className="">
<label className="block text-gray-500 mb-1">
Task<span className="text-[#de5505e1] ml-1">*</span>
{t('manualTime.TASK')}<span className="text-[#de5505e1] ml-1">*</span>
</label>
<SelectItems
items={manualTimeReasons.map((reason) => t(`manualTime.reasons.${reason}`))}
Expand All @@ -282,7 +282,7 @@ export function AddManualTimeModal(props: IAddManualTimeModalProps) {
/>
</div>
<div className="flex flex-col">
<label className="block text-gray-500 shrink-0">Description (optional)</label>
<label className="block text-gray-500 shrink-0">{t('manualTime.DESCRIPTION')} ({t('manualTime.OPTIONAL')})</label>
<textarea
value={description}
placeholder="What did you worked on..."
Expand All @@ -296,7 +296,7 @@ export function AddManualTimeModal(props: IAddManualTimeModalProps) {

<div className="">
<label className="block text-gray-500 mb-1">
Task<span className="text-[#de5505e1] ml-1">*</span>
{t('manualTime.TASK')}<span className="text-[#de5505e1] ml-1">*</span>
</label>
<SelectItems
defaultValue={activeTeamTask}
Expand All @@ -309,7 +309,7 @@ export function AddManualTimeModal(props: IAddManualTimeModalProps) {
</div>

<div className="flex flex-col">
<label className="block text-gray-500 shrink-0">Description (optional)</label>
<label className="block text-gray-500 shrink-0">{t('manualTime.DESCRIPTION')} ({t('manualTime.OPTIONAL')})</label>
<textarea
value={description}
placeholder="What worked on? "
Expand All @@ -319,7 +319,7 @@ export function AddManualTimeModal(props: IAddManualTimeModalProps) {
</div>

<div className="">
<label className="block text-gray-500 mb-1">Reason (optional)</label>
<label className="block text-gray-500 mb-1">{t('manualTime.REASON')} ({t('manualTime.OPTIONAL')})</label>
<SelectItems
items={manualTimeReasons.map((reason) => t(`manualTime.reasons.${reason}`))}
onValueChange={(reason) => setReason(reason)}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { secondsToTime } from '@app/helpers';
import { IDailyPlan } from '@app/interfaces';
import { VerticalSeparator } from 'lib/components';
import { useTranslations } from 'next-intl';

interface ITaskEstimatedCount {
outstandingPlans: any[];
Expand All @@ -9,18 +10,19 @@ export function TaskEstimatedCount({ outstandingPlans }: ITaskEstimatedCount) {
const element = outstandingPlans?.map((plan: IDailyPlan) => plan.tasks?.map((task) => task));
const { timesEstimated, totalTasks } = estimatedTotalTime(element || []);
const { h: hour, m: minute } = secondsToTime(timesEstimated || 0);
const t = useTranslations()

return (
<div className="flex space-x-10">
<div className="flex space-x-2">
<span className="text-slate-600 dark:text-slate-200">Estimated:</span>
<span className="text-slate-600 dark:text-slate-200">{t('dailyPlan.ESTIMATED')} :</span>
<span className="text-slate-900 dark:text-slate-200 font-semibold text-[12px]">
{hour}h{minute}m
</span>
</div>
<VerticalSeparator className="border-slate-400" />
<div className="flex space-x-2">
<span className="text-slate-600 dark:text-slate-200">Total tasks:</span>
<span className="text-slate-600 dark:text-slate-200">{t('dailyPlan.TOTAL_TASK')}:</span>
<span className="text-slate-900 dark:text-slate-200 font-semibold text-[12px]">{totalTasks}</span>
</div>
</div>
Expand Down
6 changes: 4 additions & 2 deletions apps/web/lib/features/team/invite/invite-email-dropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { InviteEmailItem, mapTeamMemberItems } from './invite-email-item';
import { clsxm } from '@app/utils';
import { IInviteEmail } from '@app/interfaces';
import { useSyncRef } from '@app/hooks';
import { useTranslations } from 'next-intl';

export const InviteEmailDropdown = ({
emails,
Expand All @@ -18,7 +19,8 @@ export const InviteEmailDropdown = ({
selectedEmail: IInviteEmail | undefined;
error: string;
handleAddNew: (email: string) => void;
}) => {
}) => {
const t = useTranslations()
const items = useMemo(() => mapTeamMemberItems(emails), [emails]);
const $items = useSyncRef(items);

Expand Down Expand Up @@ -48,7 +50,7 @@ export const InviteEmailDropdown = ({
value={emailItem}
onChange={onChangeActive}
items={items}
placeholder={'Team member email address'}
placeholder={t('common.TEAM_MEMBER_EMAIL_ADDRESS')}
error={error}
handleAddNew={handleAddNew}
useHandleKeyUp={true}
Expand Down
23 changes: 14 additions & 9 deletions apps/web/lib/features/user-profile-plans.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,7 @@ export function PlanHeader({ plan, planMode }: { plan: IDailyPlan; planMode: Fil
const [time, setTime] = useState<number>(0);
const { updateDailyPlan, updateDailyPlanLoading } = useDailyPlan();
const { isTeamManager } = useAuthenticateUser();
const t = useTranslations()
// Get all tasks's estimations time
// Helper function to sum times
const sumTimes = (tasks: ITeamTask[], key: any) =>
Expand Down Expand Up @@ -396,7 +397,7 @@ export function PlanHeader({ plan, planMode }: { plan: IDailyPlan; planMode: Fil
{!editTime && !updateDailyPlanLoading ? (
<>
<div>
<span className="font-medium">Planned time: </span>
<span className="font-medium">{t('dailyPlan.PLANNED_TIME')} : </span>
<span className="font-semibold">{formatIntegerToHour(plan.workTimePlanned)}</span>
</div>
{(!checkPastDate(plan.date) || isTeamManager) && (
Expand Down Expand Up @@ -437,7 +438,7 @@ export function PlanHeader({ plan, planMode }: { plan: IDailyPlan; planMode: Fil
<VerticalSeparator className="h-10" />

<div className="flex items-center gap-2">
<span className="font-medium">Estimated time: </span>
<span className="font-medium">{t('dailyPlan.ESTIMATED_TIME')} : </span>
<span className="font-semibold">{formatIntegerToHour(estimatedTime / 3600)}</span>
</div>

Expand All @@ -446,7 +447,7 @@ export function PlanHeader({ plan, planMode }: { plan: IDailyPlan; planMode: Fil
{/* Total worked time for the plan */}
{planMode !== 'Future Tasks' && (
<div className="flex items-center gap-2">
<span className="font-medium">Total time worked: </span>
<span className="font-medium">{t('dailyPlan.TOTAL_TIME_WORKED')} : </span>
<span className="font-semibold">{formatIntegerToHour(totalWorkTime / 3600)}</span>
</div>
)}
Expand All @@ -457,15 +458,15 @@ export function PlanHeader({ plan, planMode }: { plan: IDailyPlan; planMode: Fil
{planMode !== 'Future Tasks' && (
<div>
<div className="flex items-center gap-2">
<span className="font-medium">Completed tasks: </span>
<span className="font-medium">{t('dailyPlan.COMPLETED_TASKS')} : </span>
<span className="font-medium">{`${completedTasks}/${totalTasks}`}</span>
</div>
<div className="flex items-center gap-2">
<span className="font-medium">Ready: </span>
<span className="font-medium">{t('dailyPlan.READY')}: </span>
<span className="font-medium">{readyTasks}</span>
</div>
<div className="flex items-center gap-2">
<span className="font-medium">Left: </span>
<span className="font-medium">{t('dailyPlan.LEFT')}: </span>
<span className="font-semibold">{totalTasks - completedTasks - readyTasks}</span>
</div>
</div>
Expand All @@ -477,7 +478,7 @@ export function PlanHeader({ plan, planMode }: { plan: IDailyPlan; planMode: Fil
{planMode !== 'Future Tasks' && (
<div className="flex flex-col gap-3">
<div className="flex items-center gap-2">
<span className="font-medium">Completion: </span>
<span className="font-medium">{t('dailyPlan.COMPLETION')}: </span>
<span className="font-semibold">{completionPercent}%</span>
</div>
<ProgressBar progress={`${completionPercent || 0}%`} showPercents={false} width="100%" />
Expand All @@ -488,7 +489,7 @@ export function PlanHeader({ plan, planMode }: { plan: IDailyPlan; planMode: Fil
{planMode === 'Future Tasks' && (
<div>
<div className="flex items-center gap-2">
<span className="font-medium">Planned tasks: </span>
<span className="font-medium">{t('dailyPlan.PLANNED_TASKS')}: </span>
<span className="font-semibold">{totalTasks}</span>
</div>
</div>
Expand All @@ -498,10 +499,14 @@ export function PlanHeader({ plan, planMode }: { plan: IDailyPlan; planMode: Fil
}

export function EmptyPlans({ planMode }: { planMode?: FilterTabs }) {
const t = useTranslations()

return (
<div className="xl:mt-20">
<NoData
text={`No task planned ${planMode === 'Today Tasks' ? 'today' : ''}`}
text={planMode == 'Today Tasks' ?
t('dailyPlan.NO_TASK_PLANNED_TODAY') :
t('dailyPlan.NO_TASK_PLANNED')}
component={<ReaderIcon className="w-14 h-14" />}
/>
</div>
Expand Down
2 changes: 1 addition & 1 deletion apps/web/lib/settings/default-issue-type-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ export const DefaultIssueTypeForm = () => {
</div>
) : (
<StatusesListCard
statusTitle={'No Default Issue Type'}
statusTitle={t('pages.settingsTeam.NO_DEFAULT_ISSUE_TYPE')}
bgColor={''}
statusIcon={''}
showDeleteButton={false}
Expand Down
27 changes: 26 additions & 1 deletion apps/web/locales/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@
"CANCEL": "إلغاء",
"DISCARD": "تجاهل",
"EXISTING_MEMBER": "عضو بالفعل",
"TEAM_MEMBER_EMAIL_ADDRESS": "عنوان البريد الإلكتروني لعضو الفريق",
"NEW_MEMBER": "أصبح عضوًا",
"BACK": "رجوع",
"JOIN_REQUEST": "طلب الانضمام",
Expand Down Expand Up @@ -421,7 +422,8 @@
"VERSIONS": "الإصدارات",
"LIST_OF_VERSONS": "قائمة الإصدارات",
"ISSUETYPE": "أنواع القضايا",
"DEFAULT_ISSUE_TYPE": "Default Issue Type",
"DEFAULT_ISSUE_TYPE": "نوع المشكلة الافتراضي",
"NO_DEFAULT_ISSUE_TYPE": "لا يوجد نوع مشكلة افتراضي",
"LIST_OF_ISSUES": "قائمة القضايا",
"RELATED_ISSUE_TYPE": "أنواع القضايا ذات الصلة",
"LIST_OF_RELATED_TYPE": "قائمة الأنواع ذات الصلة",
Expand Down Expand Up @@ -589,6 +591,18 @@
"REMOVE_FROM_THIS_PLAN": "إزالة من هذه الخطة",
"CREATE_A_PLAN_FOR_TODAY": "إنشاء خطة لليوم",
"TODAY_PLAN_SUB_TITLE": "لا توجد خطة لليوم",
"NO_TASK_PLANNED": "لم يتم التخطيط لأي مهمة",
"NO_TASK_PLANNED_TODAY": "لم يتم التخطيط لأي مهمة اليوم",
"PLANNED_TIME": "الوقت المخطط",
"ESTIMATED_TIME": "الوقت المقدر",
"TOTAL_TIME_WORKED": "إجمالي الوقت المستغرق",
"COMPLETED_TASKS": "المهام المكتملة",
"READY": "جاهز",
"LEFT": "متبقي",
"COMPLETION": "إتمام",
"PLANNED_TASKS": "المهمة المخططة",
"ESTIMATED": "تقديري",
"TOTAL_TASK": "إجمالي المهام",
"DAILY_PLAN_DESCRIPTION": "'الخطة اليومية' تساعد في تنظيم عملية العمل لتحقيق أفضل النتائج",
"SUGGESTS_TO_ADD_TASK_TO_TODAY_PLAN": "لم تكن هذه المهمة مخططة لخطة اليوم. هل ترغب في إضافة شيء إلى الخطة؟"
},
Expand Down Expand Up @@ -652,6 +666,17 @@
}
},
"manualTime": {
"ADDED_HOURS": "الساعات المضافة",
"DATE": "التاريخ",
"PICK_A_DATE": "اختر تاريخًا",
"START_TIME": "وقت البدء",
"END_TIME": "وقت الانتهاء",
"TEAM": "فريق",
"EMPLOYEE": "موظف",
"TASK": "مهمة",
"DESCRIPTION": "وصف",
"OPTIONAL": "اختياري",
"REASON": "السبب",
"reasons": {
"DEFAULT": "فقط الوقت اليدوي",
"LOST_ELECTRICITY": "انقطاع الكهرباء",
Expand Down
27 changes: 26 additions & 1 deletion apps/web/locales/bg.json
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@
"EXISTING_MEMBER": "Вече член",
"NEW_MEMBER": "Стани член",
"BACK": "Назад",
"TEAM_MEMBER_EMAIL_ADDRESS": "Имейл адрес на член на екипа",
"JOIN_REQUEST": "Искане за присъединяване",
"DONT_HAVE_ACCOUNT": "Нямате профил?",
"REGISTER": "Регистрация",
Expand Down Expand Up @@ -421,7 +422,8 @@
"VERSIONS": "Версии",
"LIST_OF_VERSONS": "Списък с версии",
"ISSUETYPE": "Типове проблеми",
"DEFAULT_ISSUE_TYPE": "Default Issue Type",
"DEFAULT_ISSUE_TYPE": "Тип на проблема по подразбиране",
"NO_DEFAULT_ISSUE_TYPE": "Няма тип на проблема по подразбиране",
"LIST_OF_ISSUES": "Списък с проблеми",
"RELATED_ISSUE_TYPE": "Свързани типове проблеми",
"LIST_OF_RELATED_TYPE": "Списък със свързани типове",
Expand Down Expand Up @@ -589,6 +591,18 @@
"REMOVE_FROM_THIS_PLAN": "Премахни от този план",
"CREATE_A_PLAN_FOR_TODAY": "Създайте план за днес",
"TODAY_PLAN_SUB_TITLE": "Няма план за днес",
"NO_TASK_PLANNED": "Няма планирана задача",
"NO_TASK_PLANNED_TODAY": "Няма планирана задача Днес",
"PLANNED_TIME": "Планирано време",
"ESTIMATED_TIME": "Оценено време",
"TOTAL_TIME_WORKED": "Общо отработено време",
"COMPLETED_TASKS": "Завършени задачи",
"READY": "Готов",
"LEFT": "Останало",
"COMPLETION": "Завършване",
"PLANNED_TASKS": "Планирана задача",
"ESTIMATED": "Оценено",
"TOTAL_TASK": "Общо задачи",
"DAILY_PLAN_DESCRIPTION": "'Дневният план' помага да се организира работният процес за постигане на най-добри резултати",
"SUGGESTS_TO_ADD_TASK_TO_TODAY_PLAN": "Тази задача не беше планирана за днешния план. Искате ли да добавите към плана?"
},
Expand Down Expand Up @@ -652,6 +666,17 @@
}
},
"manualTime": {
"ADDED_HOURS": "Добавени часове",
"DATE": "Дата",
"PICK_A_DATE": "Изберете дата",
"START_TIME": "Начален час",
"END_TIME": "Краен час",
"TEAM": "Екип",
"EMPLOYEE": "Служител",
"TASK": "Задача",
"DESCRIPTION": "Описание",
"OPTIONAL": "По избор",
"REASON": "Причина",
"reasons": {
"DEFAULT": "Само ръчно време",
"LOST_ELECTRICITY": "Изгубено електрическо захранване",
Expand Down
Loading

0 comments on commit ae832b5

Please sign in to comment.