i18n-yii2

0.0.6 • Public • Published

i18n-yii2

Package Version

Translation substitution in Yii2 manner:

Usage

import i18n from 'i18n-yii2';
 
console.log(i18n.t('category', 'Test message'));
console.log(i18n.t('category/subcategory', 'Hello, {name}', {name: 'Mr. Smith'}));

Configuration

Predefined global I18N_CONFIG

Assign global variable with name I18N_CONFIG before module loaded:

<script>
const I18N_CONFIG = {
    language: 'ru-RU',
    translations: {
        'ru-RU': {
            'category': {
                'Test message': 'Тестовое сообщение',
            },
            'category/subcategory': {
                'Hello, {name}': 'Здравствуйте, {name}',
            },
        },
    },
};
</script> 

Runtime

Pass config to i18n.configure() method:

import i18n from 'i18n-yii2';
 
i18n.configure({
    ...
});

License

This package is under MIT License

Readme

Keywords

Package Sidebar

Install

npm i i18n-yii2

Weekly Downloads

2

Version

0.0.6

License

MIT

Unpacked Size

8.58 kB

Total Files

4

Last publish

Collaborators

  • vovan-ve