diff --git a/frontend/nginx.conf b/frontend/nginx.conf index 066bac7..47924e5 100644 --- a/frontend/nginx.conf +++ b/frontend/nginx.conf @@ -1,3 +1,20 @@ +# Visitor country from Cloudflare's CF-IPCountry header, handed to the SPA as a geo_country cookie so it +# picks the UI language (Indonesian in Indonesia, English elsewhere) before the first render. +# - Only on page navigations: a Set-Cookie on static files or API responses would stop Cloudflare from +# caching them. $request_uri is used because try_files rewrites $uri to /index.html. +# - Only a two-letter code passes, so nothing else from the header can reach the cookie. +# - Without Cloudflare (local runs) there is no header and no cookie; the SPA falls back to the time zone. +map $request_uri $geo_cookie_allowed { + ~^/(api|ws|actuator)(/|\?|$) 0; + ~^[^?]*\.[A-Za-z0-9]+(\?|$) 0; + default 1; +} + +map "$geo_cookie_allowed:$http_cf_ipcountry" $geo_country_cookie { + "~^1:(?[A-Z]{2})$" "geo_country=$geo_cc; Path=/; SameSite=Lax"; + default ""; +} + server { listen 80; server_name localhost; @@ -17,6 +34,8 @@ server { # 'unsafe-inline' for styles only: React and some libraries set inline style attributes. add_header Content-Security-Policy "default-src 'self'; script-src 'self' ${CSP_SCRIPT_SRC_EXTRA}; style-src 'self' 'unsafe-inline'; img-src 'self' data: blob:; font-src 'self' data:; media-src 'self' blob:; connect-src 'self' ${CSP_CONNECT_SRC_EXTRA}; frame-src 'self' blob:; frame-ancestors 'self'; object-src 'none'; base-uri 'self'; form-action 'self'" always; # HSTS belongs on the TLS-terminating host nginx / Cloudflare, not here (this server speaks plain HTTP). + # Empty value (no country, or not a page navigation) = header not sent. + add_header Set-Cookie $geo_country_cookie; location / { root /usr/share/nginx/html; diff --git a/frontend/src/components/common/LanguageSwitcher.tsx b/frontend/src/components/common/LanguageSwitcher.tsx new file mode 100644 index 0000000..6aa0408 --- /dev/null +++ b/frontend/src/components/common/LanguageSwitcher.tsx @@ -0,0 +1,42 @@ +import React from 'react'; +import { Languages } from 'lucide-react'; +import { useI18n, type Lang } from '../../i18n'; + +const OPTIONS: { lang: Lang; label: string; name: string }[] = [ + { lang: 'id', label: 'ID', name: 'Bahasa Indonesia' }, + { lang: 'en', label: 'EN', name: 'English' }, +]; + +/** ID / EN toggle. The choice is remembered and overrides the location-based default. */ +export const LanguageSwitcher: React.FC<{ className?: string }> = ({ className = '' }) => { + const { lang, setLang, t } = useI18n(); + + return ( +
+
+ ); +}; diff --git a/frontend/src/components/common/Navbar.tsx b/frontend/src/components/common/Navbar.tsx index 25a16b9..1bc0730 100644 --- a/frontend/src/components/common/Navbar.tsx +++ b/frontend/src/components/common/Navbar.tsx @@ -2,6 +2,8 @@ import React from 'react'; import { Link } from 'react-router-dom'; import { useAuthStore } from '../../store/authStore'; import { LogOut, UserCheck, ShieldAlert, Menu, X, KeyRound } from 'lucide-react'; +import { useI18n } from '../../i18n'; +import { LanguageSwitcher } from './LanguageSwitcher'; interface NavbarProps { onToggleMobileMenu?: () => void; @@ -10,26 +12,27 @@ interface NavbarProps { export const Navbar: React.FC = ({ onToggleMobileMenu, isMobileOpen }) => { const { user, logout, stopImpersonate } = useAuthStore(); + const { t } = useI18n(); const getRoleBadge = () => { if (!user) return null; if (user.roles.includes('ROLE_ADMIN')) { return ( - Admin + {t('common.roleAdmin')} ); } if (user.roles.includes('ROLE_TEACHER')) { return ( - Guru + {t('common.roleTeacher')} ); } return ( - Siswa + {t('common.roleStudent')} ); }; @@ -41,7 +44,7 @@ export const Navbar: React.FC = ({ onToggleMobileMenu, isMobileOpen
- Mode Login As: {user.name} ({user.email}) + {t('nav.impersonating')} {user.name} ({user.email})
)} @@ -61,7 +64,7 @@ export const Navbar: React.FC = ({ onToggleMobileMenu, isMobileOpen type="button" onClick={onToggleMobileMenu} className="-m-2 p-2 text-gray-600 hover:text-emerald-700 hover:bg-emerald-50 rounded-lg md:hidden transition" - aria-label="Toggle mobile menu" + aria-label={t('nav.toggleMenu')} > {isMobileOpen ? : } @@ -71,15 +74,15 @@ export const Navbar: React.FC = ({ onToggleMobileMenu, isMobileOpen
Spring E-Learning Logo

- Spring E-Learning + {t('common.appName')}

- Learning Management & CBT System + {t('common.appTagline')}

@@ -87,6 +90,8 @@ export const Navbar: React.FC = ({ onToggleMobileMenu, isMobileOpen {/* Right: User Profile & Actions */}
+ +
@@ -100,21 +105,21 @@ export const Navbar: React.FC = ({ onToggleMobileMenu, isMobileOpen {!user?.impersonatedBy && ( - Password + {t('nav.passwordShort')} )}
diff --git a/frontend/src/components/common/Sidebar.tsx b/frontend/src/components/common/Sidebar.tsx index 9717d1e..3c8bf71 100644 --- a/frontend/src/components/common/Sidebar.tsx +++ b/frontend/src/components/common/Sidebar.tsx @@ -14,6 +14,7 @@ import { Award, X, } from 'lucide-react'; +import { useI18n } from '../../i18n'; interface SidebarProps { closeMobileMenu?: () => void; @@ -21,6 +22,7 @@ interface SidebarProps { export const Sidebar: React.FC = ({ closeMobileMenu }) => { const { user } = useAuthStore(); + const { t } = useI18n(); const isAdmin = user?.roles.includes('ROLE_ADMIN'); const isTeacher = user?.roles.includes('ROLE_TEACHER'); @@ -32,9 +34,9 @@ export const Sidebar: React.FC = ({ closeMobileMenu }) => { }`; const getRoleLabel = () => { - if (isAdmin) return 'Administrator'; - if (isTeacher) return 'Guru Pengajar'; - return 'Siswa'; + if (isAdmin) return t('common.roleAdministrator'); + if (isTeacher) return t('nav.roleTeacherLong'); + return t('common.roleStudent'); }; return ( @@ -44,11 +46,11 @@ export const Sidebar: React.FC = ({ closeMobileMenu }) => {
Spring E-Learning Logo - Spring E-Learning + {t('common.appName')}
{closeMobileMenu && ( @@ -56,7 +58,7 @@ export const Sidebar: React.FC = ({ closeMobileMenu }) => { type="button" onClick={closeMobileMenu} className="md:hidden p-1.5 rounded-lg text-emerald-200 hover:text-white hover:bg-white/10 transition" - aria-label="Close sidebar" + aria-label={t('nav.closeSidebar')} > @@ -68,12 +70,12 @@ export const Sidebar: React.FC = ({ closeMobileMenu }) => { {/* Main Menu */}

- Menu Utama + {t('nav.sectionMain')}

- Dashboard + {t('nav.dashboard')}
@@ -82,28 +84,28 @@ export const Sidebar: React.FC = ({ closeMobileMenu }) => { {isAdmin && (

- Manajemen & User + {t('nav.sectionManagement')}

- Guru + {t('nav.teachers')} - Siswa + {t('nav.students')} - Kelas + {t('nav.classrooms')} - Mata Pelajaran + {t('nav.subjects')} - Pengumuman + {t('nav.announcements')}
@@ -112,25 +114,25 @@ export const Sidebar: React.FC = ({ closeMobileMenu }) => { {/* Academic & Learning CBT */}

- Akademik & CBT + {t('nav.sectionAcademic')}

- {isTeacher || isAdmin ? 'Ujian & CBT' : 'Ujian Saya'} + {isTeacher || isAdmin ? t('nav.examsManage') : t('nav.examsMine')} - Materi Belajar + {t('nav.materials')} - Tugas & Forum + {t('nav.assignments')} {!isAdmin && !isTeacher && ( - Nilai & Rapor + {t('nav.grades')} )}
diff --git a/frontend/src/i18n/define.ts b/frontend/src/i18n/define.ts new file mode 100644 index 0000000..5d75a6c --- /dev/null +++ b/frontend/src/i18n/define.ts @@ -0,0 +1,9 @@ +/** + * Declares one namespace of UI text. Both languages must have exactly the same keys: a key that is + * missing in either one is a type error, so `npm run build` catches untranslated text. + * + * Placeholders use braces: "Hello {name}" with t('ns.key', { name }). + */ +export function defineMessages(messages: { id: Record; en: Record }) { + return messages; +} diff --git a/frontend/src/i18n/detect.ts b/frontend/src/i18n/detect.ts new file mode 100644 index 0000000..2564f51 --- /dev/null +++ b/frontend/src/i18n/detect.ts @@ -0,0 +1,57 @@ +export type Lang = 'id' | 'en'; + +const STORAGE_KEY = 'lang'; + +/** Set by the frontend nginx from Cloudflare's CF-IPCountry header (see nginx.conf). */ +const COUNTRY_COOKIE = /(?:^|;\s*)geo_country=([A-Z]{2})(?:;|$)/; + +/** WIB, WITA and WIT. */ +const INDONESIAN_TIME_ZONES = new Set(['Asia/Jakarta', 'Asia/Pontianak', 'Asia/Makassar', 'Asia/Jayapura']); + +const isLang = (value: unknown): value is Lang => value === 'id' || value === 'en'; + +/** The language the user picked with the selector, if any. Storage can be blocked (private mode). */ +export function readSavedLanguage(): Lang | null { + try { + const value = localStorage.getItem(STORAGE_KEY); + return isLang(value) ? value : null; + } catch { + return null; + } +} + +export function saveLanguage(lang: Lang): void { + try { + localStorage.setItem(STORAGE_KEY, lang); + } catch { + /* the choice then only lasts for this page load */ + } +} + +/** Two-letter country code of the visitor, or null when unknown (no Cloudflare, local dev, "XX"). */ +export function readCountry(cookie: string = document.cookie): string | null { + const country = cookie.match(COUNTRY_COOKIE)?.[1]; + return country && country !== 'XX' ? country : null; +} + +function browserTimeZone(): string | undefined { + try { + return Intl.DateTimeFormat().resolvedOptions().timeZone; + } catch { + return undefined; + } +} + +/** + * Indonesian for visitors in Indonesia, English for everyone else. The IP country decides when it is + * known; otherwise the browser's time zone stands in for the location. + */ +export function languageForLocation(country: string | null, timeZone: string | undefined): Lang { + if (country) return country === 'ID' ? 'id' : 'en'; + return timeZone && INDONESIAN_TIME_ZONES.has(timeZone) ? 'id' : 'en'; +} + +/** An explicit choice from the selector always wins over the location. */ +export function detectLanguage(): Lang { + return readSavedLanguage() ?? languageForLocation(readCountry(), browserTimeZone()); +} diff --git a/frontend/src/i18n/index.ts b/frontend/src/i18n/index.ts new file mode 100644 index 0000000..4519797 --- /dev/null +++ b/frontend/src/i18n/index.ts @@ -0,0 +1,72 @@ +import { useMemo } from 'react'; +import { create } from 'zustand'; +import { messages } from './messages'; +import { detectLanguage, saveLanguage, type Lang } from './detect'; + +export type { Lang }; + +type Namespaces = typeof messages; +type Namespace = keyof Namespaces & string; + +/** Every key in the form "namespace.key", e.g. "nav.dashboard". */ +export type MessageKey = { + [N in Namespace]: `${N}.${keyof Namespaces[N]['id'] & string}`; +}[Namespace]; + +export type MessageVars = Record; + +export const LOCALES: Record = { id: 'id-ID', en: 'en-US' }; + +export function translate(lang: Lang, key: MessageKey, vars?: MessageVars): string { + const dot = key.indexOf('.'); + const table = messages[key.slice(0, dot) as Namespace][lang] as Record; + const text = table[key.slice(dot + 1)] ?? key; + if (!vars) return text; + return text.replace(/\{(\w+)\}/g, (match, name: string) => (name in vars ? String(vars[name]) : match)); +} + +const applyDocumentLang = (lang: Lang) => { + document.documentElement.lang = lang; +}; + +interface I18nState { + lang: Lang; + /** Chosen with the language selector: remembered, and wins over the location from then on. */ + setLang: (lang: Lang) => void; +} + +export const useI18nStore = create((set) => { + const initial = detectLanguage(); + applyDocumentLang(initial); + return { + lang: initial, + setLang: (lang) => { + saveLanguage(lang); + applyDocumentLang(lang); + set({ lang }); + }, + }; +}); + +/** + * Text and locale for the current language. Components that call it re-render when the language + * changes. Use `locale` for dates and numbers: date.toLocaleDateString(locale). + */ +export function useI18n() { + const lang = useI18nStore((state) => state.lang); + const setLang = useI18nStore((state) => state.setLang); + return useMemo( + () => ({ + lang, + locale: LOCALES[lang], + setLang, + t: (key: MessageKey, vars?: MessageVars) => translate(lang, key, vars), + }), + [lang, setLang] + ); +} + +/** For code outside React components (stores, utils). It does not re-render anything by itself. */ +export function t(key: MessageKey, vars?: MessageVars): string { + return translate(useI18nStore.getState().lang, key, vars); +} diff --git a/frontend/src/i18n/messages/announcements.ts b/frontend/src/i18n/messages/announcements.ts new file mode 100644 index 0000000..147f30e --- /dev/null +++ b/frontend/src/i18n/messages/announcements.ts @@ -0,0 +1,66 @@ +import { defineMessages } from '../define'; + +export const announcements = defineMessages({ + id: { + title: 'Papan Pengumuman', + subtitle: 'Publikasikan informasi resmi kepada guru dan siswa', + create: 'Buat Pengumuman', + loading: 'Memuat pengumuman...', + emptyTitle: 'Belum ada pengumuman yang dipublikasikan', + emptyHint: 'Buat berita sekolah atau informasi jadwal ujian di sini.', + colTitle: 'Judul', + target: 'Target Audiens', + colDate: 'Tanggal', + targetAllShort: 'Semua', + targetTeacherShort: 'Guru', + targetStudentShort: 'Siswa', + published: 'Terbit', + draft: 'Draf', + editShort: 'Edit Pengumuman', + deleteShort: 'Hapus Pengumuman', + editTitle: 'Edit Pengumuman', + addTitle: 'Buat Pengumuman Baru', + titleLabel: 'Judul', + titlePlaceholder: 'cth. Jadwal Ujian Akhir Semester Ganjil', + targetAll: 'Semua (Guru & Siswa)', + targetTeacher: 'Guru Saja', + targetStudent: 'Siswa Saja', + content: 'Isi Pengumuman', + contentPlaceholder: 'Tulis isi pengumuman...', + publishNow: 'Publikasikan sekarang', + save: 'Simpan Pengumuman', + saveFailed: 'Gagal menyimpan pengumuman', + confirmDelete: 'Hapus pengumuman ini?', + }, + en: { + title: 'Announcement Board', + subtitle: 'Publish official information to teachers and students', + create: 'Create Announcement', + loading: 'Loading announcements...', + emptyTitle: 'No announcements published yet', + emptyHint: 'Post school news or exam schedule information here.', + colTitle: 'Title', + target: 'Target Audience', + colDate: 'Date', + targetAllShort: 'All', + targetTeacherShort: 'Teachers', + targetStudentShort: 'Students', + published: 'Published', + draft: 'Draft', + editShort: 'Edit announcement', + deleteShort: 'Delete announcement', + editTitle: 'Edit Announcement', + addTitle: 'Post New Announcement', + titleLabel: 'Title', + titlePlaceholder: 'e.g. Odd Semester Final Exam Schedule', + targetAll: 'Everyone (All)', + targetTeacher: 'Teachers Only', + targetStudent: 'Students Only', + content: 'Content', + contentPlaceholder: 'Announcement body text...', + publishNow: 'Publish now', + save: 'Save Announcement', + saveFailed: 'Could not save the announcement', + confirmDelete: 'Delete this announcement?', + }, +}); diff --git a/frontend/src/i18n/messages/assignmentDetail.ts b/frontend/src/i18n/messages/assignmentDetail.ts new file mode 100644 index 0000000..c922418 --- /dev/null +++ b/frontend/src/i18n/messages/assignmentDetail.ts @@ -0,0 +1,76 @@ +import { defineMessages } from '../define'; + +export const assignmentDetail = defineMessages({ + id: { + loading: 'Memuat detail tugas...', + notFound: 'Tugas tidak ditemukan.', + backToAssignments: 'Kembali ke Tugas', + dueLabel: 'Batas: {date}', + instructions: 'Instruksi Tugas:', + mySubmission: 'Pengumpulan Tugas Saya', + submittedTitle: 'Tugas Berhasil Dikumpulkan', + submittedAt: 'Diserahkan pada: {date}', + scoreLabel: 'Nilai: {score} / {max}', + uploadLabel: 'Unggah Berkas / Dokumen Tugas', + notesLabel: 'Catatan Tambahan (Opsional)', + notesPlaceholder: 'Catatan tambahan untuk guru pengampu...', + uploading: 'Mengunggah Berkas...', + submitButton: 'Kumpulkan Tugas', + submitSuccess: 'Tugas berhasil dikumpulkan!', + submitFailed: 'Gagal mengumpulkan tugas', + gradeFailed: 'Gagal menilai pengumpulan', + commentFailed: 'Gagal mengirim komentar', + submissionsTitle: 'Pengumpulan Siswa ({count})', + noSubmissions: 'Belum ada tugas yang dikumpulkan.', + colStudent: 'Siswa', + colSubmittedAt: 'Tanggal Pengumpulan', + colFile: 'Berkas', + colScore: 'Nilai', + nis: 'NIS: {nis}', + notGraded: 'Belum Dinilai', + gradeButton: 'Beri Nilai', + forumTitle: 'Forum Diskusi Kelas ({count})', + commentPlaceholder: 'Ajukan pertanyaan atau diskusikan tugas ini...', + gradeModalTitle: 'Nilai Pengumpulan: {name}', + scoreRange: 'Nilai (0 - {max})', + feedbackLabel: 'Umpan Balik Guru', + feedbackPlaceholder: 'Saran, umpan balik, dan catatan rubrik...', + saveGrade: 'Simpan Nilai', + }, + en: { + loading: 'Loading assignment details...', + notFound: 'Assignment not found.', + backToAssignments: 'Back to Assignments', + dueLabel: 'Due: {date}', + instructions: 'Task Instructions:', + mySubmission: 'My Submission', + submittedTitle: 'Assignment Submitted', + submittedAt: 'Submitted on: {date}', + scoreLabel: 'Grade: {score} / {max}', + uploadLabel: 'Upload Assignment File / Document', + notesLabel: 'Additional Notes (Optional)', + notesPlaceholder: 'Additional notes for your teacher...', + uploading: 'Uploading file...', + submitButton: 'Submit Assignment', + submitSuccess: 'Assignment submitted successfully!', + submitFailed: 'Failed to submit assignment', + gradeFailed: 'Failed to grade submission', + commentFailed: 'Failed to post comment', + submissionsTitle: 'Student Submissions ({count})', + noSubmissions: 'No submissions yet.', + colStudent: 'Student', + colSubmittedAt: 'Submitted On', + colFile: 'File', + colScore: 'Grade', + nis: 'Student ID: {nis}', + notGraded: 'Not Graded', + gradeButton: 'Grade', + forumTitle: 'Class Discussion Forum ({count})', + commentPlaceholder: 'Ask a question or discuss this assignment...', + gradeModalTitle: 'Grade Submission: {name}', + scoreRange: 'Score (0 - {max})', + feedbackLabel: 'Teacher Feedback', + feedbackPlaceholder: 'Suggestions, feedback, and rubric comments...', + saveGrade: 'Save Grade', + }, +}); diff --git a/frontend/src/i18n/messages/assignmentList.ts b/frontend/src/i18n/messages/assignmentList.ts new file mode 100644 index 0000000..cb692dd --- /dev/null +++ b/frontend/src/i18n/messages/assignmentList.ts @@ -0,0 +1,62 @@ +import { defineMessages } from '../define'; + +export const assignmentList = defineMessages({ + id: { + title: 'Tugas & PR Siswa', + subtitle: 'Kumpulkan tugas, terima penilaian guru, dan ikuti forum diskusi', + createButton: 'Buat Tugas Baru', + loading: 'Memuat tugas...', + emptyTitle: 'Belum ada tugas yang aktif', + emptyText: 'Guru dapat membuat tugas untuk kelas yang terdaftar di sini.', + maxPoints: 'Maks: {score} poin', + noDescription: 'Tidak ada deskripsi.', + classLabel: 'Kelas:', + dueLabel: 'Batas: {date}', + detailLink: 'Detail & Pengumpulan', + submitted: 'Terkumpul', + deleteTitle: 'Hapus tugas', + confirmDelete: 'Hapus tugas ini?', + createFailed: 'Gagal membuat tugas', + modalTitle: 'Buat Tugas', + fieldTitle: 'Judul Tugas', + fieldTitlePlaceholder: 'mis. Tugas Mandiri 1: Pemrograman Berorientasi Objek', + fieldSubject: 'Mata Pelajaran', + chooseSubject: '-- Pilih Mata Pelajaran --', + fieldClassroom: 'Kelas', + chooseClassroom: '-- Pilih Kelas --', + fieldDueDate: 'Tanggal & Jam Batas', + fieldMaxScore: 'Nilai Maksimal', + fieldInstructions: 'Instruksi', + fieldInstructionsPlaceholder: 'Instruksi dan panduan pengerjaan tugas...', + publishButton: 'Publikasikan Tugas', + }, + en: { + title: 'Student Assignments & Homework', + subtitle: 'Submit assignments, receive teacher grades, and join the discussion forum', + createButton: 'Create New Assignment', + loading: 'Loading assignments...', + emptyTitle: 'No assignments currently active', + emptyText: 'Teachers can create assignments for enrolled classes here.', + maxPoints: 'Max: {score} points', + noDescription: 'No description.', + classLabel: 'Class:', + dueLabel: 'Due: {date}', + detailLink: 'Details & Submission', + submitted: 'Submitted', + deleteTitle: 'Delete assignment', + confirmDelete: 'Delete this assignment?', + createFailed: 'Failed to create assignment', + modalTitle: 'Create Assignment', + fieldTitle: 'Assignment Title', + fieldTitlePlaceholder: 'e.g. Individual Task 1: Object-Oriented Programming', + fieldSubject: 'Subject', + chooseSubject: '-- Choose Subject --', + fieldClassroom: 'Class', + chooseClassroom: '-- Choose Class --', + fieldDueDate: 'Due Date & Time', + fieldMaxScore: 'Max Score', + fieldInstructions: 'Instructions', + fieldInstructionsPlaceholder: 'Task instructions and guidelines...', + publishButton: 'Publish Assignment', + }, +}); diff --git a/frontend/src/i18n/messages/auth.ts b/frontend/src/i18n/messages/auth.ts new file mode 100644 index 0000000..215eaff --- /dev/null +++ b/frontend/src/i18n/messages/auth.ts @@ -0,0 +1,87 @@ +import { defineMessages } from '../define'; + +/** Login and change-password pages. */ +export const auth = defineMessages({ + id: { + brandSubtitle: 'Spring Boot & React CBT', + platformBadge: 'Platform E-Learning & CBT Terintegrasi', + welcomeLine1: 'Selamat Datang', + welcomeLine2: 'Kembali!', + welcomeText: 'Kelola pembelajaran, materi akademik, dan ujian CBT sekolah Anda dengan mudah, aman, dan efisien.', + statSchools: 'Sekolah Mitra', + statStudents: 'Siswa Aktif', + statUptime: 'CBT Uptime', + featureDashboard: 'Dashboard analitik real-time & manajemen kelas', + featureCbt: 'Ujian CBT aman dengan anti-cheat proctoring & timer', + featureResponsive: 'Responsif untuk smartphone, tablet, dan desktop', + copyright: '© 2026 Spring E-Learning. Hak cipta dilindungi.', + mobileTagline: 'Platform E-Learning & CBT Sekolah', + loginTitle: 'Masuk ke Akun Anda', + loginSubtitle: 'Silakan masukkan email dan password untuk mengakses portal.', + emailLabel: 'Alamat Email', + passwordLabel: 'Kata Sandi', + showPassword: 'Lihat password', + hidePassword: 'Sembunyikan password', + rememberMe: 'Ingat saya di perangkat ini', + forgotPassword: 'Lupa kata sandi?', + verifying: 'Memverifikasi...', + loginButton: 'Masuk ke Portal', + loginFailed: 'Email atau password yang Anda masukkan salah', + demoAccounts: 'Pilih Akun Demo Cepat:', + secureConnection: 'Koneksi terenkripsi Spring Boot Security & JWT', + changePasswordTitle: 'Ganti Password', + forcedNotice: + 'Akun Anda masih memakai password default atau password yang dibuat admin. Demi keamanan, silakan buat password baru sebelum melanjutkan.', + currentPassword: 'Password saat ini', + newPassword: 'Password baru', + newPasswordHint: 'Minimal {min} karakter.', + confirmPassword: 'Ulangi password baru', + showPasswords: 'Tampilkan password', + hidePasswords: 'Sembunyikan password', + saveNewPassword: 'Simpan Password Baru', + passwordLength: 'Password baru harus {min}–{max} karakter.', + passwordMismatch: 'Konfirmasi password tidak sama.', + changeFailed: 'Gagal mengganti password. Silakan coba lagi.', + }, + en: { + brandSubtitle: 'Spring Boot & React CBT', + platformBadge: 'Integrated E-Learning & CBT Platform', + welcomeLine1: 'Welcome', + welcomeLine2: 'Back!', + welcomeText: "Manage your school's learning, academic materials, and CBT exams easily, securely, and efficiently.", + statSchools: 'Partner Schools', + statStudents: 'Active Students', + statUptime: 'CBT Uptime', + featureDashboard: 'Real-time analytics dashboard & class management', + featureCbt: 'Secure CBT exams with anti-cheat proctoring & timer', + featureResponsive: 'Responsive on smartphones, tablets, and desktops', + copyright: '© 2026 Spring E-Learning. All rights reserved.', + mobileTagline: 'School E-Learning & CBT Platform', + loginTitle: 'Sign in to Your Account', + loginSubtitle: 'Enter your email and password to access the portal.', + emailLabel: 'Email Address', + passwordLabel: 'Password', + showPassword: 'Show password', + hidePassword: 'Hide password', + rememberMe: 'Remember me on this device', + forgotPassword: 'Forgot password?', + verifying: 'Verifying...', + loginButton: 'Sign in to Portal', + loginFailed: 'The email or password you entered is incorrect', + demoAccounts: 'Quick demo accounts:', + secureConnection: 'Encrypted connection with Spring Boot Security & JWT', + changePasswordTitle: 'Change Password', + forcedNotice: + 'Your account still uses a default password or one created by an admin. For your security, please create a new password before continuing.', + currentPassword: 'Current password', + newPassword: 'New password', + newPasswordHint: 'At least {min} characters.', + confirmPassword: 'Repeat new password', + showPasswords: 'Show passwords', + hidePasswords: 'Hide passwords', + saveNewPassword: 'Save New Password', + passwordLength: 'The new password must be {min}–{max} characters.', + passwordMismatch: 'The password confirmation does not match.', + changeFailed: 'Could not change the password. Please try again.', + }, +}); diff --git a/frontend/src/i18n/messages/classrooms.ts b/frontend/src/i18n/messages/classrooms.ts new file mode 100644 index 0000000..ed7298e --- /dev/null +++ b/frontend/src/i18n/messages/classrooms.ts @@ -0,0 +1,56 @@ +import { defineMessages } from '../define'; + +export const classrooms = defineMessages({ + id: { + title: 'Manajemen Kelas', + subtitle: 'Kelola rombongan belajar dan tentukan wali kelas', + addClassroom: 'Tambah Kelas', + loading: 'Memuat data kelas...', + emptyTitle: 'Belum ada kelas yang terdaftar', + emptyHint: 'Klik "Tambah Kelas" untuk menambahkan kelas pertama.', + name: 'Nama Kelas', + colLevel: 'Tingkat', + colCapacity: 'Kapasitas', + academicYear: 'Tahun Ajaran', + homeroomTeacher: 'Wali Kelas', + levelValue: 'Kelas {level}', + capacityValue: '{count} siswa', + notAssigned: 'Belum ditentukan', + editTitle: 'Edit Kelas', + deleteTitle: 'Hapus Kelas', + addTitle: 'Tambah Kelas Baru', + namePlaceholder: 'Contoh: X MIPA 1', + levelLabel: 'Tingkat / Grade', + capacityLabel: 'Kapasitas Siswa', + selectHomeroom: '-- Pilih Wali Kelas --', + saveClassroom: 'Simpan Kelas', + saveFailed: 'Gagal menyimpan kelas', + confirmDelete: 'Yakin ingin menghapus kelas ini?', + }, + en: { + title: 'Class Management', + subtitle: 'Manage class groups and assign homeroom teachers', + addClassroom: 'Add Class', + loading: 'Loading classes...', + emptyTitle: 'No classes registered yet', + emptyHint: 'Click "Add Class" to add the first class.', + name: 'Class Name', + colLevel: 'Grade', + colCapacity: 'Capacity', + academicYear: 'Academic Year', + homeroomTeacher: 'Homeroom Teacher', + levelValue: 'Grade {level}', + capacityValue: '{count} students', + notAssigned: 'Not assigned', + editTitle: 'Edit Class', + deleteTitle: 'Delete Class', + addTitle: 'Add New Class', + namePlaceholder: 'e.g. X MIPA 1', + levelLabel: 'Grade Level', + capacityLabel: 'Student Capacity', + selectHomeroom: '-- Select Homeroom Teacher --', + saveClassroom: 'Save Class', + saveFailed: 'Could not save the class', + confirmDelete: 'Are you sure you want to delete this class?', + }, +}); diff --git a/frontend/src/i18n/messages/common.ts b/frontend/src/i18n/messages/common.ts new file mode 100644 index 0000000..be0e0c4 --- /dev/null +++ b/frontend/src/i18n/messages/common.ts @@ -0,0 +1,97 @@ +import { defineMessages } from '../define'; + +/** Words used on many pages. Page-specific text belongs in that page's namespace. */ +export const common = defineMessages({ + id: { + appName: 'Spring E-Learning', + appTagline: 'Learning Management & CBT System', + logoAlt: 'Logo Spring E-Learning', + roleAdmin: 'Admin', + roleAdministrator: 'Administrator', + roleTeacher: 'Guru', + roleStudent: 'Siswa', + save: 'Simpan', + saving: 'Menyimpan...', + cancel: 'Batal', + delete: 'Hapus', + edit: 'Ubah', + add: 'Tambah', + create: 'Buat', + update: 'Perbarui', + close: 'Tutup', + back: 'Kembali', + search: 'Cari', + filter: 'Filter', + loading: 'Memuat...', + processing: 'Memproses...', + submit: 'Kirim', + actions: 'Aksi', + details: 'Detail', + view: 'Lihat', + download: 'Unduh', + upload: 'Unggah', + yes: 'Ya', + no: 'Tidak', + all: 'Semua', + status: 'Status', + active: 'Aktif', + inactive: 'Nonaktif', + name: 'Nama', + email: 'Email', + password: 'Password', + optional: 'opsional', + select: '-- Pilih --', + noData: 'Belum ada data.', + previous: 'Sebelumnya', + next: 'Berikutnya', + genericError: 'Terjadi kesalahan. Silakan coba lagi.', + language: 'Bahasa', + fileOpenFailed: 'Berkas tidak dapat dibuka. Anda mungkin tidak memiliki akses atau berkas sudah dihapus.', + }, + en: { + appName: 'Spring E-Learning', + appTagline: 'Learning Management & CBT System', + logoAlt: 'Spring E-Learning logo', + roleAdmin: 'Admin', + roleAdministrator: 'Administrator', + roleTeacher: 'Teacher', + roleStudent: 'Student', + save: 'Save', + saving: 'Saving...', + cancel: 'Cancel', + delete: 'Delete', + edit: 'Edit', + add: 'Add', + create: 'Create', + update: 'Update', + close: 'Close', + back: 'Back', + search: 'Search', + filter: 'Filter', + loading: 'Loading...', + processing: 'Processing...', + submit: 'Submit', + actions: 'Actions', + details: 'Details', + view: 'View', + download: 'Download', + upload: 'Upload', + yes: 'Yes', + no: 'No', + all: 'All', + status: 'Status', + active: 'Active', + inactive: 'Inactive', + name: 'Name', + email: 'Email', + password: 'Password', + optional: 'optional', + select: '-- Select --', + noData: 'No data yet.', + previous: 'Previous', + next: 'Next', + genericError: 'Something went wrong. Please try again.', + language: 'Language', + fileOpenFailed: 'The file cannot be opened. You may not have access to it, or it has been deleted.', + }, +}); diff --git a/frontend/src/i18n/messages/dashboard.ts b/frontend/src/i18n/messages/dashboard.ts new file mode 100644 index 0000000..057c93d --- /dev/null +++ b/frontend/src/i18n/messages/dashboard.ts @@ -0,0 +1,58 @@ +import { defineMessages } from '../define'; + +export const dashboard = defineMessages({ + id: { + academicYear: 'Tahun Ajaran 2026/2027', + welcome: 'Selamat Datang, {name}!', + introAdmin: + 'Kelola kurikulum akademik, supervisi guru & siswa, publikasikan pengumuman, dan pantau operasional ujian CBT sekolah.', + introTeacher: + 'Rancang ujian CBT interaktif, kelola bank soal, periksa jawaban siswa, dan unggah materi pembelajaran.', + introStudent: + 'Akses materi pembelajaran kelas, ikuti ujian CBT terjadwal dengan sistem anti-cheat, dan kumpulkan tugas.', + statClassrooms: 'Total Kelas', + statSubjects: 'Mata Pelajaran', + statStudents: 'Siswa Terdaftar', + statExams: 'Ujian CBT', + statMaterials: 'Materi Pelajaran', + statAssignments: 'Tugas Aktif', + quickNav: 'Navigasi Cepat', + examsManageTitle: 'Manajemen Ujian CBT', + examsTakeTitle: 'Ikuti Ujian CBT', + examsManageText: 'Buat bank soal, atur jadwal ujian, dan buka ruang monitoring live ujian siswa.', + examsTakeText: 'Bergabung ke sesi ujian CBT dengan pengawasan anti-cheat dan autosave otomatis.', + materialsTitle: 'Materi Pelajaran', + materialsText: 'Akses silabus digital, modul bacaan, dan materi pembelajaran interaktif.', + gradesTitle: 'Rapor & Nilai Akademik', + gradesText: 'Lihat riwayat nilai tugas, ujian CBT, dan transkrip rapor hasil belajar Anda.', + assignmentsTitle: 'Tugas & Diskusi', + assignmentsText: 'Kumpulkan file tugas, beri penilaian siswa, dan berdiskusi di forum kelas.', + }, + en: { + academicYear: 'Academic Year 2026/2027', + welcome: 'Welcome, {name}!', + introAdmin: + "Manage the academic curriculum, supervise teachers & students, publish announcements, and monitor the school's CBT exams.", + introTeacher: + 'Design interactive CBT exams, manage the question bank, review student answers, and upload learning materials.', + introStudent: + 'Access your class learning materials, take scheduled CBT exams with anti-cheat protection, and submit assignments.', + statClassrooms: 'Total Classes', + statSubjects: 'Subjects', + statStudents: 'Enrolled Students', + statExams: 'CBT Exams', + statMaterials: 'Learning Materials', + statAssignments: 'Active Assignments', + quickNav: 'Quick Navigation', + examsManageTitle: 'CBT Exam Management', + examsTakeTitle: 'Take a CBT Exam', + examsManageText: 'Build the question bank, schedule exams, and open the live monitoring room for student exams.', + examsTakeText: 'Join a CBT exam session with anti-cheat proctoring and automatic autosave.', + materialsTitle: 'Learning Materials', + materialsText: 'Access digital syllabi, reading modules, and interactive learning materials.', + gradesTitle: 'Report Card & Academic Grades', + gradesText: 'View your assignment and CBT exam grade history and your report card transcript.', + assignmentsTitle: 'Assignments & Discussion', + assignmentsText: 'Submit assignment files, grade students, and discuss in the class forum.', + }, +}); diff --git a/frontend/src/i18n/messages/examEditor.ts b/frontend/src/i18n/messages/examEditor.ts new file mode 100644 index 0000000..21545a8 --- /dev/null +++ b/frontend/src/i18n/messages/examEditor.ts @@ -0,0 +1,94 @@ +import { defineMessages } from '../define'; + +export const examEditor = defineMessages({ + id: { + backToExams: 'Kembali ke Daftar Ujian', + excelImport: 'Impor Excel', + addQuestion: 'Tambah Soal', + classLabel: 'Kelas:', + totalQuestionsLabel: 'Jumlah Soal:', + durationLabel: 'Durasi:', + durationMinutes: '{count} menit', + loading: 'Memuat soal...', + emptyTitle: 'Belum ada soal di ujian ini', + emptyText: 'Klik "Tambah Soal" atau "Impor Excel" untuk mengisi soal.', + typeLabel: 'Tipe:', + pointsLabel: 'Poin:', + typeMultipleChoice: 'Pilihan Ganda', + typeTrueFalse: 'Benar / Salah', + typeEssay: 'Esai', + deleteQuestion: 'Hapus soal', + correctAnswerLabel: 'Kunci Jawaban:', + addFailed: 'Gagal menambahkan soal', + importSuccess: '{count} soal berhasil diimpor!', + importFailed: 'Gagal mengimpor soal', + deleteConfirm: 'Hapus soal ini dari ujian?', + modalTitle: 'Tambah Soal Ujian', + questionType: 'Tipe Soal', + optionMultipleChoice: 'Pilihan Ganda', + optionTrueFalse: 'Benar / Salah', + optionEssay: 'Esai / Uraian', + points: 'Poin / Bobot Nilai', + questionText: 'Teks Soal', + questionTextPlaceholder: 'Tulis pernyataan atau pertanyaan soal...', + answerOptions: 'Pilihan Jawaban & Kunci Jawaban', + optionPlaceholder: 'Teks pilihan {letter}...', + correct: 'Benar', + correctAnswer: 'Kunci Jawaban', + trueLabel: 'Benar', + falseLabel: 'Salah', + rubric: 'Rubrik Penilaian / Catatan Kunci Jawaban', + rubricPlaceholder: 'Konsep kunci yang harus ada untuk nilai maksimal...', + saveQuestion: 'Simpan Soal', + importTitle: 'Impor Soal Massal dari Excel', + importIntro: 'Unggah spreadsheet .xlsx dengan kolom:', + importColumns: 'Teks Soal, Tipe, Opsi A, Opsi B, Opsi C, Opsi D, Opsi E, Kunci Jawaban, Poin, Pembahasan', + uploading: 'Mengunggah & Memproses...', + importButton: 'Impor Soal', + }, + en: { + backToExams: 'Back to Exams', + excelImport: 'Excel Batch Import', + addQuestion: 'Add Question', + classLabel: 'Class:', + totalQuestionsLabel: 'Total Questions:', + durationLabel: 'Duration:', + durationMinutes: '{count} min', + loading: 'Loading questions...', + emptyTitle: 'No questions in this exam yet', + emptyText: 'Click "Add Question" or "Excel Batch Import" to add questions.', + typeLabel: 'Type:', + pointsLabel: 'Points:', + typeMultipleChoice: 'Multiple choice', + typeTrueFalse: 'True / False', + typeEssay: 'Essay', + deleteQuestion: 'Delete question', + correctAnswerLabel: 'Answer key:', + addFailed: 'Could not add the question', + importSuccess: 'Imported {count} question(s) successfully!', + importFailed: 'Could not import the questions', + deleteConfirm: 'Delete this question from the exam?', + modalTitle: 'Add Exam Question', + questionType: 'Question Type', + optionMultipleChoice: 'Multiple Choice', + optionTrueFalse: 'True / False', + optionEssay: 'Essay / Descriptive', + points: 'Points / Score', + questionText: 'Question Text', + questionTextPlaceholder: 'Enter the problem statement or question...', + answerOptions: 'Answer Options & Answer Key', + optionPlaceholder: 'Option {letter} text...', + correct: 'Correct', + correctAnswer: 'Answer Key', + trueLabel: 'True', + falseLabel: 'False', + rubric: 'Grading Rubric / Answer Key Notes', + rubricPlaceholder: 'Key concepts required for the maximum score...', + saveQuestion: 'Save Question', + importTitle: 'Bulk Import Questions from Excel', + importIntro: 'Upload an .xlsx spreadsheet with columns:', + importColumns: 'Question Text, Type, Opt A, Opt B, Opt C, Opt D, Opt E, Correct Answer, Points, Explanation', + uploading: 'Uploading & Parsing...', + importButton: 'Import Questions', + }, +}); diff --git a/frontend/src/i18n/messages/examList.ts b/frontend/src/i18n/messages/examList.ts new file mode 100644 index 0000000..82c56d7 --- /dev/null +++ b/frontend/src/i18n/messages/examList.ts @@ -0,0 +1,82 @@ +import { defineMessages } from '../define'; + +export const examList = defineMessages({ + id: { + title: 'Ujian CBT (Computer-Based Test)', + subtitle: 'Ujian online interaktif dengan proteksi anti-cheat dan telemetri langsung', + createButton: 'Buat Ujian Baru', + loading: 'Memuat daftar ujian...', + emptyTitle: 'Belum ada ujian terjadwal', + emptyText: 'Ujian yang dijadwalkan akan tampil di sini.', + toggleStatusTitle: 'Klik untuk mengubah status', + statusPublished: 'Terbit', + statusDraft: 'Draf', + classLabel: 'Kelas:', + passingLabel: 'KKM:', + durationMinutes: '{count} Menit', + questionCount: '{count} Soal', + questionOne: '1 Soal', + statusArchived: 'Diarsipkan', + questionsButton: 'Soal ({count})', + liveMonitor: 'Live Monitor', + score: 'Nilai: {score}/100', + passed: 'LULUS', + remedial: 'REMIDI', + continueExam: 'Lanjutkan Ujian', + startExam: 'Mulai Ujian CBT', + createFailed: 'Gagal membuat ujian', + modalTitle: 'Buat Ujian CBT', + examTitle: 'Judul Ujian', + examTitlePlaceholder: 'cth. Penilaian Akhir Semester Ganjil 2026', + subject: 'Mata Pelajaran', + chooseSubject: '-- Pilih Mata Pelajaran --', + targetClass: 'Kelas Tujuan', + chooseClass: '-- Pilih Kelas --', + duration: 'Durasi (Menit)', + passingScore: 'Nilai Minimal Lulus (%)', + startTime: 'Waktu Mulai', + endTime: 'Waktu Selesai', + shuffleQuestions: 'Acak Soal', + shuffleOptions: 'Acak Pilihan Jawaban', + createAndPublish: 'Buat & Publikasikan Ujian', + }, + en: { + title: 'CBT Exams (Computer-Based Test)', + subtitle: 'Interactive online exams with anti-cheat protection and live telemetry', + createButton: 'Create New Exam', + loading: 'Loading exams...', + emptyTitle: 'No exams scheduled', + emptyText: 'Scheduled exams will appear here.', + toggleStatusTitle: 'Click to toggle status', + statusPublished: 'Published', + statusDraft: 'Draft', + classLabel: 'Class:', + passingLabel: 'Passing:', + durationMinutes: '{count} minutes', + questionCount: '{count} questions', + questionOne: '1 question', + statusArchived: 'Archived', + questionsButton: 'Questions ({count})', + liveMonitor: 'Live Monitor', + score: 'Score: {score}/100', + passed: 'PASSED', + remedial: 'REMEDIAL', + continueExam: 'Continue Exam', + startExam: 'Start CBT Exam', + createFailed: 'Could not create the exam', + modalTitle: 'Create CBT Exam', + examTitle: 'Exam Title', + examTitlePlaceholder: 'e.g. Odd Semester Final Assessment 2026', + subject: 'Subject', + chooseSubject: '-- Choose Subject --', + targetClass: 'Target Class', + chooseClass: '-- Choose Class --', + duration: 'Duration (minutes)', + passingScore: 'Passing Score (%)', + startTime: 'Start Time', + endTime: 'End Time', + shuffleQuestions: 'Shuffle Questions', + shuffleOptions: 'Shuffle Answer Options', + createAndPublish: 'Create & Publish Exam', + }, +}); diff --git a/frontend/src/i18n/messages/examMonitor.ts b/frontend/src/i18n/messages/examMonitor.ts new file mode 100644 index 0000000..be9961e --- /dev/null +++ b/frontend/src/i18n/messages/examMonitor.ts @@ -0,0 +1,78 @@ +import { defineMessages } from '../define'; + +export const examMonitor = defineMessages({ + id: { + backToExams: 'Kembali ke Daftar Ujian', + liveActive: 'Telemetri Langsung Aktif', + connecting: 'Menghubungkan WebSocket...', + refresh: 'Muat ulang data', + violationAlert: '🚨 PELANGGARAN: Siswa {name} terdeteksi {reason}!', + reasonTabSwitch: 'pindah tab / meminimalkan jendela', + classLabel: 'Kelas: {name}', + passMark: 'Nilai Minimal Lulus', + activeTitle: 'Sedang Mengerjakan', + completedTitle: 'Sudah Mengumpulkan', + violationsTitle: 'Pelanggaran Proctoring', + studentCount: '{count} siswa', + studentOne: '1 siswa', + flagCount: '{count} tanda', + flagOne: '1 tanda', + tableTitle: 'Telemetri Peserta Real-time', + totalEnrolled: 'Total Peserta: {count}', + loading: 'Memuat data telemetri...', + emptyTitle: 'Belum ada sesi peserta yang aktif', + emptyText: 'Siswa yang masuk ke ruang CBT akan tampil di sini secara otomatis.', + colStudent: 'Siswa', + colStatus: 'Status Sesi', + colProgress: 'Progres Soal', + colViolations: 'Pelanggaran', + colScore: 'Nilai', + colStartedAt: 'Mulai Pukul', + nis: 'NIS: {nis}', + statusInProgress: 'Sedang dikerjakan', + statusSubmitted: 'Dikumpulkan', + statusNeedsGrading: 'Perlu dinilai', + statusCompleted: 'Selesai', + warningCount: '{count} Peringatan', + warningOne: '1 Peringatan', + noFlags: '0 Tanda', + inProgress: 'Sedang berlangsung', + }, + en: { + backToExams: 'Back to Exams', + liveActive: 'Live Telemetry Active', + connecting: 'Connecting WebSocket...', + refresh: 'Refresh data', + violationAlert: '🚨 VIOLATION: Student {name} flagged for {reason}!', + reasonTabSwitch: 'switching tabs / minimizing the window', + classLabel: 'Class: {name}', + passMark: 'Passing Score', + activeTitle: 'Taking the Exam', + completedTitle: 'Submitted & Completed', + violationsTitle: 'Proctoring Violations', + studentCount: '{count} students', + studentOne: '1 student', + flagCount: '{count} flags', + flagOne: '1 flag', + tableTitle: 'Real-time Candidate Telemetry', + totalEnrolled: 'Total Candidates: {count}', + loading: 'Loading telemetry data...', + emptyTitle: 'No active candidate sessions', + emptyText: 'Students entering the CBT room will appear here automatically.', + colStudent: 'Student', + colStatus: 'Session Status', + colProgress: 'Question Progress', + colViolations: 'Violations', + colScore: 'Score', + colStartedAt: 'Started At', + nis: 'Student ID: {nis}', + statusInProgress: 'In progress', + statusSubmitted: 'Submitted', + statusNeedsGrading: 'Needs grading', + statusCompleted: 'Completed', + warningCount: '{count} Warnings', + warningOne: '1 Warning', + noFlags: '0 Flags', + inProgress: 'In progress', + }, +}); diff --git a/frontend/src/i18n/messages/examRunner.ts b/frontend/src/i18n/messages/examRunner.ts new file mode 100644 index 0000000..d9603ac --- /dev/null +++ b/frontend/src/i18n/messages/examRunner.ts @@ -0,0 +1,80 @@ +import { defineMessages } from '../define'; + +export const examRunner = defineMessages({ + id: { + startFailed: 'Gagal memulai sesi ujian', + maxViolations: 'Batas maksimal pelanggaran keamanan tercapai (5). Ujian Anda dikumpulkan secara otomatis.', + submitFailed: 'Gagal mengumpulkan ujian', + preparing: 'Menyiapkan ruang ujian CBT aman...', + accessRestricted: 'Akses Dibatasi', + returnToList: 'Kembali ke Daftar Ujian', + submittedTitle: 'Ujian Selesai Dikirim!', + submittedText: 'Jawaban Anda telah tersimpan dan dinilai oleh sistem.', + finalScore: 'Nilai Akhir', + statusLabel: 'Status:', + passed: 'LULUS', + notPassed: 'REMIDIAL (TIDAK LULUS)', + backToExams: 'Kembali ke Halaman Ujian', + activeSession: 'Sesi Aktif', + autoSaved: 'Tersimpan Otomatis', + toggleFullscreen: 'Aktifkan/nonaktifkan layar penuh', + securityAlert: + 'Peringatan Keamanan: {count}/5 pelanggaran tercatat. Meninggalkan tab ujian akan mengumpulkan ujian Anda secara otomatis!', + questionOf: 'Soal {current} dari {total}', + saving: 'Menyimpan...', + saved: 'Tersimpan', + trueLabel: 'Benar', + falseLabel: 'Salah', + essayLabel: 'Tulis penjelasan / jawaban Anda:', + essayPlaceholder: 'Ketik jawaban Anda di sini...', + previous: 'Sebelumnya', + nextQuestion: 'Soal Berikutnya', + finishAndSubmit: 'Selesai & Kumpulkan Ujian', + questionNav: 'Navigasi Soal', + answeredLabel: 'Terjawab:', + submitAll: 'Kumpulkan Semua Jawaban', + confirmTitle: 'Konfirmasi Pengumpulan', + confirmText: + 'Anda telah menjawab {answered} dari {total} soal. Setelah dikumpulkan, jawaban tidak dapat diubah lagi.', + keepReviewing: 'Periksa Lagi', + submitNow: 'Ya, Kumpulkan Sekarang', + }, + en: { + startFailed: 'Could not start the exam session', + maxViolations: 'Maximum security violations reached (5). Your exam is being submitted automatically.', + submitFailed: 'Could not submit the exam', + preparing: 'Preparing the secure CBT exam room...', + accessRestricted: 'Access Restricted', + returnToList: 'Return to Exam List', + submittedTitle: 'Exam Submitted!', + submittedText: 'Your answers have been saved and graded by the system.', + finalScore: 'Final Score', + statusLabel: 'Status:', + passed: 'PASSED', + notPassed: 'REMEDIAL (NOT PASSED)', + backToExams: 'Back to Exams', + activeSession: 'Active Session', + autoSaved: 'Auto-saved', + toggleFullscreen: 'Toggle fullscreen', + securityAlert: + 'Security Alert: {count}/5 violations recorded. Leaving the exam tab will submit your exam automatically!', + questionOf: 'Question {current} of {total}', + saving: 'Saving...', + saved: 'Saved', + trueLabel: 'True', + falseLabel: 'False', + essayLabel: 'Write your explanation / answer:', + essayPlaceholder: 'Type your answer here...', + previous: 'Previous', + nextQuestion: 'Next Question', + finishAndSubmit: 'Finish & Submit Exam', + questionNav: 'Question Navigation', + answeredLabel: 'Answered:', + submitAll: 'Submit All Answers', + confirmTitle: 'Confirm Submission', + confirmText: + 'You have answered {answered} of {total} questions. Once submitted, your answers cannot be changed.', + keepReviewing: 'Keep Reviewing', + submitNow: 'Yes, Submit Now', + }, +}); diff --git a/frontend/src/i18n/messages/grades.ts b/frontend/src/i18n/messages/grades.ts new file mode 100644 index 0000000..e8fe880 --- /dev/null +++ b/frontend/src/i18n/messages/grades.ts @@ -0,0 +1,52 @@ +import { defineMessages } from '../define'; + +export const grades = defineMessages({ + id: { + loading: 'Memuat rapor akademik...', + noData: 'Data nilai belum tersedia.', + title: 'Nilai & Perkembangan Akademik', + subtitle: 'Rincian capaian pada ujian CBT dan tugas mata pelajaran', + gpa: 'Rata-Rata Nilai (GPA)', + completedExams: 'Ujian Selesai', + completedExamsHint: 'Sesi ujian diselesaikan', + passedExams: 'Ujian Lulus', + passedExamsHint: 'Di atas batas KKM', + subjectBreakdown: 'Rincian Nilai per Mata Pelajaran', + noSubjects: 'Belum ada mata pelajaran terdaftar.', + colSubject: 'Mata Pelajaran', + colCredits: 'SKS', + colExamAvg: 'Rata Ujian CBT', + colAssignmentAvg: 'Rata Tugas', + colFinal: 'Nilai Akhir', + credits: '{count} SKS', + examsTaken: '{count} ujian diikuti', + assignmentsSubmitted: '{count} tugas diserahkan', + passed: 'Lulus', + remedial: 'Remedial', + noScore: 'Belum ada nilai', + }, + en: { + loading: 'Loading academic report card...', + noData: 'No grade data available.', + title: 'Academic Grades & Progress', + subtitle: 'Detailed performance breakdown across CBT exams and course assignments', + gpa: 'Grade Average (GPA)', + completedExams: 'Exams Completed', + completedExamsHint: 'Exam sessions finished', + passedExams: 'Exams Passed', + passedExamsHint: 'Above the passing score', + subjectBreakdown: 'Grades by Subject', + noSubjects: 'No subjects enrolled yet.', + colSubject: 'Subject', + colCredits: 'Credits', + colExamAvg: 'CBT Exam Avg.', + colAssignmentAvg: 'Assignment Avg.', + colFinal: 'Final Grade', + credits: '{count} credits', + examsTaken: 'Exams taken: {count}', + assignmentsSubmitted: 'Assignments submitted: {count}', + passed: 'Passed', + remedial: 'Remedial', + noScore: 'No grade yet', + }, +}); diff --git a/frontend/src/i18n/messages/index.ts b/frontend/src/i18n/messages/index.ts new file mode 100644 index 0000000..c6e0c83 --- /dev/null +++ b/frontend/src/i18n/messages/index.ts @@ -0,0 +1,40 @@ +import { common } from './common'; +import { nav } from './nav'; +import { auth } from './auth'; +import { dashboard } from './dashboard'; +import { teachers } from './teachers'; +import { students } from './students'; +import { classrooms } from './classrooms'; +import { subjects } from './subjects'; +import { announcements } from './announcements'; +import { examList } from './examList'; +import { examEditor } from './examEditor'; +import { examMonitor } from './examMonitor'; +import { examRunner } from './examRunner'; +import { materialsList } from './materialsList'; +import { materialDetail } from './materialDetail'; +import { assignmentList } from './assignmentList'; +import { assignmentDetail } from './assignmentDetail'; +import { grades } from './grades'; + +/** One namespace per page (plus shared ones). Keys are used as t('namespace.key'). */ +export const messages = { + common, + nav, + auth, + dashboard, + teachers, + students, + classrooms, + subjects, + announcements, + examList, + examEditor, + examMonitor, + examRunner, + materialsList, + materialDetail, + assignmentList, + assignmentDetail, + grades, +}; diff --git a/frontend/src/i18n/messages/materialDetail.ts b/frontend/src/i18n/messages/materialDetail.ts new file mode 100644 index 0000000..caa3d08 --- /dev/null +++ b/frontend/src/i18n/messages/materialDetail.ts @@ -0,0 +1,38 @@ +import { defineMessages } from '../define'; + +export const materialDetail = defineMessages({ + id: { + loading: 'Memuat modul...', + notFound: 'Materi tidak ditemukan.', + backToMaterialsShort: 'Kembali ke Materi', + backToMaterials: 'Kembali ke materi', + views: '{count} dilihat', + teacherLabel: 'Guru Pengampu:', + classLabel: 'Kelas:', + allClasses: 'Semua Kelas', + publishedOn: 'Dipublikasikan: {date}', + attachmentTitle: 'Berkas Lampiran ({type})', + attachmentText: 'Unduh atau buka modul silabus pembelajaran', + openDocument: 'Buka Dokumen', + invalidLink: 'Tautan lampiran tidak valid', + readingActivity: 'Aktivitas Membaca Siswa ({count} Selesai)', + noViewers: 'Belum ada siswa yang mengakses materi ini.', + }, + en: { + loading: 'Loading module...', + notFound: 'Material not found.', + backToMaterialsShort: 'Back to Materials', + backToMaterials: 'Back to materials', + views: '{count} views', + teacherLabel: 'Teacher:', + classLabel: 'Class:', + allClasses: 'All Classes', + publishedOn: 'Published: {date}', + attachmentTitle: 'Attachment ({type})', + attachmentText: 'Download or open the learning syllabus module', + openDocument: 'Open Document', + invalidLink: 'Invalid attachment link', + readingActivity: 'Student Reading Activity ({count} Completed)', + noViewers: 'No students have accessed this material yet.', + }, +}); diff --git a/frontend/src/i18n/messages/materialsList.ts b/frontend/src/i18n/messages/materialsList.ts new file mode 100644 index 0000000..6237887 --- /dev/null +++ b/frontend/src/i18n/messages/materialsList.ts @@ -0,0 +1,74 @@ +import { defineMessages } from '../define'; + +export const materialsList = defineMessages({ + id: { + title: 'Materi Pembelajaran', + subtitle: 'Modul silabus digital, panduan bacaan, dan berkas materi kuliah', + uploadButton: 'Unggah Materi', + loading: 'Memuat materi pembelajaran...', + emptyTitle: 'Belum ada materi pembelajaran yang dipublikasikan', + emptyText: 'Guru dapat memublikasikan bacaan dan modul pelajaran di sini.', + views: '{count} dilihat', + noDescription: 'Tidak ada deskripsi.', + classLabel: 'Kelas:', + allClasses: 'Semua', + byLabel: 'Oleh:', + openMaterial: 'Buka Materi', + completed: 'Selesai', + deleteTitle: 'Hapus materi', + confirmDelete: 'Hapus materi pembelajaran ini?', + createFailed: 'Gagal membuat materi', + modalTitle: 'Publikasikan Materi Pembelajaran', + fieldTitle: 'Judul Materi', + fieldTitlePlaceholder: 'mis. Bab 1: Persamaan Linier dan Kuadrat', + fieldSubject: 'Mata Pelajaran', + chooseSubject: '-- Pilih Mata Pelajaran --', + fieldClassroom: 'Kelas Tujuan', + allClassrooms: 'Semua Kelas', + fieldType: 'Jenis Konten', + typePdf: 'Dokumen PDF', + typeArticle: 'Artikel / Teks', + typeVideo: 'Tautan Video', + fieldFile: 'Berkas Lampiran', + fieldDescription: 'Ringkasan Deskripsi', + fieldDescriptionPlaceholder: 'Deskripsi singkat topik...', + fieldContent: 'Konten Lengkap', + fieldContentPlaceholder: 'Markdown atau teks materi...', + publishButton: 'Publikasikan Materi', + }, + en: { + title: 'Learning Materials', + subtitle: 'Digital syllabus modules, reading guides, and course material files', + uploadButton: 'Upload Material', + loading: 'Loading learning materials...', + emptyTitle: 'No learning materials published yet', + emptyText: 'Teachers can publish course readings and modules here.', + views: '{count} views', + noDescription: 'No description.', + classLabel: 'Class:', + allClasses: 'All', + byLabel: 'By:', + openMaterial: 'Open Material', + completed: 'Completed', + deleteTitle: 'Delete material', + confirmDelete: 'Delete this learning material?', + createFailed: 'Failed to create material', + modalTitle: 'Publish Learning Material', + fieldTitle: 'Material Title', + fieldTitlePlaceholder: 'e.g. Chapter 1: Linear and Quadratic Equations', + fieldSubject: 'Subject', + chooseSubject: '-- Choose Subject --', + fieldClassroom: 'Target Class', + allClassrooms: 'All Classes', + fieldType: 'Content Type', + typePdf: 'PDF Document', + typeArticle: 'Article / Text', + typeVideo: 'Video Link', + fieldFile: 'Attachment File', + fieldDescription: 'Summary Description', + fieldDescriptionPlaceholder: 'Short description of the topic...', + fieldContent: 'Detailed Content', + fieldContentPlaceholder: 'Markdown or lecture text...', + publishButton: 'Publish Material', + }, +}); diff --git a/frontend/src/i18n/messages/nav.ts b/frontend/src/i18n/messages/nav.ts new file mode 100644 index 0000000..8c1fe23 --- /dev/null +++ b/frontend/src/i18n/messages/nav.ts @@ -0,0 +1,55 @@ +import { defineMessages } from '../define'; + +/** Navbar and sidebar. */ +export const nav = defineMessages({ + id: { + impersonating: 'Mode Login As:', + stopImpersonating: 'Keluar', + toggleMenu: 'Buka/tutup menu', + closeSidebar: 'Tutup menu samping', + changePassword: 'Ganti Password', + passwordShort: 'Password', + logout: 'Keluar', + logoutTitle: 'Keluar dari Aplikasi', + sectionMain: 'Menu Utama', + sectionManagement: 'Manajemen & User', + sectionAcademic: 'Akademik & CBT', + dashboard: 'Dashboard', + teachers: 'Guru', + students: 'Siswa', + classrooms: 'Kelas', + subjects: 'Mata Pelajaran', + announcements: 'Pengumuman', + examsManage: 'Ujian & CBT', + examsMine: 'Ujian Saya', + materials: 'Materi Belajar', + assignments: 'Tugas & Forum', + grades: 'Nilai & Rapor', + roleTeacherLong: 'Guru Pengajar', + }, + en: { + impersonating: 'Logged in as:', + stopImpersonating: 'Exit', + toggleMenu: 'Toggle menu', + closeSidebar: 'Close sidebar', + changePassword: 'Change Password', + passwordShort: 'Password', + logout: 'Log out', + logoutTitle: 'Log out of the application', + sectionMain: 'Main Menu', + sectionManagement: 'Management & Users', + sectionAcademic: 'Academics & CBT', + dashboard: 'Dashboard', + teachers: 'Teachers', + students: 'Students', + classrooms: 'Classes', + subjects: 'Subjects', + announcements: 'Announcements', + examsManage: 'Exams & CBT', + examsMine: 'My Exams', + materials: 'Learning Materials', + assignments: 'Assignments & Forum', + grades: 'Grades & Report Card', + roleTeacherLong: 'Teacher', + }, +}); diff --git a/frontend/src/i18n/messages/students.ts b/frontend/src/i18n/messages/students.ts new file mode 100644 index 0000000..a2002e0 --- /dev/null +++ b/frontend/src/i18n/messages/students.ts @@ -0,0 +1,102 @@ +import { defineMessages } from '../define'; + +export const students = defineMessages({ + id: { + title: 'Manajemen Siswa', + subtitle: 'Registrasi NIS, impor massal dari Excel, dan kartu ujian CBT', + allClassrooms: 'Semua Kelas', + printCards: 'Cetak Kartu', + importExcel: 'Import Excel', + addStudent: 'Tambah Siswa', + loading: 'Memuat data siswa...', + emptyTitle: 'Belum ada siswa terdaftar', + emptyHint: 'Gunakan "Import Excel" untuk unggah data siswa secara massal.', + colName: 'Nama Siswa', + gender: 'Jenis Kelamin', + classroom: 'Kelas', + male: 'Laki-laki', + female: 'Perempuan', + maleOption: 'Laki-laki (M)', + femaleOption: 'Perempuan (F)', + noClassroom: 'Belum ada kelas', + loginAs: 'Login As', + loginAsTitle: 'Masuk sebagai Siswa', + deleteTitle: 'Hapus Siswa', + confirmDelete: 'Hapus data siswa ini?', + createFailed: 'Gagal menambahkan siswa', + importFailed: 'Gagal mengimpor file Excel', + cardsFailed: 'Gagal memuat kartu ujian', + modalTitle: 'Daftarkan Akun Siswa', + fullName: 'Nama Lengkap', + namePlaceholder: 'cth. Siti Nurhaliza', + selectClassroom: '-- Pilih Kelas --', + emailPlaceholder: 'siswa@sekolah.id', + initialPassword: 'Password Awal', + passwordPlaceholder: 'Default: Student@123', + saveStudent: 'Simpan Siswa', + importTitle: 'Import Siswa dari Excel', + importHintBefore: 'Unggah file', + importHintAfter: 'dengan kolom:', + importSuccess: 'Berhasil diimpor: {count} siswa', + importFailedRows: 'Baris gagal: {count}', + importProcessing: 'Memproses file...', + importStart: 'Mulai Import', + cardsTitle: 'Kartu Peserta Ujian CBT', + cardsSubtitle: 'Kartu peserta ujian resmi dengan verifikasi barcode NIS', + printView: 'Cetak', + cardHeading: 'KARTU PESERTA UJIAN CBT', + cardAcademicYear: 'Tahun Ajaran {year}', + cardName: 'Nama:', + cardGender: 'Jenis Kelamin:', + cardCommittee: 'Panitia Ujian', + }, + en: { + title: 'Student Management', + subtitle: 'NIS registration, bulk Excel import, and CBT exam cards', + allClassrooms: 'All Classes', + printCards: 'Print Cards', + importExcel: 'Import from Excel', + addStudent: 'Add Student', + loading: 'Loading students...', + emptyTitle: 'No students registered yet', + emptyHint: 'Use "Import from Excel" to upload student data in bulk.', + colName: 'Student Name', + gender: 'Gender', + classroom: 'Class', + male: 'Male', + female: 'Female', + maleOption: 'Male (M)', + femaleOption: 'Female (F)', + noClassroom: 'No class yet', + loginAs: 'Log in as', + loginAsTitle: 'Log in as this student', + deleteTitle: 'Delete student', + confirmDelete: 'Delete this student record?', + createFailed: 'Could not add the student', + importFailed: 'Could not import the Excel file', + cardsFailed: 'Could not load the exam cards', + modalTitle: 'Register Student Account', + fullName: 'Full Name', + namePlaceholder: 'e.g. Siti Nurhaliza', + selectClassroom: '-- Select Class --', + emailPlaceholder: 'student@school.com', + initialPassword: 'Initial Password', + passwordPlaceholder: 'Defaults to Student@123', + saveStudent: 'Save Student', + importTitle: 'Import Students from Excel', + importHintBefore: 'Upload an', + importHintAfter: 'spreadsheet with columns:', + importSuccess: 'Successfully imported: {count} students', + importFailedRows: 'Failed rows: {count}', + importProcessing: 'Processing spreadsheet...', + importStart: 'Start Import', + cardsTitle: 'Student CBT Exam Cards', + cardsSubtitle: 'Official exam admission cards with NIS barcode verification', + printView: 'Print', + cardHeading: 'CBT EXAM ADMISSION CARD', + cardAcademicYear: 'Academic Year {year}', + cardName: 'Name:', + cardGender: 'Gender:', + cardCommittee: 'Exam Committee', + }, +}); diff --git a/frontend/src/i18n/messages/subjects.ts b/frontend/src/i18n/messages/subjects.ts new file mode 100644 index 0000000..41bb643 --- /dev/null +++ b/frontend/src/i18n/messages/subjects.ts @@ -0,0 +1,58 @@ +import { defineMessages } from '../define'; + +export const subjects = defineMessages({ + id: { + title: 'Mata Pelajaran', + subtitle: 'Daftar kurikulum, beban SKS, dan guru pengampu', + addSubject: 'Tambah Mapel', + loading: 'Memuat mata pelajaran...', + emptyTitle: 'Belum ada mata pelajaran', + emptyHint: 'Klik "Tambah Mapel" untuk membuat kurikulum pertama.', + colCode: 'Kode', + name: 'Nama Mata Pelajaran', + credits: 'Beban SKS', + teacher: 'Guru Pengampu', + creditsValue: '{count} SKS', + notAssigned: 'Belum ditentukan', + editShort: 'Edit Mapel', + deleteShort: 'Hapus Mapel', + editTitle: 'Edit Mata Pelajaran', + addTitle: 'Tambah Mata Pelajaran', + codeLabel: 'Kode Mapel', + codePlaceholder: 'Contoh: MAT-10', + namePlaceholder: 'Contoh: Matematika Wajib', + selectTeacher: '-- Pilih Guru Pengampu --', + description: 'Deskripsi Silabus', + descriptionPlaceholder: 'Ringkasan kompetensi dasar dan tujuan pembelajaran...', + saveSubject: 'Simpan Mapel', + saveFailed: 'Gagal menyimpan mata pelajaran', + confirmDelete: 'Yakin ingin menghapus mata pelajaran ini?', + }, + en: { + title: 'Subjects', + subtitle: 'Curriculum, credit load, and assigned teachers', + addSubject: 'Add Subject', + loading: 'Loading subjects...', + emptyTitle: 'No subjects yet', + emptyHint: 'Click "Add Subject" to create the first subject.', + colCode: 'Code', + name: 'Subject Name', + credits: 'Credits', + teacher: 'Assigned Teacher', + creditsValue: '{count} credits', + notAssigned: 'Not assigned', + editShort: 'Edit subject', + deleteShort: 'Delete subject', + editTitle: 'Edit Subject', + addTitle: 'Add Subject', + codeLabel: 'Subject Code', + codePlaceholder: 'e.g. MAT-10', + namePlaceholder: 'e.g. Core Mathematics', + selectTeacher: '-- Select Teacher --', + description: 'Syllabus Description', + descriptionPlaceholder: 'Summary of core competencies and learning objectives...', + saveSubject: 'Save Subject', + saveFailed: 'Could not save the subject', + confirmDelete: 'Are you sure you want to delete this subject?', + }, +}); diff --git a/frontend/src/i18n/messages/teachers.ts b/frontend/src/i18n/messages/teachers.ts new file mode 100644 index 0000000..3afbb10 --- /dev/null +++ b/frontend/src/i18n/messages/teachers.ts @@ -0,0 +1,58 @@ +import { defineMessages } from '../define'; + +export const teachers = defineMessages({ + id: { + title: 'Manajemen Guru', + subtitle: 'Daftar akun pendidik, verifikasi NIP, dan akses Login As', + addTeacher: 'Tambah Guru', + loading: 'Memuat data guru...', + emptyTitle: 'Belum ada guru terdaftar', + emptyHint: 'Klik "Tambah Guru" untuk mendaftarkan pendidik baru.', + colName: 'Nama Lengkap Guru', + colPhone: 'No. Telepon', + loginAs: 'Login As', + loginAsTitle: 'Masuk sebagai Guru', + deleteTitle: 'Hapus Guru', + confirmDelete: 'Hapus akun guru ini?', + createFailed: 'Gagal menambahkan guru', + modalTitle: 'Daftarkan Akun Guru', + fullName: 'Nama Lengkap', + namePlaceholder: 'cth. Budi Santoso, M.Pd.', + nip: 'NIP', + phone: 'No. Telepon', + emailAddress: 'Alamat Email', + emailPlaceholder: 'guru@sekolah.id', + initialPassword: 'Password Awal', + passwordPlaceholder: 'Default: Teacher@123', + address: 'Alamat Tempat Tinggal', + addressPlaceholder: 'Alamat lengkap...', + saveTeacher: 'Simpan Guru', + }, + en: { + title: 'Teacher Management', + subtitle: 'Teacher accounts, NIP verification, and Log in as access', + addTeacher: 'Add Teacher', + loading: 'Loading teachers...', + emptyTitle: 'No teachers registered yet', + emptyHint: 'Click "Add Teacher" to register a new teacher.', + colName: 'Teacher Full Name', + colPhone: 'Phone No.', + loginAs: 'Log in as', + loginAsTitle: 'Log in as this teacher', + deleteTitle: 'Delete teacher', + confirmDelete: 'Delete this teacher account?', + createFailed: 'Could not add the teacher', + modalTitle: 'Register Teacher Account', + fullName: 'Full Name', + namePlaceholder: 'e.g. Budi Santoso, M.Pd.', + nip: 'NIP', + phone: 'Phone Number', + emailAddress: 'Email Address', + emailPlaceholder: 'teacher@school.com', + initialPassword: 'Initial Password', + passwordPlaceholder: 'Defaults to Teacher@123', + address: 'Residential Address', + addressPlaceholder: 'Street address...', + saveTeacher: 'Save Teacher', + }, +}); diff --git a/frontend/src/pages/admin/Announcements.tsx b/frontend/src/pages/admin/Announcements.tsx index b293c60..db9af88 100644 --- a/frontend/src/pages/admin/Announcements.tsx +++ b/frontend/src/pages/admin/Announcements.tsx @@ -2,12 +2,20 @@ import React, { useEffect, useState } from 'react'; import api from '../../api/client'; import type { Announcement, ApiResponse } from '../../types'; import { Plus, Trash2, Edit2, Bell, X } from 'lucide-react'; +import { useI18n, type MessageKey } from '../../i18n'; + +const TARGET_LABELS: Record = { + all: 'announcements.targetAllShort', + teacher: 'announcements.targetTeacherShort', + student: 'announcements.targetStudentShort', +}; export const Announcements: React.FC = () => { const [announcements, setAnnouncements] = useState([]); const [loading, setLoading] = useState(true); const [modalOpen, setModalOpen] = useState(false); const [editingItem, setEditingItem] = useState(null); + const { t, locale } = useI18n(); const [form, setForm] = useState({ title: '', @@ -64,12 +72,12 @@ export const Announcements: React.FC = () => { setModalOpen(false); loadData(); } catch (err: any) { - alert(err.response?.data?.message || 'Failed to save announcement'); + alert(err.response?.data?.message || t('announcements.saveFailed')); } }; const handleDelete = async (id: number) => { - if (confirm('Delete this announcement?')) { + if (confirm(t('announcements.confirmDelete'))) { await api.delete(`/announcements/${id}`); loadData(); } @@ -79,37 +87,37 @@ export const Announcements: React.FC = () => {
-

Papan Pengumuman

-

Publikasikan informasi resmi kepada guru dan siswa

+

{t('announcements.title')}

+

{t('announcements.subtitle')}

{loading ? ( -
Memuat pengumuman...
+
{t('announcements.loading')}
) : announcements.length === 0 ? (
-

Belum ada pengumuman yang dipublikasikan

-

Buat berita sekolah atau informasi jadwal ujian di sini.

+

{t('announcements.emptyTitle')}

+

{t('announcements.emptyHint')}

) : (
- - - - - + + + + + @@ -121,7 +129,7 @@ export const Announcements: React.FC = () => {
JudulTarget AudiensStatusTanggalAksi{t('announcements.colTitle')}{t('announcements.target')}{t('common.status')}{t('announcements.colDate')}{t('common.actions')}
- {a.target} + {TARGET_LABELS[a.target] ? t(TARGET_LABELS[a.target]) : a.target} @@ -130,24 +138,24 @@ export const Announcements: React.FC = () => { a.published ? 'bg-emerald-100 text-emerald-800' : 'bg-slate-100 text-slate-600' }`} > - {a.published ? 'Published' : 'Draft'} + {a.published ? t('announcements.published') : t('announcements.draft')} - {new Date(a.createdAt).toLocaleDateString()} + {new Date(a.createdAt).toLocaleDateString(locale)} @@ -166,20 +174,21 @@ export const Announcements: React.FC = () => {

- {editingItem ? 'Edit Announcement' : 'Post New Announcement'} + {editingItem ? t('announcements.editTitle') : t('announcements.addTitle')}

- + setForm({ ...form, title: e.target.value })} className="w-full border border-slate-300 rounded-xl px-3 py-2 focus:ring-1 focus:ring-emerald-500 focus:outline-none" @@ -187,27 +196,27 @@ export const Announcements: React.FC = () => {
- +
- +