diff --git a/assets/css/main.css b/assets/css/main.css
index 5c81af5..433c3a9 100644
--- a/assets/css/main.css
+++ b/assets/css/main.css
@@ -349,3 +349,62 @@ color: white;
text-decoration: none;
color: inherit;
}
+
+/* Language Switcher */
+.lang-switcher {
+ margin-right: 1rem;
+}
+
+.lang-switcher a {
+ color: #6c757d;
+ text-decoration: none;
+ font-weight: 500;
+}
+
+.lang-switcher a.active {
+ color: #0d6efd;
+ font-weight: 700;
+}
+
+/* RTL Support */
+[dir="rtl"] {
+ text-align: right;
+}
+
+[dir="rtl"] .header {
+ flex-direction: row-reverse;
+}
+
+[dir="rtl"] .nav-buttons .btn {
+ margin-left: 0;
+ margin-right: 1rem;
+}
+
+[dir="rtl"] .lang-switcher {
+ margin-right: 0;
+ margin-left: 1rem;
+}
+
+[dir="rtl"] .task-meta {
+ flex-direction: row-reverse;
+}
+
+[dir="rtl"] .search-form {
+ flex-direction: row-reverse;
+}
+
+[dir="rtl"] .form-group label {
+ text-align: right;
+}
+
+[dir="rtl"] .task-manage-card {
+ flex-direction: row-reverse;
+}
+
+[dir="rtl"] .task-actions {
+ flex-direction: row-reverse;
+}
+
+[dir="rtl"] .applicant-card {
+ flex-direction: row-reverse;
+}
diff --git a/index.php b/index.php
index 08c1d1d..fb9fec0 100644
--- a/index.php
+++ b/index.php
@@ -138,42 +138,42 @@ try {
-
-
No tasks found matching your criteria. Try broadening your search!
-
-
-
'سوق قائم على المهام',
+ 'home' => 'الرئيسية',
+ 'post_task' => 'انشر مهمة',
+ 'manage_tasks' => 'إدارة مهامك',
+ 'my_applications' => 'طلباتي',
+ 'my_profile' => 'ملفي الشخصي',
+ 'logout' => 'تسجيل الخروج',
+ 'login' => 'تسجيل الدخول',
+ 'signup' => 'إنشاء حساب',
+ 'search_tasks' => 'ابحث عن مهام...',
+ 'search' => 'بحث',
+ 'task_title' => 'العنوان',
+ 'task_description' => 'الوصف',
+ 'task_budget' => 'الميزانية',
+ 'posted_by' => 'نشر بواسطة',
+ 'apply' => 'قدم الآن',
+ 'task_details' => 'تفاصيل المهمة',
+ 'all_tasks' => 'كل المهام',
+ 'delete' => 'حذف',
+ 'whatsapp_number' => 'رقم الواتساب',
+ 'submit_application' => 'إرسال الطلب',
+ 'application_submitted' => 'تم إرسال الطلب',
+ 'accept' => 'قبول',
+ 'accepted' => 'مقبول',
+ 'rejected' => 'مرفوض',
+ 'pending' => 'قيد الانتظار',
+ 'view_details' => 'عرض التفاصيل',
+ 'no_tasks' => 'لم يتم العثور على مهام.',
+ 'no_applications' => 'لم يتقدم أحد لهذه المهمة بعد.',
+ 'no_tasks_posted' => 'لم تقم بنشر أي مهام بعد.',
+ 'no_applications_submitted' => 'لم تتقدم لأي مهام بعد.',
+ 'english' => 'English',
+ 'arabic' => 'العربية',
+ 'hero_title' => 'أنجز أي شيء، اليوم.',
+ 'hero_subtitle' => 'أفضل مكان للعثور على مساعدة سريعة لمهامك اليومية.',
+ 'available_tasks' => 'المهام المتاحة',
+ 'search_keywords' => 'كلمات مفتاحية...',
+ 'search_category' => 'فئة...',
+ 'search_location' => 'موقع...',
+ 'no_tasks_found_criteria' => 'لم يتم العثور على مهام تطابق معايير البحث. حاول توسيع نطاق البحث!',
+ 'login_title' => 'تسجيل الدخول',
+ 'email_label' => 'البريد الإلكتروني',
+ 'password_label' => 'كلمة المرور',
+ 'login_button' => 'تسجيل الدخول',
+ 'no_account_prompt' => 'ليس لديك حساب؟',
+ 'signup_link' => 'إنشاء حساب',
+ 'error_all_fields' => 'يرجى ملء جميع الحقول.',
+ 'error_invalid_credentials' => 'البريد الإلكتروني أو كلمة المرور غير صالحة.',
+ 'signup_title' => 'إنشاء حساب',
+ 'full_name_label' => 'الاسم الكامل',
+ 'email_address_label' => 'عنوان البريد الإلكتروني',
+ 'phone_number_label' => 'رقم الهاتف',
+ 'confirm_password_label' => 'تأكيد كلمة المرور',
+ 'signup_button' => 'إنشاء حساب',
+ 'error_full_name_required' => 'الاسم الكامل مطلوب.',
+ 'error_email_required' => 'البريد الإلكتروني مطلوب.',
+ 'error_invalid_email' => 'صيغة البريد الإلكتروني غير صالحة.',
+ 'error_phone_required' => 'رقم الهاتف مطلوب.',
+ 'error_password_required' => 'كلمة المرور مطلوبة.',
+ 'error_passwords_no_match' => 'كلمات المرور غير متطابقة.',
+ 'error_email_exists' => 'مستخدم بهذا البريد الإلكتروني موجود بالفعل.',
+ 'error_database' => 'خطأ في قاعدة البيانات. يرجى المحاولة مرة أخرى في وقت لاحق.',
+ 'profile_title' => 'ملف %s الشخصي',
+ 'member_since' => 'عضو منذ: %s',
+ 'whatsapp_updated_success' => 'تم تحديث رقم الواتساب الخاص بك بنجاح.',
+ 'whatsapp_update_failed' => 'فشل تحديث رقم الواتساب.',
+ 'my_contact_info' => 'معلومات الاتصال الخاصة بي',
+ 'whatsapp_number_label' => 'رقم الواتساب',
+ 'whatsapp_placeholder' => 'أدخل رقم الواتساب الخاص بك...',
+ 'whatsapp_help_text' => 'سيتم مشاركة هذا فقط مع المستخدمين الذين تقبل طلباتهم.',
+ 'save_button' => 'حفظ',
+ 'posted_tasks' => 'المهام المنشورة',
+ 'no_posted_tasks' => 'لم يقم %s بنشر أي مهام بعد.',
+ 'completed_tasks' => 'المهام المكتملة',
+ 'no_completed_tasks' => 'لم يكمل %s أي مهام بعد.',
+ 'task_status' => 'الحالة',
+ 'task_payout' => 'المكافأة',
+ 'post_new_task_title' => 'انشر مهمة جديدة',
+ 'task_title_label' => 'عنوان المهمة',
+ 'description_label' => 'الوصف',
+ 'category_label' => 'الفئة',
+ 'location_label' => 'الموقع',
+ 'payout_label' => 'المكافأة',
+ 'post_task_button' => 'انشر المهمة',
+ 'error_task_required_fields' => 'العنوان والوصف والمكافأة حقول مطلوبة.',
+ 'manage_tasks_title' => 'إدارة مهامك',
+ 'manage_tasks_description' => 'هذه هي المهام التي قمت بنشرها. انقر على مهمة لعرض وإدارة الطلبات.',
+ 'no_posted_tasks_link' => 'لم تقم بنشر أي مهام بعد.
انشر واحدة الآن!',
+ 'task_status_label' => 'الحالة',
+ 'delete_task_confirm' => 'هل أنت متأكد أنك تريد حذف هذه المهمة؟',
+ 'my_applications_title' => 'طلباتي',
+ 'my_applications_description' => 'هذه هي المهام التي تقدمت إليها وحالتها الحالية.',
+ 'no_applications_yet' => 'لم تتقدم لأي مهام بعد.',
+ 'posted_by_label' => 'نشر بواسطة',
+ 'task_details_title' => 'تفاصيل المهمة',
+ 'budget_label' => 'الميزانية',
+ 'posted_on_label' => 'نشر في',
+ 'applicants_title' => 'المتقدمون',
+ 'add_whatsapp_prompt' => 'يرجى
إضافة رقم WhatsApp الخاص بك إلى ملفك الشخصي قبل قبول الطلبات.',
+ 'no_applicants_yet' => 'لا يوجد متقدمون بعد.',
+ 'accept_button' => 'قبول',
+ 'my_application_title' => 'طلبي',
+ 'application_accepted_message' => 'تهانينا! تم قبول طلبك.',
+ 'contact_owner_whatsapp' => 'تواصل مع صاحب المهمة على WhatsApp:
%s',
+ 'application_status_label' => 'حالة طلبك هي',
+ 'apply_now_button' => 'قدم الآن',
+ 'manage_task_title' => 'إدارة المهمة',
+ 'reject_button' => 'رفض',
+ 'back_to_my_tasks' => 'العودة إلى كل مهامي',
+ 'application_rejected_message' => 'تم رفض الطلب.',
+ 'applicant_awarded' => 'تم منح هذا المتقدم المهمة.',
+];
diff --git a/lang/en.php b/lang/en.php
new file mode 100644
index 0000000..631f021
--- /dev/null
+++ b/lang/en.php
@@ -0,0 +1,114 @@
+ 'Task-Based Marketplace',
+ 'home' => 'Home',
+ 'post_task' => 'Post a Task',
+ 'manage_tasks' => 'Manage Your Tasks',
+ 'my_applications' => 'My Applications',
+ 'my_profile' => 'My Profile',
+ 'logout' => 'Logout',
+ 'login' => 'Login',
+ 'signup' => 'Sign Up',
+ 'search_tasks' => 'Search for tasks...',
+ 'search' => 'Search',
+ 'task_title' => 'Title',
+ 'task_description' => 'Description',
+ 'task_budget' => 'Budget',
+ 'posted_by' => 'Posted by',
+ 'apply' => 'Apply',
+ 'task_details' => 'Task Details',
+ 'all_tasks' => 'All Tasks',
+ 'delete' => 'Delete',
+ 'whatsapp_number' => 'WhatsApp Number',
+ 'submit_application' => 'Submit Application',
+ 'application_submitted' => 'Application Submitted',
+ 'accept' => 'Accept',
+ 'accepted' => 'Accepted',
+ 'rejected' => 'Rejected',
+ 'pending' => 'Pending',
+ 'view_details' => 'View Details',
+ 'no_tasks' => 'No tasks found.',
+ 'no_applications' => 'No one has applied to this task yet.',
+ 'no_tasks_posted' => 'You have not posted any tasks yet.',
+ 'no_applications_submitted' => 'You have not applied to any tasks yet.',
+ 'english' => 'English',
+ 'arabic' => 'Arabic',
+ 'hero_title' => 'Get anything done, today.',
+ 'hero_subtitle' => 'The best place to find quick help for your daily tasks.',
+ 'available_tasks' => 'Available Tasks',
+ 'search_keywords' => 'Keywords...',
+ 'search_category' => 'Category...',
+ 'search_location' => 'Location...',
+ 'no_tasks_found_criteria' => 'No tasks found matching your criteria. Try broadening your search!',
+ 'login_title' => 'Login',
+ 'email_label' => 'Email',
+ 'password_label' => 'Password',
+ 'login_button' => 'Login',
+ 'no_account_prompt' => "Don't have an account?",
+ 'signup_link' => 'Sign up',
+ 'error_all_fields' => 'Please fill in all fields.',
+ 'error_invalid_credentials' => 'Invalid email or password.',
+ 'signup_title' => 'Create an Account',
+ 'full_name_label' => 'Full Name',
+ 'email_address_label' => 'Email Address',
+ 'phone_number_label' => 'Phone Number',
+ 'confirm_password_label' => 'Confirm Password',
+ 'signup_button' => 'Sign Up',
+ 'error_full_name_required' => 'Full name is required.',
+ 'error_email_required' => 'Email is required.',
+ 'error_invalid_email' => 'Invalid email format.',
+ 'error_phone_required' => 'Phone number is required.',
+ 'error_password_required' => 'Password is required.',
+ 'error_passwords_no_match' => 'Passwords do not match.',
+ 'error_email_exists' => 'A user with this email already exists.',
+ 'error_database' => 'Database error. Please try again later.',
+ 'profile_title' => "%s's Profile",
+ 'member_since' => 'Member Since: %s',
+ 'whatsapp_updated_success' => 'Your WhatsApp number has been updated successfully.',
+ 'whatsapp_update_failed' => 'Failed to update WhatsApp number.',
+ 'my_contact_info' => 'My Contact Information',
+ 'whatsapp_number_label' => 'WhatsApp Number',
+ 'whatsapp_placeholder' => 'Enter your WhatsApp number...',
+ 'whatsapp_help_text' => 'This will only be shared with users whose applications you accept.',
+ 'save_button' => 'Save',
+ 'posted_tasks' => 'Posted Tasks',
+ 'no_posted_tasks' => '%s has not posted any tasks yet.',
+ 'completed_tasks' => 'Completed Tasks',
+ 'no_completed_tasks' => '%s has not completed any tasks yet.',
+ 'task_status' => 'Status',
+ 'task_payout' => 'Payout',
+ 'post_new_task_title' => 'Post a New Task',
+ 'task_title_label' => 'Task Title',
+ 'description_label' => 'Description',
+ 'category_label' => 'Category',
+ 'location_label' => 'Location',
+ 'payout_label' => 'Payout',
+ 'post_task_button' => 'Post Task',
+ 'error_task_required_fields' => 'Title, description, and payout are required.',
+ 'manage_tasks_title' => 'Manage Your Tasks',
+ 'manage_tasks_description' => "Here are the tasks you've posted. Click on a task to view and manage applications.",
+ 'no_posted_tasks_link' => 'You have not posted any tasks yet.
Post one now!',
+ 'task_status_label' => 'Status',
+ 'delete_task_confirm' => 'Are you sure you want to delete this task?',
+ 'my_applications_title' => 'My Applications',
+ 'my_applications_description' => "Here are the tasks you've applied for and their current status.",
+ 'no_applications_yet' => 'You have not applied for any tasks yet.',
+ 'posted_by_label' => 'Posted by',
+ 'task_details_title' => 'Task Details',
+ 'budget_label' => 'Budget',
+ 'posted_on_label' => 'Posted on',
+ 'applicants_title' => 'Applicants',
+ 'add_whatsapp_prompt' => 'Please
add your WhatsApp number to your profile before accepting applications.',
+ 'no_applicants_yet' => 'No applications yet.',
+ 'accept_button' => 'Accept',
+ 'my_application_title' => 'My Application',
+ 'application_accepted_message' => 'Congratulations! Your application was accepted.',
+ 'contact_owner_whatsapp' => 'Contact the task owner on WhatsApp:
%s',
+ 'application_status_label' => 'Your application status is',
+ 'apply_now_button' => 'Apply Now',
+ 'manage_task_title' => 'Manage Task',
+ 'reject_button' => 'Reject',
+ 'back_to_my_tasks' => 'Back to All My Tasks',
+ 'application_rejected_message' => 'Application rejected.',
+ 'applicant_awarded' => 'This applicant was awarded the task.',
+];
diff --git a/login.php b/login.php
index 5085fd5..aa39796 100644
--- a/login.php
+++ b/login.php
@@ -1,5 +1,4 @@
getMessage();
@@ -35,22 +34,22 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
diff --git a/manage-tasks.php b/manage-tasks.php
index 492cea5..98aeef6 100644
--- a/manage-tasks.php
+++ b/manage-tasks.php
@@ -24,18 +24,18 @@ try {
die("Database error: Could not retrieve your tasks.");
}
-$pageTitle = "Manage Your Tasks";
+$pageTitle = __('manage_tasks_title');
include 'shared/header.php';
?>
-
+
= __('no_posted_tasks_link') ?>
@@ -45,10 +45,10 @@ include 'shared/header.php';
...
- Status:
+ = __('task_status_label') ?>:
diff --git a/my-applications.php b/my-applications.php
index 0dd3620..e92b2e3 100644
--- a/my-applications.php
+++ b/my-applications.php
@@ -12,7 +12,7 @@ $userId = $_SESSION['user_id'];
try {
$pdo = db();
$stmt = $pdo->prepare(
- 'SELECT t.title, t.description, a.status, u.username AS poster_username
+ 'SELECT t.title, t.description, a.status, u.full_name AS poster_username
FROM applications a
JOIN tasks t ON a.task_id = t.id
JOIN users u ON t.user_id = u.id
@@ -27,27 +27,27 @@ try {
die("Database error: Could not retrieve your applications.");
}
-$pageTitle = "My Applications";
+$pageTitle = __('my_applications_title');
include 'shared/header.php';
?>
-
You have not applied for any tasks yet.
+
= __('no_applications_yet') ?>
-
Posted by:
+
= __('posted_by_label') ?>:
- Status:
+ = __('task_status_label') ?>:
diff --git a/post-task.php b/post-task.php
index 9b3416b..4ae33b8 100644
--- a/post-task.php
+++ b/post-task.php
@@ -18,7 +18,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$user_id = $_SESSION['user_id'];
if (empty($title) || empty($description) || empty($payout)) {
- $error = 'Title, description, and payout are required.';
+ $error = 'error_task_required_fields';
} else {
try {
$stmt = db()->prepare("INSERT INTO tasks (user_id, title, description, category, location, payout) VALUES (?, ?, ?, ?, ?, ?)");
@@ -33,29 +33,32 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
?>
-
Post a New Task
+
= __('post_new_task_title') ?>
diff --git a/profile.php b/profile.php
index c87fe75..0808095 100644
--- a/profile.php
+++ b/profile.php
@@ -20,7 +20,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_SESSION['user_id']) && $_SE
header("Location: profile.php?id=$profileId&message=whatsapp_updated");
exit();
} catch (PDOException $e) {
- $update_error = "Failed to update WhatsApp number.";
+ $update_error = "whatsapp_update_failed";
}
}
@@ -60,35 +60,35 @@ try {
die("Database error: Could not retrieve completed tasks.");
}
-$pageTitle = htmlspecialchars($profileUser['full_name']) . "'s Profile";
+$pageTitle = sprintf(__('profile_title'), htmlspecialchars($profileUser['full_name']));
include 'shared/header.php';
?>
-
Your WhatsApp number has been updated successfully.
+
= __('whatsapp_updated_success') ?>
-
= htmlspecialchars($update_error) ?>
+
= htmlspecialchars(__($update_error)) ?>
@@ -96,9 +96,9 @@ include 'shared/header.php';
-
Posted Tasks
+
= __('posted_tasks') ?>
-
has not posted any tasks yet.
+
= sprintf(__('no_posted_tasks'), htmlspecialchars($profileUser['full_name'])) ?>
-
Status:
-
Payout: $
+
= __('task_status') ?>:
+
= __('task_payout') ?>: $
@@ -116,9 +116,9 @@ include 'shared/header.php';
-
Completed Tasks
+
= __('completed_tasks') ?>
-
has not completed any tasks yet.
+
= sprintf(__('no_completed_tasks'), htmlspecialchars($profileUser['full_name'])) ?>
-
Status:
-
Payout: $
+
= __('task_status') ?>:
+
= __('task_payout') ?>: $
diff --git a/shared/header.php b/shared/header.php
index 782b489..eafbc5c 100644
--- a/shared/header.php
+++ b/shared/header.php
@@ -1,19 +1,20 @@
-
+
-
= htmlspecialchars($pageTitle ?? 'CashTask') ?>
+
= htmlspecialchars($pageTitle ?? __('app_title')) ?>
@@ -37,18 +38,22 @@ $projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? '';
diff --git a/shared/i18n.php b/shared/i18n.php
new file mode 100644
index 0000000..4f8187b
--- /dev/null
+++ b/shared/i18n.php
@@ -0,0 +1,41 @@
+fetch();
if ($existing_user) {
- $errors[] = 'A user with this email already exists.';
+ $errors[] = 'error_email_exists';
} else {
$hashed_password = password_hash($password, PASSWORD_DEFAULT);
@@ -56,50 +56,48 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
exit;
}
} catch (PDOException $e) {
- // In a real app, you would log this error, not show it to the user.
- $errors[] = "Database error. Please try again later.";
+ $errors[] = "error_database";
}
}
}
-$pageTitle = 'Sign Up';
-require_once __DIR__ . '/shared/header.php';
+$pageTitle = __('signup_title');
?>
diff --git a/task-details.php b/task-details.php
index 23154ca..39260aa 100644
--- a/task-details.php
+++ b/task-details.php
@@ -38,7 +38,7 @@ if (isset($_SESSION['user_id']) && !$is_owner) {
$user_application = $stmt->fetch(PDO::FETCH_ASSOC);
}
-$pageTitle = htmlspecialchars($task['title']);
+$pageTitle = __('task_details_title');
require_once 'shared/header.php';
?>
@@ -48,28 +48,28 @@ require_once 'shared/header.php';
-
Posted by:
-
Budget: $
+
= __('posted_by_label') ?>:
+
= __('budget_label') ?>: $
-
+
= __('add_whatsapp_prompt') ?>
-
No applications yet.
+
= __('no_applicants_yet') ?>
@@ -79,7 +79,7 @@ require_once 'shared/header.php';
= htmlspecialchars($application['status']) ?>
-
Accept
+
= __('accept_button') ?>
@@ -90,22 +90,22 @@ require_once 'shared/header.php';
-
Congratulations! Your application was accepted.
-
Contact the task owner on WhatsApp: = htmlspecialchars($task['whatsapp_number']) ?>
+
= __('application_accepted_message') ?>
+
= sprintf(__('contact_owner_whatsapp'), htmlspecialchars($task['whatsapp_number'])) ?>
-
Your application status is: = htmlspecialchars($user_application['status']) ?>
+
= __('application_status_label') ?>: = htmlspecialchars($user_application['status']) ?>
@@ -115,4 +115,4 @@ require_once 'shared/header.php';
\ No newline at end of file
+?>