tr-localize

AngularJS directive and filter for localization with precompiled messageformat files
Homepage:
1 person uses it
Author: 6647414? trustner
Submitted by: 847947? mhannig

tr-localize

Lightweight AngularJS module for localizaion with messageformat files.

The module provides a (html enabled) directive and a filter for localization.

Both use precompiled messageformat translations. For more information about messageformat see https://github.com/SlexAxton/messageformat.js

Usage

The module comes with both: a directive and a filter.

Directive

This module provides the tr-i18n directive. The directive extracts the message id from the content of the element:

Scope variables can be bound by providing them with the tr-i18n attribute:

The parsed hash will be applied to the i18n-function provided by the compiled messageformat source.

Variables are escaped. However, the translated message may contain html markup.

Filter

The filter may be used with or without additional params. Params are automatically updated by angular.

Like in every filter, markup is escaped. If you need html consider using the tr-i18n or ng-bind-html directives.

comments powered by Disqus
This page was last updated over 3 years ago.