Skip to content

Commit 4bfd5fd

Browse files
[6.x] Ensure "Stop Impersonating" string is translated correctly (#12456)
Co-authored-by: Jason Varga <jason@pixelfear.com>
1 parent 556e9e2 commit 4bfd5fd

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

resources/views/impersonator/terminate.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,5 +86,5 @@
8686
></path>
8787
</g>
8888
</svg>
89-
{{ __('Stop impersonating') }}
89+
{{ __('Stop impersonating', locale: $locale) }}
9090
</a>

src/Http/Middleware/StopImpersonating.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use Closure;
66
use Illuminate\Http\Response;
7+
use Statamic\Facades\User;
78

89
class StopImpersonating
910
{
@@ -43,8 +44,14 @@ private function injectLink($response)
4344
{
4445
$content = $response->content();
4546

47+
$locale = User::find(session()->get('statamic_impersonated_by'))->preferredLocale();
48+
49+
// Make locale config with dashes backwards compatible, as they should be underscores.
50+
$locale = str_replace('-', '_', $locale);
51+
4652
$link = view('statamic::impersonator.terminate', [
4753
'url' => route('statamic.cp.impersonation.stop'),
54+
'locale' => $locale,
4855
])->render();
4956

5057
return $response->setContent(str_replace('</body>', $link.'</body>', $content));

0 commit comments

Comments
 (0)