json-messages JSON message source: store translations in JSON files.

JSON Messages for Yii

  1. Requirements
  2. Installing via Composer
  3. See Also
  4. License

Release License Downloads Code quality Build

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.

1 0
2 followers
364 downloads
Yii Version: 2.0
License: Apache-2.0
Category: Others
Developed by: CedX
Created on: Oct 26, 2014
Last updated: 8 years ago

Downloads

show all

Related Extensions