András
András

Reputation: 175

How to access Yii2 translation array?

I was wondering if there is a method to access the translation (i18n) array during runtime. I need access to it to in order to flip the array, and translate a few things back to the source language. (Need this to perform SQL queries on the DB, based on foreign language user input.)

Many thanks, Andras

Upvotes: 2

Views: 178

Answers (1)

András
András

Reputation: 175

This was my final solution, though does not look pretty.

$arr = include(Yii::getalias(Yii::$app->i18n->translations['app']['basePath'] . "/" . Yii::$app->language . "/app.php"));

Upvotes: 1

Related Questions