Skip to content

Commit 4841dac

Browse files
author
HugoFara
committed
fix(language): set new language as current and bust browser cache on redirect
After creating a new language, set it as the current language and add filterlang parameter to the redirect URL to prevent browser caching from hiding the new language in the dropdown.
1 parent 57c2981 commit 4841dac

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/Modules/Language/Http/LanguageController.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,11 @@ public function new(array $params): void
7676
if ($this->param('op') === 'Save') {
7777
$result = $this->languageFacade->create();
7878
if ($result['success']) {
79+
// Set the newly created language as the current language
80+
Settings::save('currentlanguage', (string)$result['id']);
7981
// Redirect to text creation page after successful language creation
80-
header('Location: ' . url('/texts/new'));
82+
// Use filterlang parameter to select the new language and bust browser cache
83+
header('Location: ' . url('/texts/new') . '?filterlang=' . $result['id']);
8184
exit;
8285
}
8386
// On error, fall through to show the form with error message

0 commit comments

Comments
 (0)