yiithings/yii2-i18n

This package is abandoned and no longer maintained. The author suggests using the yiithings/yii2-i18n package instead.

Internationalization extension for Yii2 framework

Installs: 90

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 0

Open Issues: 0

Type:yii2-extension

dev-master 2018-04-23 11:19 UTC

This package is auto-updated.

Last update: 2021-12-11 07:52:48 UTC


README

Build Status Latest Stable Version Total Downloads Latest Unstable Version License

Internationalization extension for Yii2 framework.

This extension use Gettext as message source and provide Web GUI(gii) editing message source.

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist yiithings/yii2-i18n "*"

or add

"yiithings/yii2-i18n": "*"

to the require section of your composer.json file.

Usage

Once the extension is installed, simply use it in your code by :

Add the component to your application.

'components' => [
    'i18n' => [
        'class' => 'yiithings\i18n\I18N'
    ]
]

Use functions:

echo __('Username');
__('Username'); // with echo
echo _x('Username', 'yii');
_xe('Username', 'yii'); // with echo

Edit messages:

Use PoEdit create or edit your messages. .po and .mo files default save path is @app/messages/, e.g. @app/messages/en-US.mo. If you want to change path rule, please see GettextMessageSource Class.