Skip to content

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
robisim74 committed Sep 15, 2016
1 parent fe92498 commit 9271e41
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 6 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@
This library is developed using TypeScript and Angular 2 for i18n and l10n of Angular 2 apps written in TypeScript, ES5 or ES6.
It allows, in addition to translation, to localize numbers and dates of your app, adding language code, country code, and optionally script code, numbering system and calendar, through [Internationalization API](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl). It also implements the validation of numbers by locales.
Because it is only a branch of Angular 2, the goal is the complete integration with the native solutions of Angular 2.

[Sample app](http://robisim74.github.io/angular2localization) built with Angular 2 Material & webpack, and its [source code](https://github.com/robisim74/angular2localization/tree/gh-pages).

Get the changelog by [releases](https://github.com/robisim74/angular2localization/releases).

Angular version: 2.0.0-rc.7.
**Angular version: 2.0.0 Final Release.**

## Angular 2 i18n solutions
| _Feature_ | **Angular 2 (work-in)** _Native_ | **ng2-translate** _External library_ | **angular2localization** _External library_ |
Expand Down
29 changes: 25 additions & 4 deletions doc/spec.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Angular 2 Localization library specification
Library version: 0.10.1
Library version: 1.0.0

## Table of contents
* [1 The library structure](#1)
Expand Down Expand Up @@ -81,11 +81,15 @@ For example, to get the translation, add in the template:
```Html
{{ 'TITLE' | translate:lang }}
```
or if you want to use parameters:
You can also use composed keys:
```Html
{{ 'USER_NOTIFICATIONS' | translate:lang:{ user: username, NoMessages: messages.length } }}</div>
{{ 'HOME.TITLE' | translate:lang }}
```
and include in the component:
If you want to use parameters:
```Html
{{ 'USER_NOTIFICATIONS' | translate:lang:{ user: username, NoMessages: messages.length } }}
```
Then include in the component:
```TypeScript
import { LocalizationService } from 'angular2localization';
...
Expand Down Expand Up @@ -372,6 +376,23 @@ and create the `json` files of the translations such as `locale-en.json`:
...
}
```
If you use composed key:
```
{
"HOME": {
"TITLE": "Angular 2 Localization",
...
},
...
}
```
or parameters:
```
{
"USER_NOTIFICATIONS": "{{ user }}, you have {{ NoMessages }} new messages",
...
}
```
*N.B. Resource files must be saved in `UTF-8` format.*

#### <a name="3.2.3"/>3.2.3 Asynchronous loading through a Web API
Expand Down

0 comments on commit 9271e41

Please sign in to comment.