JSON Messages for Yii ¶
JSON message source for Yii, high-performance PHP framework.
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:
[javascript]
{
"original message 1": "translated message 1",
"original message 2": "translated message 2"
}
Requirements ¶
The latest PHP and Composer versions. If you plan to play with the sources, you will also need the Phing latest version.
Installing via Composer ¶
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 ¶
License ¶
JSON Messages for Yii is distributed under the Apache License, version 2.0.
If you have any questions, please ask in the forum instead.
Signup or Login in order to comment.