EN RU
Forum

Methodology

Technology

Toolbox

Libraries

Tutorials

DocumentationSource

i18n

Block is a function for project internationalization. It could be used in browsers and within the Node.js environment.

Signature

/**
 * @exports
 * @param {String} keyset
 * @param {String} key
 * @param {Object} [params]
 * @returns {String}
 */
i18n(keyset, key, params);

Example:

i18n('keyset1', 'key2', { a : '1' });

To add translations, use decl method:

i18n.decl({
    keyset1 : {
        key1 : 'keyset1 key1 string',
        key2 : function(params) {
            return 'keyset1 key2 function ' + JSON.stringify(params);
        },
        key3 : function(params) {
            return 'keyset1 key3 ' + this('keyset1', 'key2', params);
        }
    }
});

You can find relevant documentation for building a project with internationalization within a build package enb-bem-i18n (in Russian only, translation is coming).