From 330c578cdcb2b7b2a9ea186017348937080fb6ff Mon Sep 17 00:00:00 2001 From: Peiman Nourani Date: Fri, 19 Jan 2024 08:26:58 +0000 Subject: [PATCH 1/2] [4.x] make placeholders translatable --- resources/js/components/fieldtypes/bard/LinkToolbar.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/js/components/fieldtypes/bard/LinkToolbar.vue b/resources/js/components/fieldtypes/bard/LinkToolbar.vue index 46b12e46ed4..51dda0e6f77 100644 --- a/resources/js/components/fieldtypes/bard/LinkToolbar.vue +++ b/resources/js/components/fieldtypes/bard/LinkToolbar.vue @@ -28,7 +28,7 @@ type="text" ref="urlInput" class="input h-auto text-sm" - placeholder="URL" + :placeholder="__('URL')" @keydown.enter.prevent="commit" /> @@ -39,7 +39,7 @@ type="text" ref="mailtoInput" class="input h-auto text-sm" - placeholder="Email Address" + :placeholder="__('Email Address')" @keydown.enter.prevent="commit" /> From c61932767e87bc0a52fb64947151a92dc6b66fd4 Mon Sep 17 00:00:00 2001 From: Peiman Nourani Date: Fri, 2 Feb 2024 09:41:02 +0000 Subject: [PATCH 2/2] [4.x] switch locale on site switch --- src/Http/Middleware/CP/Localize.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Http/Middleware/CP/Localize.php b/src/Http/Middleware/CP/Localize.php index 2a3e83c9b15..7f972b90fc3 100644 --- a/src/Http/Middleware/CP/Localize.php +++ b/src/Http/Middleware/CP/Localize.php @@ -4,6 +4,7 @@ use Closure; use Statamic\Facades\Preference; +use Statamic\Facades\Site; class Localize { @@ -11,9 +12,17 @@ public function handle($request, Closure $next) { $locale = Preference::get('locale') ?? app()->getLocale(); + if (! Preference::get('locale')) { + $locale = Site::selected()->locale(); + } + // Make locale config with dashes backwards compatible, as they should be underscores. $locale = str_replace('-', '_', $locale); + if (str_contains($locale, '_')) { + $locale = strstr($locale, '_', true); + } + app()->setLocale($locale); return $next($request);