Skip to content

Allow specification pluralization via arrays

Compare
Choose a tag to compare
@tikiatua tikiatua released this 09 Jan 16:38
· 77 commits to master since this release

Thanks to the pull request #41 from @galchenkov it is now possible to specifies pluralizations via arrays instead of using ::: as delimiter.

$i18n.add('en', {'comments': [
    '{count} comment',
    '{count} comments',
]});

$i18n.add('ru', {'comments': [
    '{count} комментарий',
    '{count} комментария',
    '{count} комментариев',
]});

$i18n.set('en');
$t('comments', {count: 5}, 5); // 5 comments

$i18n.set('ru');
$t('comments', {count: 5}, 5); // 5 комментариев