1

I read in the guide that I should use Yii::$app->language = 'da-DK' to change language - but it doesn't remember it for the next request. Do I manually have to store the current language in a session variable when I change it?

If so, where do read the session variable and set Yii::$app->language in the subsequent requests?

TheStoryCoder
  • 3,403
  • 6
  • 34
  • 64
  • 3
    There is great guide how to do this in the [Yii 2 Cookbook](https://yii2-cookbook.readthedocs.io/i18n-selecting-application-language) – Bizley Jan 03 '17 at 12:37

1 Answers1

0

You may also write 'language' => 'da-DK' at config/web

dimis283
  • 222
  • 3
  • 10
  • Okay, but it needs to be handled dynamically so that when the user changes the language it of course is remembered through the rest of his visit. I clarified my question now. – TheStoryCoder Jan 03 '17 at 12:18
  • 1
    maybe this is for you http://stackoverflow.com/questions/27881976/yii2-set-global-language-value – dimis283 Jan 03 '17 at 12:36