@else
@@ -38,6 +43,7 @@
:name="$prefix . '_country_id'"
label="{{ __('checkout.page.country') }}"
:options="$countries"
+ translation-group="countries"
:value="$address?->country_id"
placeholder="{{ __('checkout.page.country_placeholder') }}"
required
diff --git a/resources/views/checkout/components/select.blade.php b/resources/views/checkout/components/select.blade.php
index 6a722a1..3474c67 100644
--- a/resources/views/checkout/components/select.blade.php
+++ b/resources/views/checkout/components/select.blade.php
@@ -1,11 +1,20 @@
{{--
-
+
`options` is an iterable of models/objects; `label` is always read from
`->name`, the submitted value from `->{$valueField}` (default `id`, but e.g.
`name` for Lunar states — table-rate-shipping resolves those with
State::whereName(), so the address must carry the exact name string).
+
+ `translationGroup` (optional, e.g. "countries"/"states") looks the raw
+ `->name` up in boboko-core's `core::{group}.{name}` lang file (see
+ boboko-core's lang/el/countries.php, lang/el/states.php) for the
+ DISPLAYED label only — the submitted `value` is always the untranslated
+ `->{$valueField}`, since table-rate-shipping/Lunar's Country lookups key
+ off the original English name. Falls back to the raw name when no
+ translation exists for the current locale (e.g. English, or a country
+ outside the covered set).
--}}
@props([
'name',
@@ -15,8 +24,21 @@
'placeholder' => null,
'required' => false,
'valueField' => 'id',
+ 'translationGroup' => null,
])
+@php
+ $optionLabel = function ($option) use ($translationGroup) {
+ if (! $translationGroup) {
+ return $option->name;
+ }
+
+ $key = "core::{$translationGroup}.{$option->name}";
+
+ return \Illuminate\Support\Facades\Lang::has($key) ? __($key) : $option->name;
+ };
+@endphp
+
@php($selected = old($name, $value))