Skip to content

Commit

Permalink
feat: add multi-language translations for task-related terms and proj…
Browse files Browse the repository at this point in the history
…ect actions
  • Loading branch information
Innocent-Akim committed Dec 12, 2024
1 parent b6cded9 commit 75af5ca
Show file tree
Hide file tree
Showing 20 changed files with 199 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export function AddTaskModal({ closeModal, isOpen }: IAddTaskModalProps) {
<Modal
isOpen={isOpen}
closeModal={closeModal}
title={'+ Add Time Entry'}
title={`+ ${t('common.ADD_TIME_ENTRY')}`}
showCloseIcon
className="bg-light--theme-light dark:bg-dark--theme-light p-5 rounded-xl w-full md:w-40 md:min-w-[32rem] justify-start h-[auto]"
titleClass="font-bold flex justify-start w-full">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const TimesheetButton = ({ className, icon, onClick, title, disabled }: I
}


export type StatusType = "Pending" | "Approved" | "Denied";
export type StatusType = "PENDING" | "APPROVED" | "Denied";
export type StatusAction = "Deleted" | "Approved" | "Denied";


Expand All @@ -36,12 +36,12 @@ export type StatusAction = "Deleted" | "Approved" | "Denied";
export const getTimesheetButtons = (status: StatusType, t: TranslationHooks, disabled: boolean, onClick: (action: StatusAction) => void) => {

const buttonsConfig: Record<StatusType, { icon: JSX.Element; title: string; action: StatusAction }[]> = {
Pending: [
PENDING: [
{ icon: <FaClipboardCheck className="!text-[#2932417c] dark:!text-gray-400 rounded" />, title: t('pages.timesheet.TIMESHEET_ACTION_APPROVE_SELECTED'), action: "Approved" },
{ icon: <IoClose className="!bg-[#2932417c] dark:!bg-gray-400 rounded" />, title: t('pages.timesheet.TIMESHEET_ACTION_REJECT_SELECTED'), action: "Denied" },
{ icon: <RiDeleteBin6Fill className="!text-[#2932417c] dark:!text-gray-400 rounded" />, title: t('pages.timesheet.TIMESHEET_ACTION_DELETE_SELECTED'), action: "Deleted" }
],
Approved: [
APPROVED: [
{ icon: <IoClose className="!bg-[#2932417c] dark:!bg-gray-400 rounded" />, title: t('pages.timesheet.TIMESHEET_ACTION_REJECT_SELECTED'), action: "Denied" },
{ icon: <RiDeleteBin6Fill className="!text-[#2932417c] dark:!text-gray-400 rounded" />, title: t('pages.timesheet.TIMESHEET_ACTION_DELETE_SELECTED'), action: "Deleted" }
],
Expand Down
6 changes: 3 additions & 3 deletions apps/web/app/[locale]/timesheet/[memberId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -145,15 +145,15 @@ const TimeSheet = React.memo(function TimeSheetPage({ params }: { params: { memb
<div className="flex items-center justify-between w-full gap-6 pt-4">
<TimesheetCard
count={statusTimesheet.PENDING.length}
title="Pending Tasks"
title={t('common.PENDING_TASKS')}
description="Tasks waiting for your approval"
icon={<GrTask className="font-bold" />}
classNameIcon="bg-[#FBB650] shadow-[#fbb75095]"
onClick={() => openTimesheetDetail()}
/>
<TimesheetCard
hours={`${hours}:${minute}`}
title="Men Hours"
title={t('common.MEN_HOURS')}
date={`${moment(dateRange.from).format('YYYY-MM-DD')} - ${moment(dateRange.to).format('YYYY-MM-DD')}`}
icon={<Clock className="font-bold" />}
classNameIcon="bg-[#3D5A80] shadow-[#3d5a809c] "
Expand All @@ -164,7 +164,7 @@ const TimeSheet = React.memo(function TimeSheetPage({ params }: { params: { memb
.map(entry => entry.employee.id)
.filter((id, index, array) => array.indexOf(id) === index)
.length}
title="Members Worked"
title={t('common.MEMBERS_WORKED')}
description="People worked since last time"
icon={<User2 className="font-bold" />}
classNameIcon="bg-[#30B366] shadow-[#30b3678f]"
Expand Down
8 changes: 4 additions & 4 deletions apps/web/components/nav-projects.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export function NavProjects({
const t = useTranslations();
return userManagedTeams && userManagedTeams.length > 0 ? (
<SidebarGroup className="group-data-[collapsible=icon]:hidden">
<SidebarGroupLabel>Projects</SidebarGroupLabel>
<SidebarGroupLabel>{t('sidebar.PROJECTS')}</SidebarGroupLabel>
<SidebarMenu className="w-full max-w-[230px]">
{projects && projects.length ? (
<>
Expand All @@ -67,16 +67,16 @@ export function NavProjects({
>
<DropdownMenuItem>
<Folder className="text-muted-foreground" />
<span>View Project</span>
<span>{t('common.VIEW_PROJECT')}</span>
</DropdownMenuItem>
<DropdownMenuItem>
<Forward className="text-muted-foreground" />
<span>Share Project</span>
<span>{t('common.SHARE_PROJECT')}</span>
</DropdownMenuItem>
<DropdownMenuSeparator />
<DropdownMenuItem>
<Trash2 className="text-muted-foreground" />
<span>Delete Project</span>
<span>{t('common.DELETE_PROJECT')}</span>
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,14 @@ const TaskProgress = () => {
const matchingMembers:
| OT_Member[]
| undefined = activeTeam?.members.filter((member) =>
task?.members.some((taskMember) => taskMember.id === member.employeeId)
);
task?.members.some((taskMember) => taskMember.id === member.employeeId)
);

const usersTaskArray:
| ITasksTimesheet[]
| undefined = matchingMembers
?.flatMap((obj) => obj.totalWorkedTasks)
.filter((taskObj) => taskObj?.id === task?.id);
?.flatMap((obj) => obj.totalWorkedTasks)
.filter((taskObj) => taskObj?.id === task?.id);

const usersTotalTimeInSeconds: number | undefined = usersTaskArray?.reduce(
(totalDuration, item) => totalDuration + item.duration,
Expand All @@ -100,9 +100,9 @@ const TaskProgress = () => {

const remainingTime: number =
task?.estimate === null ||
task?.estimate === 0 ||
task?.estimate === undefined ||
usersTotalTimeInSeconds === undefined
task?.estimate === 0 ||
task?.estimate === undefined ||
usersTotalTimeInSeconds === undefined
? 0
: task?.estimate - usersTotalTimeInSeconds;

Expand All @@ -121,7 +121,7 @@ const TaskProgress = () => {
isAuthUser={true}
activeAuthTask={true}
showPercents={true}
// memberInfo={memberInfo}
// memberInfo={memberInfo}
/>
</TaskRow>
<TaskRow labelTitle={t('pages.taskDetails.TOTAL_TIME')}>
Expand Down Expand Up @@ -169,7 +169,7 @@ const TaskProgress = () => {
}
className="text-xs"
>
Show More
{t('common.SHOW_MORE')}
</button>
</div>
)}
Expand Down Expand Up @@ -201,8 +201,8 @@ const IndividualMembersTotalTime = ({
const matchingMembers:
| OT_Member[]
| undefined = activeTeam?.members.filter((member) =>
task?.members.some((taskMember) => taskMember.id === member.employeeId)
);
task?.members.some((taskMember) => taskMember.id === member.employeeId)
);

const findUserTotalWorked = (user: OT_Member, id: string | undefined) => {
return (
Expand Down
6 changes: 4 additions & 2 deletions apps/web/components/sidebar-opt-in-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ import { Form, FormControl, FormField, FormItem, FormMessage } from '@/component
import { ToastAction } from './ui/toast';
import { toast } from './ui/use-toast';
import { useState } from 'react';
import { useTranslations } from 'next-intl';

export function SidebarOptInForm() {
const t = useTranslations();
const { state } = useSidebar();
const [isLoading, setLoading] = useState(false);
const subscribeFormSchema = z
Expand Down Expand Up @@ -73,9 +75,9 @@ export function SidebarOptInForm() {
<Card className="p-1 mt-auto shadow-none">
<form onSubmit={form.handleSubmit(onSubmit)}>
<CardHeader className="flex flex-col gap-1 p-4 pb-0">
<CardTitle className="text-sm font-medium">Subscribe to our newsletter</CardTitle>
<CardTitle className="text-sm font-medium">{t('common.SUBSCRIBE_NEWSLETTER')}</CardTitle>
<CardDescription className="text-xs">
Opt-in to receive updates and news about Ever Teams.
{t('common.OPT_IN_UPDATES')}
</CardDescription>
</CardHeader>
<CardContent className="grid gap-2.5 p-4">
Expand Down
8 changes: 4 additions & 4 deletions apps/web/lib/components/Kanban.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -299,13 +299,13 @@ export const EmptyKanbanDroppable = ({
className="hover:font-medium p-1.5 text-sm cursor-pointer"
onClick={() => toggleColumn(title, false)}
>
Collapse Column
{t('common.COLLAPSE_COLUMN')}
</div>
<div
className="hover:font-medium p-1.5 text-sm cursor-pointer"
onClick={editOpenModal}
>
Edit Status
{t('common.EDIT_STATUS')}
</div>
</PopoverContent>
</Popover>
Expand Down Expand Up @@ -423,10 +423,10 @@ const KanbanDraggableHeader = ({
className="hover:font-medium p-1.5 text-sm cursor-pointer"
onClick={() => toggleColumn(title, true)}
>
Collapse Column
{t('common.COLLAPSE_COLUMN')}
</div>
<div className="hover:font-medium p-1.5 text-sm cursor-pointer" onClick={openModal}>
Edit Status
{t('common.EDIT_STATUS')}
</div>
</PopoverContent>
</Popover>
Expand Down
13 changes: 13 additions & 0 deletions apps/web/locales/ar.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
{
"TITLE": "إيفر تيمز",
"common": {
"PENDING_TASKS": "المهام المعلقة",
"SHOW_MORE": "عرض المزيد",
"TASKS": "المهام",
"MEN_HOURS": "ساعات العمل",
"MEMBERS_WORKED": "الأعضاء الذين عملوا",
"COLLAPSE_COLUMN": "طي العمود",
"EDIT_STATUS": "تعديل الحالة",
"ADD_TIME_ENTRY": "إضافة إدخال وقت",
"OPT_IN_UPDATES": "اشترك لتلقي التحديثات والأخبار حول Ever Teams.",
"SUBSCRIBE_NEWSLETTER": "اشترك في النشرة الإخبارية",
"VIEW_PROJECT": "عرض المشروع",
"SHARE_PROJECT": "مشاركة المشروع",
"DELETE_PROJECT": "حذف المشروع",
"DELETE_CONFIRMATION": "هل أنت متأكد أنك تريد الحذف؟",
"IRREVERSIBLE_ACTION_WARNING": "هذا الإجراء لا رجعة فيه. ستفقد جميع البيانات ذات الصلة.",
"SHIFT_TIMING": "توقيت العمل",
Expand Down
13 changes: 13 additions & 0 deletions apps/web/locales/bg.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,19 @@
"PROJECT_BUDGET": "Бюджет на проекта"
},
"common": {
"PENDING_TASKS": "Чакащи задачи",
"SHOW_MORE": "Покажи още",
"TASKS": "Задачи",
"MEN_HOURS": "Човеко-часове",
"MEMBERS_WORKED": "Работили членове",
"COLLAPSE_COLUMN": "Свий колона",
"EDIT_STATUS": "Редактирай статус",
"ADD_TIME_ENTRY": "Добавяне на запис на време",
"OPT_IN_UPDATES": "Абонирайте се за актуализации и новини за Ever Teams.",
"SUBSCRIBE_NEWSLETTER": "Абонирайте се за нашия бюлетин",
"VIEW_PROJECT": "Преглед на проекта",
"SHARE_PROJECT": "Споделяне на проекта",
"DELETE_PROJECT": "Изтриване на проекта",
"DELETE_CONFIRMATION": "Сигурни ли сте, че искате да изтриете това?",
"IRREVERSIBLE_ACTION_WARNING": "Това действие е необратимо. Всички свързани данни ще бъдат изгубени.",
"SHIFT_TIMING": "Смяна на времето",
Expand Down
13 changes: 13 additions & 0 deletions apps/web/locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,19 @@
"PROJECT_BUDGET": "Projektbudget"
},
"common": {
"PENDING_TASKS": "Ausstehende Aufgaben",
"SHOW_MORE": "Mehr anzeigen",
"TASKS": "Aufgaben",
"MEN_HOURS": "Mannstunden",
"MEMBERS_WORKED": "Mitglieder gearbeitet",
"COLLAPSE_COLUMN": "Spalte einklappen",
"EDIT_STATUS": "Status bearbeiten",
"ADD_TIME_ENTRY": "Zeiteintrag hinzufügen",
"OPT_IN_UPDATES": "Abonnieren Sie Updates und Nachrichten zu Ever Teams.",
"SUBSCRIBE_NEWSLETTER": "Abonnieren Sie unseren Newsletter",
"VIEW_PROJECT": "Projekt anzeigen",
"SHARE_PROJECT": "Projekt teilen",
"DELETE_PROJECT": "Projekt löschen",
"DELETE_CONFIRMATION": "Sind Sie sicher, dass Sie dies löschen möchten?",
"IRREVERSIBLE_ACTION_WARNING": "Diese Aktion ist irreversibel. Alle zugehörigen Daten gehen verloren.",
"SHIFT_TIMING": "Schichtzeiten",
Expand Down
13 changes: 13 additions & 0 deletions apps/web/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,19 @@
"PROJECT_BUDGET": "Project Budget"
},
"common": {
"PENDING_TASKS": "Pending Tasks",
"SHOW_MORE": "Show More",
"TASKS": "Tasks",
"MEN_HOURS": "Men Hours",
"MEMBERS_WORKED": "Members Worked",
"COLLAPSE_COLUMN": "Collapse Column",
"EDIT_STATUS": "Edit Status",
"ADD_TIME_ENTRY": "Add Time Entry",
"OPT_IN_UPDATES": "Opt-in to receive updates and news about Ever Teams.",
"SUBSCRIBE_NEWSLETTER": "Subscribe to our newsletter",
"VIEW_PROJECT": "View Project",
"SHARE_PROJECT": "Share Project",
"DELETE_PROJECT": "Delete Project",
"DELETE_CONFIRMATION": "Are you sure you want to delete this?",
"IRREVERSIBLE_ACTION_WARNING": "This action is irreversible. All related data will be lost.",
"SHIFT_TIMING": "Shift Timing",
Expand Down
13 changes: 13 additions & 0 deletions apps/web/locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,19 @@
"PROJECT_BUDGET": "Presupuesto del Proyecto"
},
"common": {
"PENDING_TASKS": "Tareas pendientes",
"SHOW_MORE": "Mostrar más",
"TASKS": "Tareas",
"MEN_HOURS": "Horas Hombre",
"MEMBERS_WORKED": "Miembros que trabajaron",
"COLLAPSE_COLUMN": "Colapsar columna",
"EDIT_STATUS": "Editar estado",
"ADD_TIME_ENTRY": "Agregar entrada de tiempo",
"OPT_IN_UPDATES": "Opta por recibir actualizaciones y noticias sobre Ever Teams.",
"SUBSCRIBE_NEWSLETTER": "Suscríbete a nuestro boletín",
"VIEW_PROJECT": "Ver proyecto",
"SHARE_PROJECT": "Compartir proyecto",
"DELETE_PROJECT": "Eliminar proyecto",
"DELETE_CONFIRMATION": "¿Estás seguro de que deseas eliminar esto?",
"IRREVERSIBLE_ACTION_WARNING": "Esta acción es irreversible. Todos los datos relacionados se perderán.",
"SHIFT_TIMING": "Horario de turno",
Expand Down
13 changes: 13 additions & 0 deletions apps/web/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,19 @@
"PROJECT_BUDGET": "Budget du projet"
},
"common": {
"PENDING_TASKS": "Tâches en attente",
"SHOW_MORE": "Voir plus",
"TASKS": "Tâches",
"MEN_HOURS": "Heures Homme",
"MEMBERS_WORKED": "Membres ayant travaillé",
"COLLAPSE_COLUMN": "Réduire la colonne",
"EDIT_STATUS": "Modifier le statut",
"ADD_TIME_ENTRY": "Ajouter une entrée de temps",
"OPT_IN_UPDATES": "Acceptez de recevoir des mises à jour et des nouvelles sur Ever Teams.",
"SUBSCRIBE_NEWSLETTER": "Abonnez-vous à notre newsletter",
"VIEW_PROJECT": "Voir le projet",
"SHARE_PROJECT": "Partager le projet",
"DELETE_PROJECT": "Supprimer le projet",
"DELETE_CONFIRMATION": "Êtes-vous sûr de vouloir supprimer cela ?",
"IRREVERSIBLE_ACTION_WARNING": "Cette action est irréversible. Toutes les données associées seront perdues.",
"SHIFT_TIMING": "Temps de poste",
Expand Down
13 changes: 13 additions & 0 deletions apps/web/locales/he.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,19 @@
"PROJECT_BUDGET": "תקציב פרויקט"
},
"common": {
"PENDING_TASKS": "משימות ממתינות",
"SHOW_MORE": "הצג עוד",
"TASKS": "משימות",
"MEN_HOURS": "שעות עבודה",
"MEMBERS_WORKED": "חברים שעבדו",
"COLLAPSE_COLUMN": "כווץ עמודה",
"EDIT_STATUS": "ערוך סטטוס",
"ADD_TIME_ENTRY": "הוסף כניסת זמן",
"OPT_IN_UPDATES": "בחר לקבל עדכונים וחדשות על Ever Teams.",
"SUBSCRIBE_NEWSLETTER": "הירשם לניוזלטר שלנו",
"VIEW_PROJECT": "צפה בפרויקט",
"SHARE_PROJECT": "שתף פרויקט",
"DELETE_PROJECT": "מחק פרויקט",
"DELETE_CONFIRMATION": "האם אתה בטוח שברצונך למחוק?",
"IRREVERSIBLE_ACTION_WARNING": "פעולה זו בלתי הפיכה. כל הנתונים הקשורים יימחקו.",
"SHIFT_TIMING": "זמן משמרת",
Expand Down
13 changes: 13 additions & 0 deletions apps/web/locales/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,19 @@
"PROJECT_BUDGET": "Budget di progetto"
},
"common": {
"PENDING_TASKS": "Compiti in sospeso",
"SHOW_MORE": "Mostra di più",
"TASKS": "Compiti",
"MEN_HOURS": "Ore Uomo",
"MEMBERS_WORKED": "Membri che hanno lavorato",
"COLLAPSE_COLUMN": "Comprimi colonna",
"EDIT_STATUS": "Modifica stato",
"ADD_TIME_ENTRY": "Aggiungi voce di tempo",
"OPT_IN_UPDATES": "Acconsenti a ricevere aggiornamenti e notizie su Ever Teams.",
"SUBSCRIBE_NEWSLETTER": "Iscriviti alla nostra newsletter",
"VIEW_PROJECT": "Visualizza progetto",
"SHARE_PROJECT": "Condividi progetto",
"DELETE_PROJECT": "Elimina progetto",
"DELETE_CONFIRMATION": "Sei sicuro di voler eliminare questo elemento?",
"IRREVERSIBLE_ACTION_WARNING": "Questa azione è irreversibile. Tutti i dati correlati andranno persi.",
"SHIFT_TIMING": "Orario di turno",
Expand Down
13 changes: 13 additions & 0 deletions apps/web/locales/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,19 @@
"PROJECT_BUDGET": "Projectbudget"
},
"common": {
"PENDING_TASKS": "In afwachting Taken",
"SHOW_MORE": "Meer weergeven",
"TASKS": "Taken",
"MEN_HOURS": "Manuren",
"MEMBERS_WORKED": "Leden gewerkt",
"COLLAPSE_COLUMN": "Kolom samenvouwen",
"EDIT_STATUS": "Status bewerken",
"ADD_TIME_ENTRY": "Tijdinvoer toevoegen",
"OPT_IN_UPDATES": "Kies ervoor om updates en nieuws over Ever Teams te ontvangen.",
"SUBSCRIBE_NEWSLETTER": "Abonneer je op onze nieuwsbrief",
"VIEW_PROJECT": "Project bekijken",
"SHARE_PROJECT": "Project delen",
"DELETE_PROJECT": "Project verwijderen",
"DELETE_CONFIRMATION": "Weet u zeker dat u dit wilt verwijderen?",
"IRREVERSIBLE_ACTION_WARNING": "Deze actie is onomkeerbaar. Alle gerelateerde gegevens gaan verloren.",
"SHIFT_TIMING": "Werkrooster",
Expand Down
Loading

0 comments on commit 75af5ca

Please sign in to comment.