S
S
Symbi0t2015-04-30 14:35:01
Yii
Symbi0t, 2015-04-30 14:35:01

How to structure language files in Yii2?

The i18n component in the config is as follows:

'i18n' => [
    		'translations' => [
      		'app*' => [
        		'class' => 'yii\i18n\PhpMessageSource',
        		'basePath' => '@app/messages',
        		//'sourceLanguage' => 'en-US',
        		'fileMap' => [
        				'app'       => 'app.php',
        				'app/error' => 'error.php',
        		],
      		],
    		],
    	],

I don't understand how to make the structure look like this:
/messages/langFolder/ControllerName/<Имя_файла>
And then, when calling the Yii::t() method , the language file is loaded from the directory corresponding to the controller.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question