Skip to content

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
robisim74 committed Sep 13, 2016
1 parent ee3abfc commit 4a5f662
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Because it is only a branch of Angular 2, the goal is the complete integration w

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

Angular version: 2.0.0-rc.6.
Angular version: 2.0.0-rc.7.

## Angular 2 i18n solutions
| _Feature_ | **Angular 2 (work-in)** _Native_ | **ng2-translate** _External library_ | **angular2localization** _External library_ |
Expand Down
14 changes: 9 additions & 5 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.0
Library version: 0.10.1

## Table of contents
* [1 The library structure](#1)
Expand Down Expand Up @@ -81,6 +81,10 @@ For example, to get the translation, add in the template:
```Html
{{ 'TITLE' | translate:lang }}
```
or if you want to use parameters:
```Html
{{ 'USER_NOTIFICATIONS' | translate:lang:{ user: username, NoMessages: messages.length } }}</div>
```
and include in the component:
```TypeScript
import { LocalizationService } from 'angular2localization';
Expand Down Expand Up @@ -243,8 +247,8 @@ These methods use the [Intl.Collator](https://developer.mozilla.org/en-US/docs/W

### <a name="2.5"/>2.5 Getting the translation in component class
If you need to get the translation in component class, [LocalizationService](#7.2) has the following methods:
* `translate(key: string): string;`
* `translateAsync(key: string): Observable<string>;`
* `translate(key: string, args?: any): string;`
* `translateAsync(key: string, args?: any): Observable<string>;`

But if you need to get the translation when the selected language changes, you must subscribe to the following event:
* `translationChanged: EventEmitter<any>;`
Expand Down Expand Up @@ -675,8 +679,8 @@ Method | Function
------ | --------
`addTranslation(language: string, translation: any): void;` | Direct loading: adds new translation data
`translationProvider(prefix: string, dataFormat?: string, webAPI?: boolean): void;` | Asynchronous loading: defines the translation provider
`translate(key: string): string;` | Translates a key
`translateAsync(key: string): Observable<string>;` | Translates a key
`translate(key: string, args?: any): string;` | Translates a key
`translateAsync(key: string, args?: any): Observable<string>;` | Translates a key
`updateTranslation(language?: string): void;` | Updates the language code and loads the translation data for the asynchronous loading
`compare(key1: string, key2: string, extension?: string, options?: any): number;` | Compares two keys by the value of translation & the current language code
`sort(list: Array<any>, keyName: any, order?: string, extension?: string, options?: any): Array<any>;` | Sorts an array of objects or an array of arrays by the current language code
Expand Down

0 comments on commit 4a5f662

Please sign in to comment.