36782-vm/includes/lang.php
2025-12-12 14:13:03 +00:00

232 lines
10 KiB
PHP

<?php
if (session_status() == PHP_SESSION_NONE) {
session_start();
}
// Language selection logic
if (isset($_GET['lang'])) {
$_SESSION['lang'] = $_GET['lang'] === 'en' ? 'en' : 'pl';
// Redirect to the same page without the lang parameter
header('Location: ' . strtok($_SERVER["REQUEST_URI"], '?'));
exit;
}
$lang = $_SESSION['lang'] ?? 'pl';
$translations = [
'pl' => [
'menu_catalog' => 'Katalog',
'menu_cart' => 'Koszyk',
'menu_orders' => 'Zamówienia',
'menu_profile' => 'Profil',
'menu_logout' => 'Wyloguj',
'btn_add_to_cart' => 'Dodaj do koszyka',
'btn_go_to_cart' => 'Przejdź do koszyka',
'btn_checkout' => 'Przejdź do zamówienia',
'btn_back_to_shop' => 'Wróć do sklepu',
'label_quantity' => 'Ilość',
'label_price' => 'Cena',
'label_total' => 'Razem',
'label_product' => 'Produkt',
'title_cart' => 'Koszyk',
'title_orders' => 'Twoje zamówienia',
'title_order_details' => 'Szczegóły zamówienia',
'title_checkout' => 'Podsumowanie zamówienia',
'title_profile' => 'Profil użytkownika',
'footer_powered_by' => 'powered by LEA24',
'cart_empty' => 'Twój koszyk jest pusty.',
'product' => 'Produkt',
'remove' => 'Usuń',
'subtotal' => 'Suma częściowa',
'continue_shopping' => 'Kontynuuj zakupy',
'order_summary' => 'Podsumowanie',
'order_date' => 'Data zamówienia',
'order_status' => 'Status',
'order_total' => 'Suma',
'order_action' => 'Akcja',
'order_view' => 'Zobacz',
'order_id' => 'ID Zamówienia',
'order_number' => 'Numer zamówienia',
'order_confirmation' => 'Potwierdzenie zamówienia',
'order_thank_you' => 'Dziękujemy za złożenie zamówienia.',
'order_number_is' => 'Numer Twojego zamówienia to',
'first_name' => 'Imię',
'last_name' => 'Nazwisko',
'email' => 'Email',
'current_password' => 'Aktualne hasło',
'new_password' => 'Nowe hasło',
'confirm_new_password' => 'Potwierdź nowe hasło',
'update_profile' => 'Zaktualizuj profil',
'password_note' => 'Pozostaw puste, jeśli nie chcesz zmieniać hasła.',
'profile_updated' => 'Profil zaktualizowany pomyślnie.',
'password_updated' => 'Hasło zaktualizowane pomyślnie.',
'password_mismatch' => 'Nowe hasła nie są zgodne.',
'incorrect_password' => 'Nieprawidłowe aktualne hasło.',
'app_title' => 'B2B Commerce',
'btn_update' => 'Zaktualizuj',
'btn_remove' => 'Usuń',
'label_unit_price' => 'Cena jednostkowa',
'label_subtotal' => 'Suma częściowa',
'confirm_order' => 'Potwierdź zamówienie',
'delivery_payment_options' => 'Opcje dostawy i płatności',
'delivery_source' => 'Źródło dostawy',
'central_warehouse' => 'Magazyn Centralny',
'external_supplier' => 'Dostawca zewnętrzny',
'available_trade_credit' => 'Dostępny limit kredytu kupieckiego',
'order_notes' => 'Uwagi do zamówienia',
'order_history' => 'Historia zamówień',
'error_client_id_not_found' => 'Nie znaleziono identyfikatora klienta. Zaloguj się ponownie.',
'error_fetching_orders' => 'Wystąpił błąd podczas pobierania zamówień. Prosimy spróbować ponownie później.',
'no_orders_yet' => 'Nie masz jeszcze żadnych zamówień.',
'btn_view_details' => 'Szczegóły',
'error_no_permission' => 'Brak uprawnień do wyświetlenia tego zamówienia.',
'error_order_not_found' => 'Nie znaleziono zamówienia lub nie masz do niego dostępu.',
'error_database' => 'Błąd bazy danych. Prosimy spróbować ponownie później.',
'label_payment_method' => 'Metoda płatności',
'label_notes' => 'Uwagi',
'label_image' => 'Zdjęcie',
'label_no_image' => 'Brak zdjęcia',
'btn_back_to_orders' => 'Wróć do listy zamówień',
'order_details_for' => 'Szczegóły zamówienia',
'error_loading_profile' => 'Wystąpił błąd podczas ładowania danych profilu. Prosimy spróbować ponownie później.',
'profile_meta_description' => 'Zarządzaj swoim profilem w platformie B2B Commerce.',
'toggle_navigation' => 'Przełącz nawigację',
'label_email' => 'Adres e-mail',
'label_client' => 'Klient',
'password_management' => 'Zarządzanie hasłem',
'feature_in_preparation' => 'Funkcja w przygotowaniu.',
'track_status_in' => 'Możesz śledzić jego status w panelu',
'my_orders' => 'Moje zamówienia',
'header_account' => 'Konto',
// Standardized Statuses
'status_pending' => 'Oczekujące',
'status_pending_payment' => 'Oczekuje na płatność',
'status_paid' => 'Zapłacone',
'status_in_progress' => 'W realizacji',
'status_shipped' => 'Wysłane',
'status_partially_shipped' => 'Częściowo wysłane',
'status_completed' => 'Zrealizowane',
'status_cancelled' => 'Anulowane',
// Standardized Payment Methods
'payment_method' => 'Metoda płatności',
'payment_bank_transfer' => 'Przelew tradycyjny',
'payment_online' => 'Płatność online (Przelewy24)',
'payment_credit' => 'Kredyt kupiecki',
'header_welcome' => 'Witaj',
'footer_text' => 'powered by LEA24',
],
'en' => [
'menu_catalog' => 'Catalog',
'menu_cart' => 'Cart',
'menu_orders' => 'Orders',
'menu_profile' => 'Profile',
'menu_logout' => 'Logout',
'btn_add_to_cart' => 'Add to cart',
'btn_go_to_cart' => 'Go to cart',
'btn_checkout' => 'Proceed to checkout',
'btn_back_to_shop' => 'Back to shop',
'label_quantity' => 'Quantity',
'label_price' => 'Price',
'label_total' => 'Total',
'label_product' => 'Product',
'title_cart' => 'Shopping Cart',
'title_orders' => 'Your Orders',
'title_order_details' => 'Order Details',
'title_checkout' => 'Checkout',
'title_profile' => 'User Profile',
'footer_powered_by' => 'powered by LEA24',
'cart_empty' => 'Your cart is empty.',
'product' => 'Product',
'remove' => 'Remove',
'subtotal' => 'Subtotal',
'continue_shopping' => 'Continue shopping',
'order_summary' => 'Order Summary',
'order_date' => 'Order Date',
'order_status' => 'Status',
'order_total' => 'Total',
'order_action' => 'Action',
'order_view' => 'View',
'order_id' => 'Order ID',
'order_number' => 'Order Number',
'order_confirmation' => 'Order Confirmation',
'order_thank_you' => 'Thank you for your order.',
'order_number_is' => 'Your order number is',
'first_name' => 'First Name',
'last_name' => 'Last Name',
'email' => 'Email',
'current_password' => 'Current Password',
'new_password' => 'New Password',
'confirm_new_password' => 'Confirm New Password',
'update_profile' => 'Update Profile',
'password_note' => 'Leave blank if you don\'t want to change the password.',
'profile_updated' => 'Profile updated successfully.',
'password_updated' => 'Password updated successfully.',
'password_mismatch' => 'New passwords do not match.',
'incorrect_password' => 'Incorrect current password.',
'app_title' => 'B2B Commerce',
'btn_update' => 'Update',
'btn_remove' => 'Remove',
'label_unit_price' => 'Unit price',
'label_subtotal' => 'Subtotal',
'confirm_order' => 'Confirm order',
'delivery_payment_options' => 'Delivery and payment options',
'delivery_source' => 'Delivery source',
'central_warehouse' => 'Central Warehouse',
'external_supplier' => 'External Supplier',
'available_trade_credit' => 'Available trade credit',
'order_notes' => 'Order notes',
'order_history' => 'Order History',
'error_client_id_not_found' => 'Client ID not found. Please log in again.',
'error_fetching_orders' => 'An error occurred while fetching orders. Please try again later.',
'no_orders_yet' => 'You have no orders yet.',
'btn_view_details' => 'Details',
'error_no_permission' => 'You do not have permission to view this order.',
'error_order_not_found' => 'Order not found or you do not have access to it.',
'error_database' => 'Database error. Please try again later.',
'label_payment_method' => 'Payment Method',
'label_notes' => 'Notes',
'label_image' => 'Image',
'label_no_image' => 'No image',
'btn_back_to_orders' => 'Back to orders',
'order_details_for' => 'Order Details',
'error_loading_profile' => 'An error occurred while loading profile data. Please try again later.',
'profile_meta_description' => 'Manage your profile on the B2B Commerce platform.',
'toggle_navigation' => 'Toggle navigation',
'label_email' => 'Email address',
'label_client' => 'Client',
'password_management' => 'Password Management',
'feature_in_preparation' => 'Feature in preparation.',
'track_status_in' => 'You can track its status in the',
'my_orders' => 'My Orders',
'header_account' => 'Account',
// Standardized Statuses
'status_pending' => 'Pending',
'status_pending_payment' => 'Pending payment',
'status_paid' => 'Paid',
'status_in_progress' => 'In progress',
'status_shipped' => 'Shipped',
'status_partially_shipped' => 'Partially shipped',
'status_completed' => 'Completed',
'status_cancelled' => 'Cancelled',
// Standardized Payment Methods
'payment_method' => 'Payment method',
'payment_bank_transfer' => 'Bank transfer',
'payment_online' => 'Online payment (Przelewy24)',
'payment_credit' => 'Trade credit',
'header_welcome' => 'Welcome',
'footer_text' => 'powered by LEA24',
]
];
if (!function_exists('t')) {
function t($key) {
global $translations, $lang;
return $translations[$lang][$key] ?? $key;
}
}
function getCurrentLanguage() {
global $lang;
return $lang;
}
?>