feat: upgrade to SQLite session & data store with zero-data-loss migration, dark theme, and Turkish i18n

This commit is contained in:
tyuXX 2026-11-09 20:54:26 +00:00
parent 1af973d001
commit 56274f479b
27 changed files with 4222 additions and 1360 deletions

519
src/services/i18n.ts Normal file
View file

@ -0,0 +1,519 @@
export type SupportedLocale = 'tr' | 'en';
export const DEFAULT_LOCALE: SupportedLocale = 'tr';
export const DAY_NAMES_BY_LOCALE: Record<SupportedLocale, Record<number, string>> = {
tr: {
1: 'Pazartesi',
2: 'Salı',
3: 'Çarşamba',
4: 'Perşembe',
5: 'Cuma'
},
en: {
1: 'Pazartesi',
2: 'Salı',
3: 'Çarşamba',
4: 'Perşembe',
5: 'Cuma'
}
};
const translations: Record<SupportedLocale, Record<string, string>> = {
tr: {
// Brand & Common
'app.title': 'BeKultur (E-Kültür)',
'nav.homework': 'Ödevler',
'nav.syllabus': 'Ders Programı',
'nav.privateLessons': 'Özel Ders',
'nav.exams': 'Sınav Raporları',
'header.student': 'Öğrenci',
'header.logout': 'Çıkış Yap',
'header.themeToggle': 'Tema Değiştir',
'header.themeLight': 'Açık Tema',
'header.themeDark': 'Koyu Tema',
'header.langToggleTitle': 'Dili Değiştir / Switch Language',
// Login (/Kullanici/Giris parity)
'login.pageTitle': 'Giriş Yap - BeKultur (E-Kültür)',
'login.subtitle': 'E-Kültür öğrenci portalı bilgilerinizle giriş yapınız.',
'login.studentIdLabel': 'Öğrenci ID',
'login.studentIdPlaceholder': 'Öğrenci ID',
'login.passwordLabel': 'Parola',
'login.passwordPlaceholder': 'Parola',
'login.rememberMe': 'Beni hatırla',
'login.submit': 'Giriş Yap',
'login.submitting': 'Giriş yapılıyor...',
'login.errorMissing': 'Lütfen Öğrenci ID ve Parola alanlarını doldurunuz.',
'login.errorInvalid': 'Öğrenci ID veya Parola hatalı.',
'login.errorServer': 'Giriş sırasında beklenmeyen bir sunucu hatası oluştu.',
// Homework / Dashboard (/Odev parity)
'dashboard.pageTitle': 'Ödevler - BeKultur',
'dashboard.title': 'Ödevler',
'dashboard.studentLabel': 'Öğrenci',
'dashboard.lastSynced': 'Son güncelleme:',
'dashboard.notSynced': 'Henüz güncellenmedi',
'dashboard.syncRecent': 'Güncel Ödevleri Çek',
'dashboard.syncAll': 'Tüm Geçmişi Çek',
'dashboard.syncing': 'Güncelleniyor...',
'dashboard.syncingAll': 'Tüm geçmiş çekiliyor...',
'dashboard.fetchingRecent': 'Güncel ödevler E-Kültür portalından çekiliyor...',
'dashboard.fetchingAll': 'Tüm ödev geçmişi E-Kültür portalından çekiliyor...',
'dashboard.syncFailed': 'Senkronizasyon başarısız:',
'dashboard.networkError': 'Senkronizasyon sırasında ağ hatası oluştu.',
'dashboard.statCompletion': 'Tamamlanma',
'dashboard.statDoneUnit': 'tamamlandı',
'dashboard.statActive': 'Aktif',
'dashboard.statActiveSub': 'Devam eden ödevler',
'dashboard.statNextWeek': 'Gelecek Hafta Kontrol',
'dashboard.statNextWeekSub': 'Haftaya teslim / kontrol',
'dashboard.statDueSoon': 'Yaklaşan',
'dashboard.statDueSoonSub': '3 gün içinde biten',
'dashboard.statOverdue': 'Süresi Geçen',
'dashboard.statOverdueSub': 'Bitiş tarihi geçmiş',
'dashboard.statTotal': 'Toplam',
'dashboard.statTotalSub': 'Tüm ödevler',
'dashboard.subjectsTitle': 'Dersler',
'dashboard.tabAll': 'Tümü',
'dashboard.tabNextWeek': 'Gelecek Hafta Kontrol',
'dashboard.tabActive': 'Aktif',
'dashboard.tabDueSoon': 'Yaklaşan',
'dashboard.tabCompleted': 'Tamamlanan',
'dashboard.tabOverdue': 'Süresi Geçen',
'dashboard.tabExcluded': 'Hariç Tutulan',
'dashboard.searchPlaceholder': 'Ders, yayın, ünite, konu veya açıklamaya göre ara...',
'dashboard.allSubjectsOption': 'Tüm Dersler',
'dashboard.showingCount': '{count} ödev gösteriliyor',
'dashboard.noResults': 'Filtrelere uygun ödev bulunamadı.',
'dashboard.resetFilters': 'Filtreleri Sıfırla',
'dashboard.checkDateBadge': 'Kontrol:',
'dashboard.badgeExcluded': 'Hariç Tutuldu',
'dashboard.badgeCompleted': 'Tamamlandı',
'dashboard.badgeNextWeek': 'Gelecek Hafta',
'dashboard.badgeDueSoon': 'Yaklaşan',
'dashboard.badgeOverdue': 'Süresi Geçti',
'dashboard.badgeActive': 'Aktif',
'dashboard.btnExclude': 'Hariç Tut',
'dashboard.btnRestore': 'Geri Al',
'dashboard.btnExcludeTitle': 'Bu ödevi listenden hariç tut (örn. başka sınıfa ait ödev)',
'dashboard.btnRestoreTitle': 'Bu ödevi aktif listene geri ekle',
'dashboard.unitLabel': 'Ünite:',
'dashboard.topicLabel': 'Konu:',
'dashboard.dateRangeLabel': 'Başlangıç - Bitiş Tarihi:',
'dashboard.descriptionLabel': 'Açıklama:',
'dashboard.completedOn': 'Tamamlandı:',
'dashboard.offlineToggleAlert': 'Çevrimdışı moddasınız. Ödev durumu internet bağlantısı olmadan değiştirilemez.',
'dashboard.offlineExcludeAlert': 'Çevrimdışı moddasınız. Ödev hariç tutma/geri alma işlemi için internet bağlantısı gereklidir.',
'dashboard.offlineSyncAlert': 'Çevrimdışı moddasınız. Senkronizasyon için internet bağlantısı gereklidir.',
// Syllabus (/dersprogrami parity)
'syllabus.pageTitle': 'Ders Programı - BeKultur',
'syllabus.title': 'Ders Programı',
'syllabus.weekLabel': 'Hafta:',
'syllabus.syncedLabel': 'Son güncelleme:',
'syllabus.notSynced': 'Henüz güncellenmedi',
'syllabus.syncBtn': 'Ders Programını Güncelle',
'syllabus.syncing': 'Güncelleniyor...',
'syllabus.fetchingAlert': '5 günlük ders programı E-Kültür portalından çekiliyor...',
'syllabus.updatedAlert': 'Ders programı başarıyla güncellendi!',
'syllabus.stationLabel': 'İstasyon:',
'syllabus.allStations': 'Tüm İstasyonlar',
'syllabus.advisorLabel': 'Danışman:',
'syllabus.advisoryTag': 'Danışmanlık',
'syllabus.viewLabel': 'Görünüm:',
'syllabus.dayView': 'Günlük Görünüm',
'syllabus.weekView': 'Haftalık Tablo',
'syllabus.todayBadge': 'Bugün',
'syllabus.noLessonsDay': '{day} günü için ders kaydı bulunamadı. Portaldan çekmek için "Ders Programını Güncelle" butonuna tıklayınız.',
'syllabus.classBadge': 'Sınıf',
'syllabus.periodHeader': 'Ders Saati',
'syllabus.periodNumberLabel': '{period}. Ders',
'syllabus.nowInSession': 'Şu anki ders: {period} — {subject} ({time})',
'syllabus.nextUp': 'Sıradaki ders: {period} — {subject} ({time})',
'syllabus.offlineStationAlert': 'Çevrimdışı moddasınız. İstasyon seçimi için internet bağlantısı gereklidir.',
// Private Lessons (/ozelders & /ozeldersistek parity)
'privateLessons.pageTitle': 'Özel Ders - BeKultur',
'privateLessons.title': 'Özel Ders',
'privateLessons.subtitle': 'Özel Ders & Başvuru',
'privateLessons.syncedLabel': 'Son güncelleme:',
'privateLessons.syncBtn': 'Dersleri Güncelle',
'privateLessons.syncing': 'Güncelleniyor...',
'privateLessons.syncSuccess': '{count} özel ders kaydı başarıyla güncellendi.',
'privateLessons.advisorLabel': 'Danışman:',
'privateLessons.policyNote': 'Başkası adına özel ders almayınız, seçtiğiniz öğretmen onayladığı takdirde özel derse alınacaksınız.',
'privateLessons.requestTitle': 'Özel Ders İstek',
'privateLessons.onlineBadge': 'Online Başvuru',
'privateLessons.courseLabel': 'Ders',
'privateLessons.unitLabel': 'Ünite',
'privateLessons.topicLabel': 'Konu',
'privateLessons.loading': 'Yükleniyor...',
'privateLessons.selectPrompt': 'Seçiniz...',
'privateLessons.selectCourseFirst': 'Önce ders seçiniz...',
'privateLessons.selectUnitFirst': 'Önce ünite seçiniz...',
'privateLessons.noUnitFound': 'Ünite bulunamadı',
'privateLessons.noTopicFound': 'Konu bulunamadı',
'privateLessons.errorOccurred': 'Hata oluştu',
'privateLessons.submitBtn': 'Gönder',
'privateLessons.submittingBtn': 'Gönderiliyor...',
'privateLessons.myLessonsTitle': 'Özel Derslerim',
'privateLessons.filterAll': 'Tümü',
'privateLessons.upcomingGroupTitle': 'Yaklaşan / Onaylanan Özel Dersler',
'privateLessons.upcomingBadge': 'Yaklaşan',
'privateLessons.activeCountBadge': '{count} Aktif',
'privateLessons.pastGroupTitle': 'Özel Ders Geçmişi',
'privateLessons.pastCountBadge': '{count} Geçmiş',
'privateLessons.completedBadge': 'Tamamlandı',
'privateLessons.emptyState': 'Henüz kayıtlı özel dersiniz bulunmuyor. Yukarıdaki formdan başvuru yapabilir veya portaldan çekmek için "Dersleri Güncelle" butonuna tıklayabilirsiniz.',
// Exam Reports (/rapor/sinav, /rapor/sinavkarne, /rapor/yanliskonu, /ogrencisoruanaliz parity)
'exams.pageTitle': 'Sınav Raporları - BeKultur',
'exams.title': 'Sınav Raporları',
'exams.subtitle': 'Sınav Karne, Gelişim Analizi & Öğrenci Soru Analiz',
'exams.syncedLabel': 'Son güncelleme:',
'exams.syncBtn': 'Sınavları Güncelle',
'exams.syncing': 'Güncelleniyor...',
'exams.kpiLatestNet': 'Son Sınav Neti',
'exams.kpiVsPrior': 'net (önceki sınava göre)',
'exams.kpiBaseline': 'İlk sınav (Referans)',
'exams.kpiBestNet': 'En Yüksek Net',
'exams.kpiAcrossExams': 'Toplam {count} sınav içinde',
'exams.kpiAvgNet': 'Ortalama Net',
'exams.kpiAvgSub': 'Genel net ortalaması',
'exams.kpiCurrentRank': 'Genel Sıra',
'exams.kpiBestRank': 'En iyi derece: #{rank}',
'exams.kpiGeneralStanding': 'Genel sıralama',
'exams.filterAll': 'Tüm Sınavlar',
'exams.answerKey': 'Cevap Anahtarı',
'exams.generalRankLabel': 'Genel Sıra :',
'exams.schoolRankLabel': 'Okul Sıra :',
'exams.rankDeltaUnit': 'sıra',
'exams.reviewMistakesBtn': '{count} Yanlış / Boş Soruyu İncele',
'exams.subtabBreakdown': 'Sınav Karne (Ders Dağılımı)',
'exams.subtabWeakness': 'Yanlış Konular (Zayıf Konu Analizi)',
'exams.colSubject': 'Ders',
'exams.colQuestions': 'Soru',
'exams.colCorrect': 'Doğru',
'exams.colWrong': 'Yanlış',
'exams.colEmpty': 'Boş',
'exams.colNet': 'Net',
'exams.colDeltaNet': 'Net Değişim (Δ)',
'exams.colSuccessRate': 'Başarı Oranı',
'exams.rowTotal': 'TOPLAM',
'exams.viewWrongQuestionsTitle': '{count} yanlış soruyu görüntülemek için tıklayınız',
'exams.viewEmptyQuestionsTitle': '{count} boş soruyu görüntülemek için tıklayınız',
'exams.weaknessLoading': 'Yanlış konu analizi yükleniyor...',
'exams.weaknessEmpty': 'Bu sınav için henüz yanlış konu kaydı bulunamadı veya tüm konularda tam başarı sağlandı.',
'exams.weaknessError': 'Yanlış konu raporu yüklenirken bir hata oluştu.',
'exams.weaknessTotal': 'Toplam:',
'exams.weaknessCorrect': 'Doğru:',
'exams.weaknessWrong': 'Yanlış:',
'exams.weaknessEmptyCount': 'Boş:',
'exams.modalTitle': 'Öğrenci Soru Analiz',
'exams.modalSubtitle': 'Yanlış ve Boş Bırakılan Sorular',
'exams.modalTypeAll': 'Tümü',
'exams.modalTypeWrong': 'Yanlış',
'exams.modalTypeEmpty': 'Boş',
'exams.modalAllMistakes': 'Tüm Sorular',
'exams.modalLoading': 'Sorular getiriliyor...',
'exams.modalNoMatch': 'Seçili filtrelere uygun soru bulunamadı.',
'exams.modalError': 'Sorular yüklenirken bir hata oluştu.',
'exams.questionNo': 'SoruNo: {num}',
'exams.correctAnswer': 'Doğru Cevap:',
'exams.studentAnswer': 'Öğrenci Cevap:',
'exams.emptyAnswerText': 'Boş',
'exams.zoomHint': 'Büyütmek için tıklayınız',
'exams.noImage': 'Soru görseli bulunamadı.',
'exams.emptyTitle': 'Henüz Sınav Raporu Bulunmuyor',
'exams.emptyDesc': 'Öğrenci portalındaki sınav karnelerinizi içe aktarmak için "Sınavları Güncelle" butonuna tıklayınız.',
// Exam Ratings
'rating.Breakthrough': 'Sıçrama',
'rating.Outperformed Curve': 'Zor Sınavda Başarı',
'rating.Net Growth': 'Net Artışı',
'rating.Rank Climb': 'Sıralama Yükselişi',
'rating.Top 10 Consistency': 'İlk 10 İstikrarı',
'rating.Needs Review': 'Tekrar Gerekli',
'rating.Stable Performance': 'Dengeli Performans',
'rating.Top 10 Baseline': 'İlk 10 Başlangıç',
'rating.Baseline Exam': 'İlk Sınav',
// PWA & Offline
'pwa.offlineBadge': '⚡ Çevrimdışı',
'pwa.offlineText': 'Önbellekteki veriler gösteriliyor. Bağlantı gerektiren işlemler duraklatıldı.',
'pwa.onlineBadge': '✓ Çevrimiçi',
'pwa.onlineText': 'Bağlantı yeniden sağlandı. Canlı özellikler aktif.',
'pwa.offlineSuffix': '(Çevrimdışı)',
'pwa.offlineCheckboxTitle': 'Çevrimdışı mod: Ödev durumu bağlantı olmadan değiştirilemez.',
'pwa.offlineExcludeTitle': 'Çevrimdışı mod: Ödev bağlantı olmadan hariç tutulamaz.',
'pwa.offlineStationTitle': 'Çevrimdışı mod: İstasyon seçimi bağlantı gerektirir.',
'pwa.offlineSyncTitle': 'Çevrimdışı mod: Senkronizasyon internet bağlantısı gerektirir.',
'pwa.offlinePrivateNotice': '⚡ <strong>Çevrimdışı mod:</strong> Yeni özel ders başvurusu yapmak için internet bağlantısı gereklidir.'
},
en: {
// Brand & Common
'app.title': 'BeKultur (Better E-Kultur)',
'nav.homework': 'Homework',
'nav.syllabus': 'Syllabus',
'nav.privateLessons': 'Private Lessons',
'nav.exams': 'Exams',
'header.student': 'Student',
'header.logout': 'Log out',
'header.themeToggle': 'Toggle Theme',
'header.themeLight': 'Light Theme',
'header.themeDark': 'Dark Theme',
'header.langToggleTitle': 'Switch Language / Dili Değiştir',
// Login
'login.pageTitle': 'Login - BeKultur (Better E-Kultur)',
'login.subtitle': 'Log in with your school portal credentials.',
'login.studentIdLabel': 'Student ID',
'login.studentIdPlaceholder': 'Student ID',
'login.passwordLabel': 'Password',
'login.passwordPlaceholder': 'Password',
'login.rememberMe': 'Remember credentials',
'login.submit': 'Log In',
'login.submitting': 'Logging in...',
'login.errorMissing': 'Please enter both Student ID and Password.',
'login.errorInvalid': 'Authentication failed. Please check your credentials.',
'login.errorServer': 'An unexpected server error occurred during login.',
// Homework / Dashboard
'dashboard.pageTitle': 'Dashboard - BeKultur',
'dashboard.title': 'Homework',
'dashboard.studentLabel': 'Student',
'dashboard.lastSynced': 'Last synced:',
'dashboard.notSynced': 'Not synced',
'dashboard.syncRecent': 'Sync Recent',
'dashboard.syncAll': 'Sync Full History',
'dashboard.syncing': 'Syncing...',
'dashboard.syncingAll': 'Syncing all...',
'dashboard.fetchingRecent': 'Fetching recent assignments...',
'dashboard.fetchingAll': 'Syncing full history from portal...',
'dashboard.syncFailed': 'Sync failed:',
'dashboard.networkError': 'Network error while syncing.',
'dashboard.statCompletion': 'Completion',
'dashboard.statDoneUnit': 'done',
'dashboard.statActive': 'Active',
'dashboard.statActiveSub': 'In progress',
'dashboard.statNextWeek': 'Checked Next Week',
'dashboard.statNextWeekSub': 'Due or checked next week',
'dashboard.statDueSoon': 'Due Soon',
'dashboard.statDueSoonSub': 'Within 3 days',
'dashboard.statOverdue': 'Overdue',
'dashboard.statOverdueSub': 'Past deadline',
'dashboard.statTotal': 'Total',
'dashboard.statTotalSub': 'All assignments',
'dashboard.subjectsTitle': 'Subjects',
'dashboard.tabAll': 'All',
'dashboard.tabNextWeek': 'Checked Next Week',
'dashboard.tabActive': 'Active',
'dashboard.tabDueSoon': 'Due Soon',
'dashboard.tabCompleted': 'Completed',
'dashboard.tabOverdue': 'Overdue',
'dashboard.tabExcluded': 'Excluded',
'dashboard.searchPlaceholder': 'Filter by subject, book, or description...',
'dashboard.allSubjectsOption': 'All Subjects',
'dashboard.showingCount': 'Showing {count} assignments',
'dashboard.noResults': 'No matching assignments found.',
'dashboard.resetFilters': 'Reset filters',
'dashboard.checkDateBadge': 'Kontrol:',
'dashboard.badgeExcluded': 'Excluded',
'dashboard.badgeCompleted': 'Done',
'dashboard.badgeNextWeek': 'Next Week',
'dashboard.badgeDueSoon': 'Due Soon',
'dashboard.badgeOverdue': 'Overdue',
'dashboard.badgeActive': 'Active',
'dashboard.btnExclude': 'Exclude',
'dashboard.btnRestore': 'Restore',
'dashboard.btnExcludeTitle': 'Exclude this homework (e.g. from another class)',
'dashboard.btnRestoreTitle': 'Restore this homework to your active list',
'dashboard.unitLabel': 'Ünite:',
'dashboard.topicLabel': 'Konu:',
'dashboard.dateRangeLabel': 'Start - End Date:',
'dashboard.descriptionLabel': 'Description:',
'dashboard.completedOn': 'Done:',
'dashboard.offlineToggleAlert': 'You are offline. Homework status cannot be changed without an internet connection.',
'dashboard.offlineExcludeAlert': 'You are offline. Excluding/restoring homework requires an internet connection.',
'dashboard.offlineSyncAlert': 'You are offline. Syncing requires an internet connection.',
// Syllabus
'syllabus.pageTitle': 'Syllabus - BeKultur',
'syllabus.title': 'Syllabus',
'syllabus.weekLabel': 'Week:',
'syllabus.syncedLabel': 'Synced:',
'syllabus.notSynced': 'Not synced',
'syllabus.syncBtn': 'Sync Syllabus',
'syllabus.syncing': 'Syncing...',
'syllabus.fetchingAlert': 'Fetching weekly timetable across all 5 days...',
'syllabus.updatedAlert': 'Syllabus updated successfully!',
'syllabus.stationLabel': 'Station:',
'syllabus.allStations': 'All Stations',
'syllabus.advisorLabel': 'Advisor:',
'syllabus.advisoryTag': 'Danışmanlık',
'syllabus.viewLabel': 'View:',
'syllabus.dayView': 'Day View',
'syllabus.weekView': 'Full Week Grid',
'syllabus.todayBadge': 'Today',
'syllabus.noLessonsDay': 'No lessons found for {day}. Click "Sync Syllabus" to fetch from portal.',
'syllabus.classBadge': 'Class',
'syllabus.periodHeader': 'Period',
'syllabus.periodNumberLabel': '{period}. Ders',
'syllabus.nowInSession': 'Now in session: {period} — {subject} ({time})',
'syllabus.nextUp': 'Next up: {period} — {subject} at {time}',
'syllabus.offlineStationAlert': 'You are offline. Station selection requires an internet connection.',
// Private Lessons
'privateLessons.pageTitle': 'Private Lessons - BeKultur',
'privateLessons.title': 'Private Lessons',
'privateLessons.subtitle': 'Özel Ders & Başvuru',
'privateLessons.syncedLabel': 'Synced:',
'privateLessons.syncBtn': 'Sync Lessons',
'privateLessons.syncing': 'Syncing...',
'privateLessons.syncSuccess': 'Successfully refreshed {count} private lesson records.',
'privateLessons.advisorLabel': 'Advisor:',
'privateLessons.policyNote': 'Başkası adına özel ders almayınız, seçtiğiniz öğretmen onayladığı takdirde özel derse alınacaksınız.',
'privateLessons.requestTitle': 'New Lesson Request (Özel Ders İstek)',
'privateLessons.onlineBadge': 'Online Başvuru',
'privateLessons.courseLabel': 'Ders (Course)',
'privateLessons.unitLabel': 'Ünite (Unit)',
'privateLessons.topicLabel': 'Konu (Topic)',
'privateLessons.loading': 'Loading...',
'privateLessons.selectPrompt': 'Seçiniz...',
'privateLessons.selectCourseFirst': 'Önce ders seçiniz...',
'privateLessons.selectUnitFirst': 'Önce ünite seçiniz...',
'privateLessons.noUnitFound': 'Ünite bulunamadı',
'privateLessons.noTopicFound': 'Konu bulunamadı',
'privateLessons.errorOccurred': 'Hata oluştu',
'privateLessons.submitBtn': 'Submit Request (Gönder)',
'privateLessons.submittingBtn': 'Gönderiliyor...',
'privateLessons.myLessonsTitle': 'My Lessons (Özel Derslerim)',
'privateLessons.filterAll': 'All',
'privateLessons.upcomingGroupTitle': 'Upcoming / Approved Lessons',
'privateLessons.upcomingBadge': 'Upcoming',
'privateLessons.activeCountBadge': '{count} Active',
'privateLessons.pastGroupTitle': 'Lesson History',
'privateLessons.pastCountBadge': '{count} Past',
'privateLessons.completedBadge': 'Completed',
'privateLessons.emptyState': 'No private lessons recorded yet. Submit a request above or click Sync Lessons to fetch from the portal.',
// Exam Reports
'exams.pageTitle': 'Exam Reports - BeKultur',
'exams.title': 'Exam Reports',
'exams.subtitle': 'Sınav Raporları, Gelişim Analizi & Soru İnceleme',
'exams.syncedLabel': 'Synced:',
'exams.syncBtn': 'Sync Exams',
'exams.syncing': 'Syncing...',
'exams.kpiLatestNet': 'Latest Net',
'exams.kpiVsPrior': 'net vs prior',
'exams.kpiBaseline': 'Baseline exam',
'exams.kpiBestNet': 'Personal Best Net',
'exams.kpiAcrossExams': 'Across all {count} exams',
'exams.kpiAvgNet': 'Average Net',
'exams.kpiAvgSub': 'Overall student mean',
'exams.kpiCurrentRank': 'Current Rank',
'exams.kpiBestRank': 'Best standing: #{rank}',
'exams.kpiGeneralStanding': 'General standing',
'exams.filterAll': 'All Exams',
'exams.answerKey': 'Cevap Anahtarı',
'exams.generalRankLabel': 'Genel Sıra :',
'exams.schoolRankLabel': 'Okul Sıra :',
'exams.rankDeltaUnit': 'sıra',
'exams.reviewMistakesBtn': 'Review {count} Mistakes',
'exams.subtabBreakdown': 'Subject Breakdown (Ders Dağılımı)',
'exams.subtabWeakness': 'Topic Weaknesses (Zayıf Konular)',
'exams.colSubject': 'Ders',
'exams.colQuestions': 'Soru',
'exams.colCorrect': 'Doğru',
'exams.colWrong': 'Yanlış',
'exams.colEmpty': 'Boş',
'exams.colNet': 'Net',
'exams.colDeltaNet': 'Net Değişim (Δ)',
'exams.colSuccessRate': 'Başarı Oranı',
'exams.rowTotal': 'TOPLAM',
'exams.viewWrongQuestionsTitle': 'Click to view {count} wrong questions',
'exams.viewEmptyQuestionsTitle': 'Click to view {count} blank questions',
'exams.weaknessLoading': 'Zayıf konu analizi yükleniyor...',
'exams.weaknessEmpty': 'Bu sınav için henüz zayıf konu kaydı bulunamadı veya tüm konularda tam başarı sağlandı.',
'exams.weaknessError': 'Zayıf konu raporu yüklenirken bir hata oluştu.',
'exams.weaknessTotal': 'Toplam:',
'exams.weaknessCorrect': 'Doğru:',
'exams.weaknessWrong': 'Yanlış:',
'exams.weaknessEmptyCount': 'Boş:',
'exams.modalTitle': 'Review Mistakes',
'exams.modalSubtitle': 'Wrong & Blank Questions',
'exams.modalTypeAll': 'All',
'exams.modalTypeWrong': 'Wrong (Yanlış)',
'exams.modalTypeEmpty': 'Blank (Boş)',
'exams.modalAllMistakes': 'Tüm Yanlışlar',
'exams.modalLoading': 'Sorular getiriliyor...',
'exams.modalNoMatch': 'Seçili filtrelere uygun soru bulunamadı.',
'exams.modalError': 'Sorular yüklenirken bir hata oluştu.',
'exams.questionNo': 'Soru #{num}',
'exams.correctAnswer': 'Doğru:',
'exams.studentAnswer': 'Öğrenci:',
'exams.emptyAnswerText': 'Boş',
'exams.zoomHint': 'Büyütmek için tıklayınız',
'exams.noImage': 'Soru görseli bulunamadı.',
'exams.emptyTitle': 'Henüz Sınav Raporu Bulunmuyor',
'exams.emptyDesc': 'Öğrenci portalındaki sınav verilerini içe aktarmak için "Sync Exams" butonuna tıklayınız.',
// Exam Ratings
'rating.Breakthrough': 'Breakthrough',
'rating.Outperformed Curve': 'Outperformed Curve',
'rating.Net Growth': 'Net Growth',
'rating.Rank Climb': 'Rank Climb',
'rating.Top 10 Consistency': 'Top 10 Consistency',
'rating.Needs Review': 'Needs Review',
'rating.Stable Performance': 'Stable Performance',
'rating.Top 10 Baseline': 'Top 10 Baseline',
'rating.Baseline Exam': 'Baseline Exam',
// PWA & Offline
'pwa.offlineBadge': '⚡ Offline',
'pwa.offlineText': 'Showing locally cached data. Actions requiring connection are paused.',
'pwa.onlineBadge': '✓ Online',
'pwa.onlineText': 'Connection restored. Live features re-enabled.',
'pwa.offlineSuffix': '(Offline)',
'pwa.offlineCheckboxTitle': 'Offline mode: Homework status cannot be changed without connection.',
'pwa.offlineExcludeTitle': 'Offline mode: Homework cannot be excluded without connection.',
'pwa.offlineStationTitle': 'Offline mode: Station selection requires connection.',
'pwa.offlineSyncTitle': 'Offline mode: Sync requires internet connection.',
'pwa.offlinePrivateNotice': '⚡ <strong>Çevrimdışı mod:</strong> Yeni özel ders başvurusu yapmak için internet bağlantısı gereklidir.'
}
};
export function normalizeLocale(input?: string | null): SupportedLocale {
if (!input) return DEFAULT_LOCALE;
const cleaned = input.trim().toLowerCase();
if (cleaned === 'en' || cleaned.startsWith('en-')) return 'en';
if (cleaned === 'tr' || cleaned.startsWith('tr-')) return 'tr';
return DEFAULT_LOCALE;
}
export function translate(
locale: SupportedLocale,
key: string,
params?: Record<string, string | number>
): string {
const dict = translations[locale] || translations[DEFAULT_LOCALE];
let template = dict[key] ?? translations[DEFAULT_LOCALE][key] ?? key;
if (params) {
for (const [k, v] of Object.entries(params)) {
template = template.replace(new RegExp(`\\{${k}\\}`, 'g'), String(v));
}
}
return template;
}
export function createTranslator(locale: SupportedLocale) {
return (key: string, params?: Record<string, string | number>): string => {
return translate(locale, key, params);
};
}
export function getClientDictionary(locale: SupportedLocale): Record<string, string> {
return translations[locale] || translations[DEFAULT_LOCALE];
}