36782-vm/includes/i18n.php
Flatlogic Bot 11f95cfd4b ENG v.1
2025-12-12 19:32:49 +00:00

278 lines
12 KiB
PHP

<?php
$supported_languages = ['pl', 'en'];
$default_language = 'pl';
$translations = [
'pl' => [
'login_header' => 'Logowanie',
'username' => 'Nazwa użytkownika',
'password' => 'Hasło',
'login_button' => 'Zaloguj',
'login_failed' => 'Logowanie nie powiodło się',
'logout_link' => 'Wyloguj',
'home_link' => 'Strona główna',
'cart_link' => 'Koszyk',
'orders_link' => 'Zamówienia',
'profile_link' => 'Profil',
'products_header' => 'Produkty',
'add_to_cart_button' => 'Dodaj do koszyka',
'product_details_link' => 'Szczegóły produktu',
'price_net' => 'Cena netto',
'price_gross' => 'Cena brutto',
'net' => 'netto',
'gross' => 'brutto',
'unit' => 'jednostka',
'back_to_products_link' => 'Powrót do listy produktów',
'product_name' => 'Nazwa produktu',
'product_description' => 'Opis produktu',
'related_products_header' => 'Produkty powiązane',
'cart_header' => 'Koszyk',
'product' => 'Produkt',
'quantity' => 'Ilość',
'total_price_net' => 'Cena całkowita netto',
'total_price_gross' => 'Cena całkowita brutto',
'empty_cart_message' => 'Koszyk jest pusty.',
'update_quantity_button' => 'Aktualizuj',
'remove_from_cart_button' => 'Usuń',
'checkout_button' => 'Do kasy',
'cart_total_header' => 'Podsumowanie koszyka',
'total_net' => 'Suma netto',
'total_gross' => 'Suma brutto',
'checkout_header' => 'Kasa',
'delivery_address_header' => 'Adres dostawy',
'name' => 'Imię i nazwisko',
'street' => 'Ulica',
'city' => 'Miasto',
'zip_code' => 'Kod pocztowy',
'country' => 'Kraj',
'phone' => 'Telefon',
'payment_method_header' => 'Metoda płatności',
'payment_on_delivery' => 'Płatność przy odbiorze',
'place_order_button' => 'Złóż zamówienie',
'orders_header' => 'Twoje zamówienia',
'order_number' => 'Numer zamówienia',
'order_date' => 'Data zamówienia',
'total_amount' => 'Kwota całkowita',
'status' => 'Status',
'order_details_link' => 'Szczegóły',
'order_details_header' => 'Szczegóły zamówienia',
'order_confirmation_header' => 'Potwierdzenie zamówienia',
'order_confirmation_message' => 'Dziękujemy za złożenie zamówienia. Zostało ono przyjęte do realizacji.',
'profile_header' => 'Twój profil',
'email' => 'Email',
'language_pl' => 'Polski',
'language_en' => 'English',
'currency_pln' => 'PLN',
'currency_eur' => 'EUR',
'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',
'payment_bank_transfer' => 'Przelew tradycyjny',
'payment_online' => 'Płatność online (Przelewy24)',
'payment_credit' => 'Kredyt kupiecki',
'order_confirmation_thank_you' => 'Dziękujemy za złożenie zamówienia.',
'order_confirmation_order_number' => 'Numer Twojego zamówienia to',
'order_confirmation_track_status' => 'Możesz śledzić jego status w panelu',
'order_confirmation_my_orders' => 'Moje zamówienia',
'order_confirmation_continue_shopping' => 'Kontynuuj zakupy',
'profile_user_profile' => 'Profil użytkownika',
'profile_error_loading' => 'Wystąpił błąd podczas ładowania danych profilu. Prosimy spróbować ponownie później.',
'profile_welcome' => 'Witaj',
'profile_email_address' => 'Adres e-mail',
'profile_client' => 'Klient',
'profile_password_management' => 'Zarządzanie hasłem',
'profile_feature_in_preparation' => 'Funkcja w przygotowaniu.',
'db_error' => 'Błąd bazy danych: ',
'catalog_title' => 'Katalog produktów',
'no_image_placeholder' => 'Brak zdjęcia',
'quantity_aria' => 'Ilość',
'accessories_and_complementary_products' => 'Akcesoria i produkty uzupełniające',
'footer_text' => 'Wszystkie prawa zastrzeżone.',
'app_name' => 'B2B Commerce',
'app_title' => 'B2B Commerce',
'orders' => 'Zamówienia',
'order_confirmation' => 'Potwierdzenie zamówienia',
'thank_you_for_your_order' => 'Dziękujemy za złożenie zamówienia!',
'your_order_number' => 'Twoje zamówienie o numerze',
'has_been_placed_successfully' => 'zostało pomyślnie złożone.',
'order_details_will_be_sent' => 'Szczegóły zamówienia zostaną wkrótce wysłane na Twój adres e-mail. Możesz również sprawdzić status swojego zamówienia w zakładce',
'continue_shopping' => 'Kontynuuj zakupy',
'menu_catalog' => 'Katalog',
'title_cart' => 'Koszyk',
'menu_orders' => 'Zamówienia',
'menu_profile' => 'Profil',
'menu_logout' => 'Wyloguj',
'header_welcome' => 'Witaj',
'related_suggestions_title' => 'Dodano do koszyka',
'product_added_successfully' => 'Produkt został pomyślnie dodany do koszyka!',
'you_added_to_cart' => 'Dodałeś do koszyka:',
'related_products_recommendation' => 'Polecamy także produkty powiązane:',
'go_to_cart' => 'Przejdź do koszyka',
'back_to_shop' => 'Wróć do sklepu',
'total' => 'Razem',
'update_button' => 'Zaktualizuj',
'remove_button' => 'Usuń',
'total_gross_label' => 'Razem (brutto):',
'proceed_to_checkout' => 'Przejdź do zamówienia',
'db_connection_error' => 'Błąd połączenia z bazą danych: ',
],
'en' => [
'login_header' => 'Login',
'username' => 'Username',
'password' => 'Password',
'login_button' => 'Login',
'login_failed' => 'Login failed',
'logout_link' => 'Logout',
'home_link' => 'Home',
'cart_link' => 'Cart',
'orders_link' => 'Orders',
'profile_link' => 'Profile',
'products_header' => 'Products',
'add_to_cart_button' => 'Add to cart',
'product_details_link' => 'Product details',
'price_net' => 'Net price',
'price_gross' => 'Gross price',
'net' => 'net',
'gross' => 'gross',
'unit' => 'unit',
'back_to_products_link' => 'Back to product list',
'product_name' => 'Product name',
'product_description' => 'Product description',
'related_products_header' => 'Related products',
'cart_header' => 'Cart',
'product' => 'Product',
'quantity' => 'Quantity',
'total_price_net' => 'Total net price',
'total_price_gross' => 'Total gross price',
'empty_cart_message' => 'Your cart is empty.',
'update_quantity_button' => 'Update',
'remove_from_cart_button' => 'Remove',
'checkout_button' => 'Checkout',
'cart_total_header' => 'Cart summary',
'total_net' => 'Total net',
'total_gross' => 'Total gross',
'checkout_header' => 'Checkout',
'delivery_address_header' => 'Delivery address',
'name' => 'Full name',
'street' => 'Street',
'city' => 'City',
'zip_code' => 'Zip code',
'country' => 'Country',
'phone' => 'Phone',
'payment_method_header' => 'Payment method',
'payment_on_delivery' => 'Payment on delivery',
'place_order_button' => 'Place order',
'orders_header' => 'Your orders',
'order_number' => 'Order number',
'order_date' => 'Order date',
'total_amount' => 'Total amount',
'status' => 'Status',
'order_details_link' => 'Details',
'order_details_header' => 'Order details',
'order_confirmation_header' => 'Order confirmation',
'order_confirmation_message' => 'Thank you for your order. It has been accepted for processing.',
'profile_header' => 'Your profile',
'email' => 'Email',
'language_pl' => 'Polski',
'language_en' => 'English',
'currency_pln' => 'PLN',
'currency_eur' => 'EUR',
'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',
'payment_bank_transfer' => 'Bank transfer',
'payment_online' => 'Online payment (Przelewy24)',
'payment_credit' => 'Trade credit',
'order_confirmation_thank_you' => 'Thank you for your order.',
'order_confirmation_order_number' => 'Your order number is',
'order_confirmation_track_status' => 'You can track its status in the',
'order_confirmation_my_orders' => 'My orders',
'order_confirmation_continue_shopping' => 'Continue shopping',
'profile_user_profile' => 'User profile',
'profile_error_loading' => 'There was an error loading your profile data. Please try again later.',
'profile_welcome' => 'Welcome',
'profile_email_address' => 'Email address',
'profile_client' => 'Client',
'profile_password_management' => 'Password management',
'profile_feature_in_preparation' => 'Feature in preparation.',
'db_error' => 'Database error: ',
'catalog_title' => 'Product catalog',
'no_image_placeholder' => 'No image',
'quantity_aria' => 'Quantity',
'accessories_and_complementary_products' => 'Accessories and complementary products',
'footer_text' => 'All rights reserved.',
'app_name' => 'B2B Commerce',
'app_title' => 'B2B Commerce',
'orders' => 'Orders',
'order_confirmation' => 'Order confirmation',
'thank_you_for_your_order' => 'Thank you for your order!',
'your_order_number' => 'Your order number',
'has_been_placed_successfully' => 'has been placed successfully.',
'order_details_will_be_sent' => 'Order details will be sent to your email address soon. You can also check your order status in the',
'continue_shopping' => 'Continue shopping',
'menu_catalog' => 'Catalog',
'title_cart' => 'Cart',
'menu_orders' => 'Orders',
'menu_profile' => 'Profile',
'menu_logout' => 'Logout',
'header_welcome' => 'Welcome',
'related_suggestions_title' => 'Added to cart',
'product_added_successfully' => 'Product has been successfully added to the cart!',
'you_added_to_cart' => 'You added to cart:',
'related_products_recommendation' => 'We also recommend related products:',
'go_to_cart' => 'Go to cart',
'back_to_shop' => 'Back to shop',
'total' => 'Total',
'update_button' => 'Update',
'remove_button' => 'Remove',
'total_gross_label' => 'Total (gross):',
'proceed_to_checkout' => 'Proceed to checkout',
'db_connection_error' => 'Database connection error: ',
],
];
function get_lang() {
global $default_language;
return $_SESSION['lang'] ?? $default_language;
}
function set_lang($lang) {
global $supported_languages;
if (in_array($lang, $supported_languages)) {
$_SESSION['lang'] = $lang;
}
}
function t(string $key): string {
global $translations;
$lang = get_lang();
if (isset($translations[$lang][$key])) {
return $translations[$lang][$key];
}
if (isset($translations['pl'][$key])) {
return $translations['pl'][$key];
}
return "[missing:$key]";
}
function t_status($key) {
$payment_methods = ['bank_transfer', 'online', 'credit'];
if (in_array($key, $payment_methods)) {
$translation_key = 'payment_' . $key;
} else {
$translation_key = 'status_' . $key;
}
return t($translation_key);
}