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:
Jan Böhmer 2019-11-02 21:18:46 +01:00
parent 6071b35644
commit d4353118d9

View file

@ -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;
}
}