Guys, I’m hard to know what is the ideal place to use the \Yii::$app->language = ‘pt’;
I tried in main.php view, but only the menu got the translation. In the tutorial-i18N says:
You may set the application language at runtime to the language that the user has chosen. This has to be done at a point before any output is generated so that it affects all the output correctly. Therefor just change the application property to the desired value
My intention is to store the desired language in a LANGUAGE field in the user profile (along with FULL_NAME, etc.).
In the code, I need to know the correct location and how to use.
it means before render. controller or view. i personally would put it in controller, maybe even in base controller if your profile is accecible at any place