update arabic messages

This commit is contained in:
Flatlogic Bot 2026-03-24 07:06:29 +00:00
parent bcfce1b10b
commit 16cb6e8b9f
3 changed files with 63 additions and 13 deletions

View File

@ -0,0 +1,26 @@
<?php
require_once __DIR__ . '/../config.php';
try {
$pdo = db();
echo "Modifying truck_owner_profiles table...\n";
$queries = [
"ALTER TABLE truck_owner_profiles MODIFY COLUMN truck_type VARCHAR(120) NULL",
"ALTER TABLE truck_owner_profiles MODIFY COLUMN load_capacity DECIMAL(10,2) NULL",
"ALTER TABLE truck_owner_profiles MODIFY COLUMN plate_no VARCHAR(80) NULL",
"ALTER TABLE truck_owner_profiles MODIFY COLUMN truck_pic_path VARCHAR(255) NULL",
"ALTER TABLE truck_owner_profiles MODIFY COLUMN registration_path TEXT NULL"
];
foreach ($queries as $sql) {
$pdo->exec($sql);
echo "Executed: $sql\n";
}
echo "Migration completed successfully.\n";
} catch (PDOException $e) {
echo "Migration failed: " . $e->getMessage() . "\n";
exit(1);
}

View File

@ -367,6 +367,18 @@ $translations = [
'terms_placeholder_ar' => 'Enter Terms of Service in Arabic...',
'privacy_placeholder_en' => 'Enter Privacy Policy in English...',
'privacy_placeholder_ar' => 'Enter Privacy Policy in Arabic...',
'error_fullname_required' => 'Full name is required.',
'error_email_invalid' => 'Please provide a valid email address.',
'error_phone_required' => 'Phone number is required.',
'error_location_required' => 'Please select country and city.',
'error_city_mismatch' => 'Selected city does not belong to selected country.',
'error_address_required' => 'Address is required.',
'error_password_length' => 'Password must be at least 6 characters.',
'error_company_required' => 'Company name is required for shipper registration.',
'error_ctr_required' => 'CTR document is required for companies.',
'error_id_required' => 'Please upload ID front and back.',
'error_email_exists' => 'This email is already registered.',
'error_registration_failed' => 'Registration failed. Please try again.',
),
'ar' => array (
'app_name' => 'كارغو لينك',
@ -722,6 +734,18 @@ $translations = [
'terms_placeholder_ar' => 'أدخل شروط الخدمة بالعربية...',
'privacy_placeholder_en' => 'أدخل سياسة الخصوصية بالإنجليزية...',
'privacy_placeholder_ar' => 'أدخل سياسة الخصوصية بالعربية...',
'error_fullname_required' => 'الاسم الكامل مطلوب.',
'error_email_invalid' => 'يرجى تقديم عنوان بريد إلكتروني صالح.',
'error_phone_required' => 'رقم الهاتف مطلوب.',
'error_location_required' => 'يرجى اختيار البلد والمدينة.',
'error_city_mismatch' => 'المدينة المختارة لا تنتمي للبلد المختار.',
'error_address_required' => 'العنوان مطلوب.',
'error_password_length' => 'يجب أن تكون كلمة المرور 6 أحرف على الأقل.',
'error_company_required' => 'اسم الشركة مطلوب لتسجيل الشاحن.',
'error_ctr_required' => 'وثيقة السجل التجاري مطلوبة للشركات.',
'error_id_required' => 'يرجى رفع صورة البطاقة الشخصية (أمام وخلف).',
'error_email_exists' => 'هذا البريد الإلكتروني مسجل بالفعل.',
'error_registration_failed' => 'فشل التسجيل. يرجى المحاولة مرة أخرى.',
)
];
@ -985,4 +1009,4 @@ try {
if ($tz && in_array($tz, DateTimeZone::listIdentifiers())) {
date_default_timezone_set($tz);
}
} catch (Throwable $e) {}
} catch (Throwable $e) {}

View File

@ -57,31 +57,31 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { validate_csrf_token();
];
if ($fullName === '') {
$errors[] = 'Full name is required.';
$errors[] = t('error_fullname_required');
}
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
$errors[] = 'Please provide a valid email address.';
$errors[] = t('error_email_invalid');
}
if ($phone === '') {
$errors[] = 'Phone number is required.';
$errors[] = t('error_phone_required');
}
if ($countryId <= 0 || $cityId <= 0) {
$errors[] = 'Please select country and city.';
$errors[] = t('error_location_required');
} else {
$cityCheck = db()->prepare("SELECT COUNT(*) FROM cities WHERE id = ? AND country_id = ?");
$cityCheck->execute([$cityId, $countryId]);
if ((int)$cityCheck->fetchColumn() === 0) {
$errors[] = 'Selected city does not belong to selected country.';
$errors[] = t('error_city_mismatch');
}
}
if ($addressLine === '') {
$errors[] = 'Address is required.';
$errors[] = t('error_address_required');
}
if (strlen($passwordRaw) < 6) {
$errors[] = 'Password must be at least 6 characters.';
$errors[] = t('error_password_length');
}
if ($role === 'shipper' && $companyName === '') {
$errors[] = 'Company name is required for shipper registration.';
$errors[] = t('error_company_required');
}
if (!$errors) {
@ -133,7 +133,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { validate_csrf_token();
if (is_uploaded_file($_FILES['ctr_document']['tmp_name'] ?? '')) {
$ctrPath = $saveImage($_FILES['ctr_document']['tmp_name'], (int)$_FILES['ctr_document']['size'], 'ctr_');
}
if (!$ctrPath) $errors[] = 'CTR document is required for companies.';
if (!$ctrPath) $errors[] = t('error_ctr_required');
} else {
if (is_uploaded_file($_FILES['id_card_front']['tmp_name'] ?? '')) {
$path = $saveImage($_FILES['id_card_front']['tmp_name'], (int)$_FILES['id_card_front']['size'], 'id_front_');
@ -143,7 +143,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { validate_csrf_token();
$path = $saveImage($_FILES['id_card_back']['tmp_name'], (int)$_FILES['id_card_back']['size'], 'id_back_');
if ($path) $idCardPaths[] = $path;
}
if (count($idCardPaths) < 2) $errors[] = 'Please upload ID front and back.';
if (count($idCardPaths) < 2) $errors[] = t('error_id_required');
}
if (!$errors) {
@ -195,9 +195,9 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { validate_csrf_token();
$pdo->rollBack();
}
if (stripos($e->getMessage(), 'Duplicate entry') !== false) {
$errors[] = 'This email is already registered.';
$errors[] = t('error_email_exists');
} else {
$errors[] = 'Registration failed. Please try again.';
$errors[] = t('error_registration_failed');
}
}
}