From dc6297b93bd2effc43e1ac813fa2e200419bd6a3 Mon Sep 17 00:00:00 2001 From: Flatlogic Bot Date: Wed, 25 Feb 2026 22:41:29 +0000 Subject: [PATCH] Bagus ini --- app/Controllers/AIController.php | 10 +++--- assets/js/main.js | 10 +++--- lang/en.php | 60 +++++++++++++++++++++++++++++++- lang/id.php | 60 +++++++++++++++++++++++++++++++- views/404.php | 4 +-- views/apk_detail.php | 42 +++++++++++----------- views/auth/profile.php | 34 ++++++++++++------ views/blog/detail.php | 10 +++--- views/blog/index.php | 8 ++--- views/contact.php | 26 +++++++------- views/footer.php | 20 +++++------ views/header.php | 16 +++++++-- views/home.php | 10 +++--- 13 files changed, 225 insertions(+), 85 deletions(-) diff --git a/app/Controllers/AIController.php b/app/Controllers/AIController.php index a5570b8..0c73043 100644 --- a/app/Controllers/AIController.php +++ b/app/Controllers/AIController.php @@ -3,6 +3,7 @@ namespace App\Controllers; use App\Core\Controller; +use App\Services\LanguageService; class AIController extends Controller { @@ -13,13 +14,14 @@ class AIController extends Controller { $userMessage = $input['message'] ?? ''; if (empty($userMessage)) { - echo json_encode(['error' => 'Message is empty']); + echo json_encode(['error' => __('error_empty_message', 'Message is empty')]); return; } require_once __DIR__ . '/../../ai/LocalAIApi.php'; - $systemPrompt = "You are a helpful assistant for " . get_setting('site_name', 'ApkNusa') . ", an APK downloader and tech blog site. Provide concise and accurate information about Android apps, games, and technology. Be youthful and professional."; + $langName = LanguageService::getLang() == 'id' ? 'Indonesian' : 'English'; + $systemPrompt = "You are a helpful assistant for " . get_setting('site_name', 'ApkNusa') . ", an APK downloader and tech blog site. Provide concise and accurate information about Android apps, games, and technology. Be youthful and professional. IMPORTANT: Always respond in " . $langName . "."; $resp = \LocalAIApi::createResponse([ 'input' => [ @@ -32,7 +34,7 @@ class AIController extends Controller { $text = \LocalAIApi::extractText($resp); echo json_encode(['reply' => $text]); } else { - echo json_encode(['error' => 'AI Assistant is currently unavailable.']); + echo json_encode(['error' => __('error_ai', 'AI Assistant is currently unavailable.')]); } } -} +} \ No newline at end of file diff --git a/assets/js/main.js b/assets/js/main.js index 5515d1a..e1ba29c 100644 --- a/assets/js/main.js +++ b/assets/js/main.js @@ -26,7 +26,7 @@ document.addEventListener('DOMContentLoaded', () => { const textLabels = document.querySelectorAll('.theme-status-text'); textLabels.forEach(label => { - label.textContent = theme === 'dark' ? 'Dark Mode' : 'Light Mode'; + label.textContent = theme === 'dark' ? (window.i18n?.dark_mode || 'Dark Mode') : (window.i18n?.light_mode || 'Light Mode'); }); }; @@ -170,7 +170,7 @@ document.addEventListener('DOMContentLoaded', () => { .catch(err => { btn.disabled = false; btn.innerHTML = originalText; - msg.innerHTML = 'An error occurred.'; + msg.innerHTML = `${window.i18n?.error_generic || 'An error occurred.'}`; }); }); }; @@ -222,7 +222,7 @@ document.addEventListener('DOMContentLoaded', () => { const loadingDiv = document.createElement('div'); loadingDiv.className = 'mb-3 d-flex'; - loadingDiv.innerHTML = '
Thinking...
'; + loadingDiv.innerHTML = `
${window.i18n?.thinking || 'Thinking...'}
`; messagesContainer.appendChild(loadingDiv); messagesContainer.scrollTop = messagesContainer.scrollHeight; @@ -237,12 +237,12 @@ document.addEventListener('DOMContentLoaded', () => { if (data.reply) { appendMessage(data.reply); } else { - appendMessage(data.error || 'Sorry, something went wrong.'); + appendMessage(data.error || (window.i18n?.something_wrong || 'Sorry, something went wrong.')); } }) .catch(err => { if (messagesContainer.contains(loadingDiv)) messagesContainer.removeChild(loadingDiv); - appendMessage('Error connecting to AI assistant.'); + appendMessage(window.i18n?.error_ai || 'Error connecting to AI assistant.'); console.error(err); }); }; diff --git a/lang/en.php b/lang/en.php index 2840e67..fb735a4 100644 --- a/lang/en.php +++ b/lang/en.php @@ -145,4 +145,62 @@ return array ( '404_title' => 'Page Not Found', '404_text' => 'The page you are looking for might have been removed, had its name changed, or is temporarily unavailable.', 'back_to_home' => 'Back to Home', -); + 'featured_apps' => 'Featured Apps', + 'newsletter_title' => 'Subscribe to our Newsletter', + 'newsletter_subtitle' => 'Get notified about the latest APKs and updates directly in your inbox.', + 'enter_email' => 'Enter your email', + 'all' => 'All', + 'similar_apps' => 'Similar Apps', + 'support_issues' => 'Support & Issues', + 'support_text' => 'Found a problem with this app or want to request a newer version?', + 'report_issue' => 'Report Issue', + 'request_update' => 'Request Update', + 'your_email' => 'Your Email', + 'message_details' => 'Message / Details', + 'message_placeholder' => 'Please describe the issue or your request...', + 'send' => 'Send', + 'verified' => 'Verified', + 'share_text' => 'Check out this app on ApkNusa!', + 'error_occurred' => 'An error occurred.', + 'sending' => 'Sending...', + 'copied' => 'Copied!', + 'search_apks' => 'Search APKs', + 'search_go' => 'Go', + 'popular_categories' => 'Popular Categories', + 'ai_assistant' => 'ApkNusa AI', + 'ai_greeting' => 'Hello! How can I help you today?', + 'type_message' => 'Type a message...', + 'blog' => 'Blog', + 'contact' => 'Contact', + 'dark_mode' => 'Dark Mode', + 'light_mode' => 'Light Mode', + 'language' => 'Language', + 'back' => 'Back', + 'get_in_touch' => 'Get in Touch', + 'contact_subtitle' => 'Have questions or feedback about our APKs? We\'d love to hear from you. Send us a message and we\'ll respond as soon as possible.', + 'follow_us' => 'Follow Us', + 'full_name' => 'Full Name', + 'your_name' => 'Your Name', + 'email_address' => 'Email Address', + 'subject' => 'Subject', + 'help_how' => 'How can we help?', + 'message' => 'Message', + 'your_message_here' => 'Your message here...', + 'send_message' => 'Send Message', + 'processing' => 'Processing...', + 'pending' => 'Pending', + 'approved' => 'Approved', + 'rejected' => 'Rejected', + 'bank_transfer' => 'Bank Transfer', + 'error_try_again' => 'An error occurred. Please try again.', + 'blog_title' => 'Blog & Articles', + 'blog_subtitle' => 'Get the latest information about apps, games, and tech tips here.', + 'no_articles' => 'No articles published yet.', + 'share_article' => 'Share this article:', + 'admin_user' => 'Admin', + 'location_indonesia' => 'Jakarta, Indonesia', + 'thinking' => 'Thinking...', + 'error_ai' => 'Error connecting to AI assistant.', + 'something_wrong' => 'Sorry, something went wrong.', + 'error_empty_message' => 'Message is empty', +); \ No newline at end of file diff --git a/lang/id.php b/lang/id.php index ae943e8..e9fc0e9 100644 --- a/lang/id.php +++ b/lang/id.php @@ -145,4 +145,62 @@ return array ( '404_title' => 'Halaman Tidak Ditemukan', '404_text' => 'Halaman yang Anda cari mungkin telah dihapus, namanya diubah, atau sementara tidak tersedia.', 'back_to_home' => 'Kembali ke Beranda', -); + 'featured_apps' => 'Aplikasi Unggulan', + 'newsletter_title' => 'Berlangganan Newsletter Kami', + 'newsletter_subtitle' => 'Dapatkan notifikasi tentang APK dan pembaruan terbaru langsung di kotak masuk Anda.', + 'enter_email' => 'Masukkan email Anda', + 'all' => 'Semua', + 'similar_apps' => 'Aplikasi Serupa', + 'support_issues' => 'Dukungan & Masalah', + 'support_text' => 'Menemukan masalah dengan aplikasi ini atau ingin meminta versi terbaru?', + 'report_issue' => 'Laporkan Masalah', + 'request_update' => 'Minta Pembaruan', + 'your_email' => 'Email Anda', + 'message_details' => 'Pesan / Detail', + 'message_placeholder' => 'Mohon jelaskan masalah atau permintaan Anda...', + 'send' => 'Kirim', + 'verified' => 'Terverifikasi', + 'share_text' => 'Cek aplikasi ini di ApkNusa!', + 'error_occurred' => 'Terjadi kesalahan.', + 'sending' => 'Mengirim...', + 'copied' => 'Tersalin!', + 'search_apks' => 'Cari APK', + 'search_go' => 'Cari', + 'popular_categories' => 'Kategori Populer', + 'ai_assistant' => 'AI ApkNusa', + 'ai_greeting' => 'Halo! Ada yang bisa saya bantu hari ini?', + 'type_message' => 'Ketik pesan...', + 'blog' => 'Blog', + 'contact' => 'Kontak', + 'dark_mode' => 'Mode Gelap', + 'light_mode' => 'Mode Terang', + 'language' => 'Bahasa', + 'back' => 'Kembali', + 'get_in_touch' => 'Hubungi Kami', + 'contact_subtitle' => 'Punya pertanyaan atau masukan tentang APK kami? Kami ingin mendengar dari Anda. Kirimkan pesan kepada kami dan kami akan membalas secepat mungkin.', + 'follow_us' => 'Ikuti Kami', + 'full_name' => 'Nama Lengkap', + 'your_name' => 'Nama Anda', + 'email_address' => 'Alamat Email', + 'subject' => 'Subjek', + 'help_how' => 'Ada yang bisa kami bantu?', + 'message' => 'Pesan', + 'your_message_here' => 'Pesan Anda di sini...', + 'send_message' => 'Kirim Pesan', + 'processing' => 'Memproses...', + 'pending' => 'Menunggu', + 'approved' => 'Disetujui', + 'rejected' => 'Ditolak', + 'bank_transfer' => 'Transfer Bank', + 'error_try_again' => 'Terjadi kesalahan. Silakan coba lagi.', + 'blog_title' => 'Blog & Artikel', + 'blog_subtitle' => 'Dapatkan informasi terbaru seputar aplikasi, game, dan tips teknologi di sini.', + 'no_articles' => 'Belum ada artikel yang diterbitkan.', + 'share_article' => 'Bagikan artikel ini:', + 'admin_user' => 'Admin', + 'location_indonesia' => 'Jakarta, Indonesia', + 'thinking' => 'Berpikir...', + 'error_ai' => 'Gagal terhubung ke asisten AI.', + 'something_wrong' => 'Maaf, terjadi kesalahan.', + 'error_empty_message' => 'Pesan kosong', +); \ No newline at end of file diff --git a/views/404.php b/views/404.php index 5ee8c3f..4231c25 100644 --- a/views/404.php +++ b/views/404.php @@ -32,7 +32,7 @@ @@ -43,7 +43,7 @@ - + diff --git a/views/apk_detail.php b/views/apk_detail.php index f0bfb32..15884fb 100644 --- a/views/apk_detail.php +++ b/views/apk_detail.php @@ -113,7 +113,7 @@ ?>

- Similar Apps +

@@ -153,15 +153,15 @@
- Support & Issues +
-

Found a problem with this app or want to request a newer version?

+

- -
@@ -184,7 +184,7 @@ - Download +
@@ -238,7 +238,7 @@ function copyShareLink() { const btn = event.target; const originalText = btn.innerText; - btn.innerText = "Copied!"; + btn.innerText = ""; btn.classList.replace('btn-success', 'btn-dark'); setTimeout(() => { btn.innerText = originalText; @@ -257,7 +257,7 @@ document.getElementById('report-form').addEventListener('submit', function(e) { const alertBox = document.getElementById('report-alert'); btn.disabled = true; - btn.innerHTML = ' Sending...'; + btn.innerHTML = ' '; const formData = new FormData(this); @@ -269,7 +269,7 @@ document.getElementById('report-form').addEventListener('submit', function(e) { .then(res => res.json()) .then(data => { btn.disabled = false; - btn.innerHTML = 'Send'; + btn.innerHTML = ''; if (data.success) { alertBox.innerHTML = '
' + data.success + '
'; setTimeout(() => { @@ -284,8 +284,8 @@ document.getElementById('report-form').addEventListener('submit', function(e) { }) .catch(err => { btn.disabled = false; - btn.innerHTML = 'Send'; - alertBox.innerHTML = '
An error occurred.
'; + btn.innerHTML = ''; + alertBox.innerHTML = '
'; }); }); @@ -309,7 +309,7 @@ document.getElementById('mobile-share-btn').addEventListener('click', function(e if (navigator.share) { navigator.share({ title: '', - text: 'Check out this app on ApkNusa!', + text: '', url: '', }).catch((error) => console.log('Error sharing', error)); } else { @@ -318,4 +318,4 @@ document.getElementById('mobile-share-btn').addEventListener('click', function(e }); - + \ No newline at end of file diff --git a/views/auth/profile.php b/views/auth/profile.php index b51f42f..3298f77 100644 --- a/views/auth/profile.php +++ b/views/auth/profile.php @@ -89,16 +89,26 @@ Rp - + - + @@ -138,7 +148,7 @@ - +
@@ -175,7 +185,7 @@ document.getElementById('withdraw-form').addEventListener('submit', function(e) const noHistoryRow = document.getElementById('no-history-row'); btn.disabled = true; - btn.innerHTML = ' Processing...'; + btn.innerHTML = ' '; const formData = new FormData(form); @@ -205,18 +215,20 @@ document.getElementById('withdraw-form').addEventListener('submit', function(e) alertContainer.innerHTML = '
' + data.success + '
'; // Add to table (simplified, just reload or prepend) - // For now, let's just prepend a row if we can if (noHistoryRow) noHistoryRow.remove(); const now = new Date(); const dateStr = now.toLocaleDateString('id-ID', { day: '2-digit', month: 'short', year: 'numeric' }) + ', ' + now.toLocaleTimeString('id-ID', { hour: '2-digit', minute: '2-digit' }); + let methodText = formData.get('method'); + if (methodText === 'BANK') methodText = ''; + const newRow = ` ${dateStr} Rp ${parseInt(formData.get('amount')).toLocaleString('id-ID')} - ${formData.get('method')} - Pending + ${methodText} + `; tableBody.insertAdjacentHTML('afterbegin', newRow); @@ -228,7 +240,7 @@ document.getElementById('withdraw-form').addEventListener('submit', function(e) .catch(err => { btn.disabled = false; btn.innerHTML = ''; - modalAlert.innerHTML = '
An error occurred. Please try again.
'; + modalAlert.innerHTML = '
'; }); }); diff --git a/views/blog/detail.php b/views/blog/detail.php index da1d4e2..9fc510b 100644 --- a/views/blog/detail.php +++ b/views/blog/detail.php @@ -6,8 +6,8 @@
@@ -16,7 +16,7 @@

- Admin +
@@ -33,7 +33,7 @@
-
Share this article:
+
diff --git a/views/contact.php b/views/contact.php index 51229a5..e920672 100644 --- a/views/contact.php +++ b/views/contact.php @@ -6,12 +6,12 @@
-

Get in Touch

-

Have questions or feedback about our APKs? We'd love to hear from you. Send us a message and we'll respond as soon as possible.

+

+

- Jakarta, Indonesia +
@@ -19,7 +19,7 @@
-
Follow Us
+
@@ -47,24 +47,24 @@
- - + +
- +
- - + +
- - + +
@@ -75,4 +75,4 @@
- + \ No newline at end of file diff --git a/views/footer.php b/views/footer.php index 3108c00..7068dfd 100644 --- a/views/footer.php +++ b/views/footer.php @@ -26,11 +26,11 @@
@@ -86,7 +86,7 @@ - Blog + @@ -112,19 +112,19 @@
-

Search APKs

+

- - + +
-
Popular Categories
+
- ApkNusa AI +
- Hello! How can I help you today? +