UNPKG

@salla.sa/twilight-components

Version:
40 lines (39 loc) 2.4 kB
/*! * Crafted with ❤ by Salla */ export const DEFAULT_LABELS = { deliveryTo: 'توصيل إلى', pickupFromBranch: 'الاستلام من فرع', noResults: 'لا توجد نتائج', selectCity: 'اختر المدينة', changeCityTitle: 'تغيير المدينة', changeCitySubtitle: '', cityFieldLabel: 'المدينة', modalSearchPlaceholder: 'ابحث عن مدينة', confirmAddress: 'تأكيد العنوان', errorDeliveryPromise: 'لا يتوفر وعد تسليم لهذه المدينة', errorPickupPromise: 'لا يتوفر وعد تسليم لهذا الفرع', }; export function loadLabels() { return { deliveryTo: salla.lang.getWithDefault('pages.products.promise_deliver_to', DEFAULT_LABELS.deliveryTo), pickupFromBranch: salla.lang.getWithDefault('pages.products.promise_pickup_from_branch', DEFAULT_LABELS.pickupFromBranch), noResults: salla.lang.getWithDefault('common.elements.no_options', DEFAULT_LABELS.noResults), selectCity: salla.lang.getWithDefault('common.elements.select_city', DEFAULT_LABELS.selectCity), changeCityTitle: salla.lang.getWithDefault('pages.products.promise_change_city_title', DEFAULT_LABELS.changeCityTitle), changeCitySubtitle: salla.lang.getWithDefault('pages.products.promise_change_city_subtitle', 'قد تتغيّر مدة التوصيل حسب المدينة.'), cityFieldLabel: salla.lang.getWithDefault('pages.products.promise_city_field', DEFAULT_LABELS.cityFieldLabel), modalSearchPlaceholder: salla.lang.getWithDefault('pages.products.promise_search_city', DEFAULT_LABELS.modalSearchPlaceholder), confirmAddress: salla.lang.getWithDefault('pages.checkout.confirm_address', DEFAULT_LABELS.confirmAddress), errorDeliveryPromise: salla.lang.getWithDefault('pages.products.promise_delivery_not_available', DEFAULT_LABELS.errorDeliveryPromise), errorPickupPromise: salla.lang.getWithDefault('pages.products.promise_pickup_not_available', DEFAULT_LABELS.errorPickupPromise), }; } /** Localized city display name (English when available and user language is not Arabic). */ export function getCityDisplayName(city) { const lang = salla.config.get('user.language_code'); if (lang && lang !== 'ar' && city.name_en?.trim()) { return city.name_en.trim(); } return city.name; }