1.0.2 • Published 9 years ago

rivets-intl v1.0.2

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

rivets-intl

Rivets.js component for internationalization

Overview

rivets-intl uses IntlMessageFormat to render translated strings that can be bound by rivets

Usage

In your rivets setup add rivets-intl as a component

    var messages = { 'en-US': { greeting: { formal: "Hello, { name }" } } };
    var locale = 'en-US';
    Rivets.components.i18n = require('rivets-intl')(messages, locale);

In a template file

    <i18n key="greeting.formal" name="full_name" />

Then bind data

    var data = { full_name: "Black Widow" };
    Rivets.bind(template, data);

The result will be a string:

Hello, Black Widow