From 0296e3a2525c2efdf369efb05343cb3c1b021496 Mon Sep 17 00:00:00 2001 From: NotHydra Date: Wed, 21 Feb 2024 10:31:46 +0800 Subject: [PATCH] chore: translation --- apps/app/src/components/operator-tabs.tsx | 3 +- apps/app/src/components/trashbin-tabs.tsx | 2 +- apps/app/src/locales/en.json | 174 ++++++++++-------- apps/app/src/locales/id.json | 148 ++++++++------- .../pages/complain/form/report-feedback.tsx | 9 +- .../pages/complain/form/report-history.tsx | 13 +- apps/app/src/pages/operator/dashboard.tsx | 5 +- .../trashbin/create-trashbin.page.tsx | 2 +- 8 files changed, 198 insertions(+), 158 deletions(-) diff --git a/apps/app/src/components/operator-tabs.tsx b/apps/app/src/components/operator-tabs.tsx index c7ecff8..39beb2e 100644 --- a/apps/app/src/components/operator-tabs.tsx +++ b/apps/app/src/components/operator-tabs.tsx @@ -1,4 +1,5 @@ import { Redirect, Route } from "react-router-dom"; +import { t } from "i18next"; import { IonRouterOutlet, IonTabs, IonTabBar, IonTabButton, IonLabel } from "@ionic/react"; import { Icons, OperatorContext } from "@trashtrack/ui"; @@ -34,7 +35,7 @@ const OperatorTabs: React.FC = () => { - Trashbin + {t("tabs.trashbin")} {/* {isAdmin && ( diff --git a/apps/app/src/components/trashbin-tabs.tsx b/apps/app/src/components/trashbin-tabs.tsx index c658e1f..68c27d5 100644 --- a/apps/app/src/components/trashbin-tabs.tsx +++ b/apps/app/src/components/trashbin-tabs.tsx @@ -100,7 +100,7 @@ const TrashbinTabs: React.FC = () => { - Trashbin + {t("tabs.trashbin")} {/* diff --git a/apps/app/src/locales/en.json b/apps/app/src/locales/en.json index 2f96a12..86fcdfa 100644 --- a/apps/app/src/locales/en.json +++ b/apps/app/src/locales/en.json @@ -7,6 +7,7 @@ "preferences": "Preferences", "laporkan": "Report", "riwayat": "History", + "trashbin": "Trash Bin", "report": "Report", "back": "Back" }, @@ -54,6 +55,19 @@ "report": "Report" } } + }, + "history": { + "for" : "Report for:", + "notResponded": "Not Responded", + "accepted": "Accepted", + "rejected": "Rejected", + "completed": "Completed" + }, + "feedback": { + "subtitle": "Feedback", + "back": "Back", + "noFeedback": "No feedbacks", + "createdAt": "Created:" } }, "operator": { @@ -69,73 +83,17 @@ } } }, - "reports": { - "subtitle": "Reports", - "search": "Search Trashbin", - "from": "Report from: ", - "for": "For: ", - "notResponded": "Not Responded", - "accepted": "Accepted", - "rejected": "Rejected", - "completed": "Completed", - "no_reports": "No reports found.", - "detailed": { - "subtitle": "detailed view of the report.", - "input": { - "reporter": "Reporter Identity", - "name": "Reporter", - "no": "Telephone Number", - "info": "Report Information", - "description": "Report Description", - "status": "Report Status", - "photo": "Report Photo", - "submitFeedback": "Submit Feedback", - "actions": { - "title": "Report Actions", - "loading": "Loading...", - "accept": "Accept", - "reject": "Reject", - "cancel": "Cancel", - "complete": "Complete" - } - } - }, - "feedback": { - "delete": { - "warning": { - "title": "Are you sure you want to delete this feedback?", - "subtitle": "This action is irreversible.", - "pending": "Pending...", - "delete": "Delete", - "cancel": "Cancel" - }, - "subtitle": "Feedback", - "create": "Create a new feedback", - "back": "Back", - "noResults": "No feedback found for this report.", - "created": "Created: ", - "delete": "Delete", - "createFeedback": { - "subtitle": "Create Feedback", - "title": "Title", - "description": "Description", - "submit": "Submit Feedback", - "cancel": "Cancel", - "validation": { - "title": "Title must be at least 8 characters long.", - "subtitle": "Description must be at least 8 characters long." - } - } - } - } + "dashboard": { + "login": "Back to Login", + "home": "Back to Home" }, "trashbin": { - "subtitle": "Trashbins", - "create": "Create a new trashbin", - "search": "Search Trashbin", - "noResults": "No trashbin found for the search.", - "view_trashbin": "View Trashbin", - "view_subtrashbin": "View Subtrashbin", + "subtitle": "Trash Bin", + "create": "Create a new trash bin", + "search": "Search Trash Bin", + "noResults": "No trash bin found for the search.", + "view_trashbin": "View Trash Bin", + "view_subtrashbin": "View Sub Trash Bin", "detailed": { "name": "Name", "description": "Description", @@ -152,12 +110,12 @@ } }, "create_trashbin": { - "subtitle": "Create Trashbin", + "subtitle": "Create Trash Bin", "name": "Name", "description": "Description", "latitude": "Latitude", "longitude": "Longitude", - "submit": "Create Trashbin", + "submit": "Create Trash Bin", "back": "Back", "validation": { "name": "Name must be at least 8 characters long.", @@ -173,12 +131,12 @@ } }, "change_trashbin": { - "subtitle": "Change Trashbin", + "subtitle": "Change Trash Bin", "name": "Name", "description": "Description", "latitude": "Latitude", "longitude": "Longitude", - "submit": "Update Trashbin", + "submit": "Update Trash Bin", "back": "Back", "validation": { "name": "Name must be at least 8 characters long.", @@ -195,12 +153,12 @@ } }, "subtrashbin": { - "subtitle": "Sub trashbins", - "create": "Create a new sub trashbin", - "search": "Search sub trashbin", + "subtitle": "Sub Trash Bin", + "create": "Create a new sub trash bin", + "search": "Search sub trash bin", "back": "Back", - "noResults": "No sub trashbin found for the search.", - "view_subtrashbin": "View Subtrashbin", + "noResults": "No sub trash bin found for the search.", + "view_subtrashbin": "View Sub Trash Bin", "view_trash": "View Trash", "view_history": "View History", "trash": { @@ -230,23 +188,83 @@ } }, "create_subtrashbin": { - "subtitle": "Create Sub trashbin", + "subtitle": "Create Sub Trash Bin", "name": "Name", - "submit": "Create Sub trashbin", + "submit": "Create Sub Trash Bin", "back": "Back", "validation": { "name": "Name must be at least 8 characters long." } }, "update_subtrashbin": { - "subtitle": "Update Sub trashbin", + "subtitle": "Update Sub Trash Bin", "name": "Name", - "submit": "Update Sub trashbin", + "submit": "Update Sub Trash Bin", "back": "Back", "validation": { "name": "Name must be at least 8 characters long." } } + }, + "reports": { + "subtitle": "Reports", + "search": "Search Trash Bin", + "from": "Report from: ", + "for": "For: ", + "notResponded": "Not Responded", + "accepted": "Accepted", + "rejected": "Rejected", + "completed": "Completed", + "no_reports": "No reports found.", + "detailed": { + "subtitle": "Detailed view of the report.", + "input": { + "reporter": "Reporter Identity", + "name": "Reporter", + "no": "Telephone Number", + "info": "Report Information", + "description": "Report Description", + "status": "Report Status", + "photo": "Report Photo", + "submitFeedback": "Submit Feedback", + "actions": { + "title": "Report Actions", + "loading": "Loading...", + "accept": "Accept", + "reject": "Reject", + "cancel": "Cancel", + "complete": "Complete" + } + } + }, + "feedback": { + "delete": { + "warning": { + "title": "Are you sure you want to delete this feedback?", + "subtitle": "This action is irreversible.", + "pending": "Pending...", + "delete": "Delete", + "cancel": "Cancel" + }, + "subtitle": "Feedback", + "create": "Create a new feedback", + "back": "Back", + "noResults": "No feedback found for this report.", + "created": "Created: ", + "delete": "Delete", + "createFeedback": { + "subtitle": "Create Feedback", + "title": "Title", + "description": "Description", + "submit": "Submit Feedback", + "cancel": "Cancel", + "validation": { + "title": "Title must be at least 8 characters long.", + "subtitle": "Description must be at least 8 characters long." + } + } + } + } } } } diff --git a/apps/app/src/locales/id.json b/apps/app/src/locales/id.json index e5d6ee6..f6bbbcb 100644 --- a/apps/app/src/locales/id.json +++ b/apps/app/src/locales/id.json @@ -7,6 +7,7 @@ "preferences": "Preferensi", "laporkan": "Laporan", "riwayat": "Riwayat", + "trashbin": "Tempat Sampah", "report": "Laporan", "back": "Kembali" }, @@ -54,6 +55,19 @@ "report": "Laporkan" } } + }, + "history": { + "for" : "Laporan untuk:", + "notResponded": "Belum Ditanggapi", + "accepted": "Diterima", + "rejected": "Ditolak", + "completed": "Selesai" + }, + "feedback": { + "subtitle": "Tanggapan", + "back": "Kembali", + "noFeedback": "Tidak ada tanggapan", + "createdAt": "Dibuat:" } }, "operator": { @@ -69,65 +83,9 @@ } } }, - "reports": { - "subtitle": "Laporan", - "search": "Cari tempat sampah", - "from": "Laporan dari: ", - "for": "Untuk: ", - "notResponded": "Belum Ditanggapi", - "accepted": "Diterima", - "rejected": "Ditolak", - "completed": "Selesai", - "no_reports": "Tidak ada laporan ditemukan.", - "detailed": { - "subtitle": "Tampilan laporan secara detail.", - "input": { - "reporter": "Identitas Pelaporan", - "name": "Pelapor", - "no": "Nomor Telepon", - "info": "Informasi Laporan", - "description": "Deskripsi Laporan", - "status": "Status Laporan", - "photo": "Foto Laporan", - "submitFeedback": "Kirim Tanggapan", - "actions": { - "title": "Tindakan Laporan", - "loading": "Loading...", - "accept": "Terima", - "reject": "Tolak", - "cancel": "Batalkan", - "complete": "Selesai" - } - } - }, - "feedback": { - "delete": { - "warning": { - "title": "Apakah Anda yakin ingin menghapus tanggapan ini?", - "subtitle": "Tindakan ini tidak dapat dibatalkan.", - "pending": "Memproses...", - "delete": "Hapus", - "cancel": "Batalkan" - }, - "subtitle": "Tanggapan", - "create": "Buat tanggapan baru", - "back": "Kembali", - "noResults": "Tidak ada tanggapan ditemukan untuk laporan ini.", - "created": "Dibuat: ", - "delete": "Hapus", - "createFeedback": { - "subtitle": "Buat Tanggapan", - "title": "Judul", - "description": "Deskripsi", - "submit": "Submit Tanggapan", - "cancel": "Batalkan", - "validation": { - "title": "Panjang judul minimal harus 8 karakter.", - "subtitle": "Panjang deskripsi minimal harus 8 karakter." - } - } - } - } + "dashboard": { + "login": "Kembali ke Login", + "home": "Kembali ke Home" }, "trashbin": { "subtitle": "Tempat Sampah", @@ -176,7 +134,7 @@ } }, "change_trashbin": { - "subtitle": "Ganti Trashbin", + "subtitle": "Ganti Tempat Sampah", "name": "Nama", "description": "Deskripsi", "latitude": "Lintang", @@ -203,7 +161,7 @@ "search": "Cari Tempat Sampah", "back": "Kembali", "noResults": "Tidak ada tempat sampah yang ditemukan untuk pencarian ini.", - "view_subtrashbin": "Lihat Subtempatsampah", + "view_subtrashbin": "Lihat Sub Tempat Sampah", "view_trash": "Lihat Tempat Sampah", "view_history": "Lihat Riwayat", "trash": { @@ -233,23 +191,83 @@ } }, "create_subtrashbin": { - "subtitle": "Buat Sub tempat sampah", + "subtitle": "Buat Sub Tempat Sampah", "name": "Nama", - "submit": "Buat Sub tempat sampah", + "submit": "Buat Sub Tempat Sampah", "back": "Kembali", "validation": { "name": "Nama harus minimal 8 karakter." } }, "update_subtrashbin": { - "subtitle": "Perbarui Sub tempat sampah", + "subtitle": "Perbarui Sub Tempat Sampah", "name": "Nama", - "submit": "Perbarui Sub tempat sampah", + "submit": "Perbarui Sub Tempat Sampah", "back": "Kembali", "validation": { "name": "Nama harus minimal 8 karakter." } } + }, + "reports": { + "subtitle": "Laporan", + "search": "Cari tempat sampah", + "from": "Laporan dari: ", + "for": "Untuk: ", + "notResponded": "Belum Ditanggapi", + "accepted": "Diterima", + "rejected": "Ditolak", + "completed": "Selesai", + "no_reports": "Tidak ada laporan ditemukan.", + "detailed": { + "subtitle": "Tampilan laporan secara detail.", + "input": { + "reporter": "Identitas Pelaporan", + "name": "Pelapor", + "no": "Nomor Telepon", + "info": "Informasi Laporan", + "description": "Deskripsi Laporan", + "status": "Status Laporan", + "photo": "Foto Laporan", + "submitFeedback": "Kirim Tanggapan", + "actions": { + "title": "Tindakan Laporan", + "loading": "Loading...", + "accept": "Terima", + "reject": "Tolak", + "cancel": "Batalkan", + "complete": "Selesai" + } + } + }, + "feedback": { + "delete": { + "warning": { + "title": "Apakah Anda yakin ingin menghapus tanggapan ini?", + "subtitle": "Tindakan ini tidak dapat dibatalkan.", + "pending": "Memproses...", + "delete": "Hapus", + "cancel": "Batalkan" + }, + "subtitle": "Tanggapan", + "create": "Buat tanggapan baru", + "back": "Kembali", + "noResults": "Tidak ada tanggapan ditemukan untuk laporan ini.", + "created": "Dibuat: ", + "delete": "Hapus", + "createFeedback": { + "subtitle": "Buat Tanggapan", + "title": "Judul", + "description": "Deskripsi", + "submit": "Submit Tanggapan", + "cancel": "Batalkan", + "validation": { + "title": "Panjang judul minimal harus 8 karakter.", + "subtitle": "Panjang deskripsi minimal harus 8 karakter." + } + } + } + } } } } diff --git a/apps/app/src/pages/complain/form/report-feedback.tsx b/apps/app/src/pages/complain/form/report-feedback.tsx index 823e68e..3fc4629 100644 --- a/apps/app/src/pages/complain/form/report-feedback.tsx +++ b/apps/app/src/pages/complain/form/report-feedback.tsx @@ -15,6 +15,7 @@ import dayjs from "dayjs"; import { CapacitorHttp } from "@capacitor/core"; import { useState } from "react"; import { useGetFeedbacks } from "../../operator/trash-bin/report/report-feedback/get-feedbacks.query"; +import { t } from "i18next"; export interface InterfaceFeedback { id: number; @@ -110,7 +111,7 @@ export function ComplainReportFeedback() {

TrashTrack

-

Feedback

+

{t("complain.feedback.subtitle")}

@@ -119,7 +120,7 @@ export function ComplainReportFeedback() { variant="secondary" onClick={() => history.replace(`/complain/tabs/form/report-history`)} > - Back + {t("complain.feedback.back")}
@@ -147,14 +148,14 @@ export function ComplainReportFeedback() { {filteredData.length === 0 ? ( -

No feedbacks

+

{t("complain.feedback.noFeedback")}

) : ( filteredData.map((feedback: InterfaceFeedback) => (

{feedback.title}

{feedback.description}

- Created: {formatDateTimeAgo(dayjs(feedback.createdAt))} + {t("complain.feedback.createdAt")} {formatDateTimeAgo(dayjs(feedback.createdAt))}

)) diff --git a/apps/app/src/pages/complain/form/report-history.tsx b/apps/app/src/pages/complain/form/report-history.tsx index d0a9772..d5036d5 100644 --- a/apps/app/src/pages/complain/form/report-history.tsx +++ b/apps/app/src/pages/complain/form/report-history.tsx @@ -15,6 +15,7 @@ import { Card, CardContent, CardHeader, Skeleton, Separator, Button } from "@tra import { EnumResponseStatus, InterfaceReport } from "../../operator/trash-bin/report/reports.page"; import { useGetTrashBinById } from "../../operator/trash-bin/report/get-trash-bin.query"; import { useTranslation } from "react-i18next"; +import { t } from "i18next"; function ReportStatus({ status }: { status: EnumResponseStatus }) { return ( @@ -34,13 +35,13 @@ function ReportStatus({ status }: { status: EnumResponseStatus }) { }`} > {status === EnumResponseStatus.NOT_RESPONDED - ? "Belum Ditanggapi" + ? t("complain.history.notResponded") : status === EnumResponseStatus.ACCEPTED - ? "Diterima" + ? t("complain.history.accepted") : status === EnumResponseStatus.REJECTED - ? "Ditolak" + ? t("complain.history.rejected") : status === EnumResponseStatus.COMPLETED - ? "Selesai" + ? t("complain.history.completed") : ""}

@@ -62,7 +63,7 @@ function TrashBinDetails({ trashBinId, userId }: { trashBinId: number; userId: n ) : (

- Laporan untuk: {trashBinData.data.name} + {t("complain.history.for")} {trashBinData.data.name}

)} {isError ??

{JSON.stringify(error)}

} @@ -123,7 +124,7 @@ export function ComplainReportHistory() {

TrashTrack

-

Riwayat

+

{t("tabs.riwayat")}

{/* diff --git a/apps/app/src/pages/operator/trash-bin/trashbin/create-trashbin.page.tsx b/apps/app/src/pages/operator/trash-bin/trashbin/create-trashbin.page.tsx index 76fd24b..1eb55ca 100644 --- a/apps/app/src/pages/operator/trash-bin/trashbin/create-trashbin.page.tsx +++ b/apps/app/src/pages/operator/trash-bin/trashbin/create-trashbin.page.tsx @@ -10,7 +10,7 @@ export function CreateTrashbinPage() {

TrashTrack

-

{t("reports.trashbin.create_trashbin.subtitle")}

+

{t("operator.trashbin.create_trashbin.subtitle")}