Answer the question
In order to leave comments, you need to log in
How to use 2 languages at the same time?
Again, the problem is out of place - in one form there is a field in German and there is a field in Polish. The client asks to fill in both. The variables are stored in English for readability and are translated by the symphony to the user's locale - in this case German. The question arises: how to translate the terms into Polish in parallel? Conversely, when the locale is Polish, translate into German? I mean the symfony way. I can screw it up myself. Localization is organized by language files. Thanks to all!
Answer the question
In order to leave comments, you need to log in
The interface of the translator component does not provide this possibility. Instead, you can call the public setLocale method and change the locale. It is better to make a clone of the translator first, so as not to affect the entire system.
$anotherTranslator = clone $originTranslator;
$anotherTranslator->setLocale('pl_PL');
echo $anotherTranslator->trans('message');
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question