mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-24 10:49:00 +02:00
Cache the tools tree for each locale separately.
This fixes the problem that tools tree contained links to the wrong language.
This commit is contained in:
parent
6071b35644
commit
d4353118d9
1 changed files with 6 additions and 1 deletions
|
@ -24,6 +24,9 @@ namespace App\Services;
|
|||
|
||||
|
||||
use App\Entity\UserSystem\User;
|
||||
use Nyholm\Psr7\Request;
|
||||
use Symfony\Component\Intl\Locale\Locale;
|
||||
use Symfony\Component\Intl\Locales;
|
||||
use Symfony\Component\Security\Core\Security;
|
||||
|
||||
/**
|
||||
|
@ -47,6 +50,8 @@ class UserCacheKeyGenerator
|
|||
*/
|
||||
public function generateKey(User $user = null) : string
|
||||
{
|
||||
$locale = \Locale::getDefault();
|
||||
|
||||
//If no user was specified, use the currently used one.
|
||||
if ($user === null) {
|
||||
$user = $this->security->getUser();
|
||||
|
@ -59,6 +64,6 @@ class UserCacheKeyGenerator
|
|||
}
|
||||
|
||||
//In the most cases we can just use the username (its unique)
|
||||
return "user_" . $user->getUsername();
|
||||
return "user_" . $user->getUsername() . '_' . $locale;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue