I need to make translation dependent on data stored in User entity. For example, i have User entity with column Language. If user has EN in it, i need to translate views into english etc. After logging in i need to check what type of language has user and load translated view.
Should i use for that https://symfony.com/doc/current/event_dispatcher.html if i do how should i do it?
I have tried make something with Locale setDefault function in IF statement but it dosen't work.
My translation.yaml :
framework:
default_locale: '%locale%'
translator:
default_path: '%kernel.project_dir%/translations'
fallbacks:
- '%locale%'
And my services.yaml
parameters:
locale: ru
app_locales: ru|uk