I
I
ImPuuLsE2015-06-24 13:17:24
Yii
ImPuuLsE, 2015-06-24 13:17:24

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

3 answer(s)
M
Maxim Timofeev, 2015-06-24
@ImPuuLsE

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

X
xfg, 2015-06-24
@xfg

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

L
LAV45, 2015-06-26
@LAV45

https://github.com/yiisoft/yii2/blob/master/framew...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question