Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion resources/views/impersonator/terminate.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,5 +86,5 @@
></path>
</g>
</svg>
{{ __('Stop impersonating') }}
{{ __('Stop impersonating', locale: $locale) }}
</a>
7 changes: 7 additions & 0 deletions src/Http/Middleware/StopImpersonating.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Closure;
use Illuminate\Http\Response;
use Statamic\Facades\User;

class StopImpersonating
{
Expand Down Expand Up @@ -43,8 +44,14 @@ private function injectLink($response)
{
$content = $response->content();

$locale = User::find(session()->get('statamic_impersonated_by'))->preferredLocale();

// Make locale config with dashes backwards compatible, as they should be underscores.
$locale = str_replace('-', '_', $locale);

$link = view('statamic::impersonator.terminate', [
'url' => route('statamic.cp.impersonation.stop'),
'locale' => $locale,
])->render();

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