angular-ui/ui-utils — pull request #173 by timothyswt (2014-02-02 06:01:51+00:00)
Title: initial ui-i18n commit

due to the verbose nature of a couple of the i18n libraries out there and working on ng-grid 3.0 and wanting a lightweight version of i18n support I created a module that seems to be fairly lightweight and performant.

you can compare the performance of thousands of bindings against angular-translate here:

[angular-translate 11K rows of bindings](http://jsfiddle.net/eUGWJ/70/)

[ui-i18n 14K rows of bindings](http://jsfiddle.net/mc66U/4/)

setup:
```javascript
var uiI18n = angular.module('ui.i18n');
// adding english here, the array specifies all the matchable languages for the strings.
uiI18n.i18n.add(["en", "en-us"],{
groupPanel:{
description:'Drag a column header here and drop it to group by that column.'
},
example: "I speak English"
});
uiI18n.i18n.add("de",{
groupPanel:{
description:'Ziehen Sie eine Spaltenüberschrift hierhin um nach dieser Spalte zu gruppieren.'
},
example: "I speak Something Else"
});
```
NOTE: you can lazy load strings and it will extend the current set of strings with the new ones

```javascript
var uiI18n = angular.module('ui.i18n');
//calling this later:
uiI18n.i18n.add(["en", "en-us"],{
groupPanel: {
otherText: 'some other group property text'
},
anotherExample: "I speak A Different Language"
});
// results in
"en"/"en-us": {
groupPanel:{
otherText: 'some other group property text',
description:'Drag a column header here and drop it to group by that column.'
},
example: "I speak English",
anotherExample: "I speak A Different Language"
}
```
You can set the language via directive
```html

```
Or, through a module method:
```javascript
angular.module('ui.i18n').i18n.set("en-us");
```

Usage:
You can use it as an attribute, element, or filter, see all the different possibilities below
```html

Using attribute:

groupPanel.description

example

invalid.path

invalid.translation.again

Using element:

example

groupPanel.description

invalid.path

invalid.translation.again

Using Translate Filters:

{{"groupPanel.description" | t}}

{{"example" | t}}

{{"invalid.path" | t}}

{{"invalid.translation.again" | translate}}

```

it will alert you to missing translations with "[MISSING]: invalid.path" in place of where the translations should be.

All feedback is greatly appreciated.