JSON Messages for Yii ¶
This package provides a single class,
yii\i18n\JsonMessageSource which is a message source that stores translated messages in JSON files.
It extends from
PhpMessageSource class, so its usage is basically the same.
Within a JSON file, an object literal of (source, translation) pairs is defined. For example:
From a command prompt, run:
[sh] $ composer require cedx/yii2-json-messages
Now in your application configuration file, you can use the following message source:
return [ 'components' => [ 'i18n' => [ 'translations' => [ '*' => 'yii\i18n\JsonMessageSource' ] ] ] ];
See Also ¶
JSON Messages for Yii is distributed under the Apache License, version 2.0.