Answer the question
In order to leave comments, you need to log in
How to internationalize messages in REST in Yii2?
Hello! In response from the server, you need to receive messages in different languages, depending on the parameter passed in the request, maybe there is some kind of ready-made solution or out of the box, I didn’t google it. Thanks in advance!
Answer the question
In order to leave comments, you need to log in
Of course there is, and right in the yii2 docs:
www.yiiframework.com/doc-2.0/yii-i18n-i18n.html
www.yiiframework.com/doc-2.0/guide-tutorial-i18n.html
If I understand you correctly, then you want to pass the language in the url. There is no such thing out of the box, you can try my solution https://github.com/xfg/yii2-lang
For enablePrettyUrl=true urls look like this example.com/en/module/controller/action
For enablePrettyUrl=false like this example.com/index .php?r=ru/module/controller/action
Works for a classic web application, not tested for REST, but I think it should. And in everything else, everything is as already written above www.yiiframework.com/doc-2.0/guide-tutorial-i18n.html
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question