Answer the question
In order to leave comments, you need to log in
Yii2: How to translate REST response?
I have 2 tables.
Clubs and
cities
When I create a club, a list of cities is requested through rest.
Question.
1. how to make a translation of what the rest gives?
2. how to make a search in the rest, taking into account the fact that they enter something not on the sourceLanguage?
Answer the question
In order to leave comments, you need to log in
yii\rest\Controller has a ContentNegotiator filter, which also accepts the language in Yii::$app->language. Configure supported languages via the container:
Yii::$container->set('yii\filters\ContentNegotiator', [
'languages' => ['en', 'ru'],
]);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question