0.0.6 • Published 6 years ago

i18n-yii2 v0.0.6

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

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

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago