Skip to content

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
robisim74 committed Sep 23, 2016
1 parent 1bb846a commit 0d9cce1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ It allows, in addition to translation, to localize numbers and dates of your app

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

**Angular version: 2.0.0 Final Release.**
**Angular version: ^2.0.0**

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

## Table of contents
* [1 The library structure](#1)
Expand Down Expand Up @@ -515,6 +515,20 @@ export class ListComponent {
```
In this way, application performance and memory usage are optimized.
If you have shared resources, you can also add more than one provider for each translation:
```TypeScript
export class ListComponent {

constructor(public localization: LocalizationService) {

// Initializes LocalizationService: asynchronous loading.
this.localization.addProvider('./resources/locale-list-');
this.localization.addProvider('./resources/global-'); // Contains the shared keys.
this.localization.updateTranslation(); // Need to update the translation.

}
```
## <a name="6"/>6 Validation by locales
### <a name="6.1"/>6.1 Validating a number
Expand Down Expand Up @@ -672,6 +686,7 @@ Property | Value
Method | Function
------ | --------
`addLanguage(language: string): void;` | Adds a new language
`addLanguages(languages: Array<string>): void;` | Adds languages
`useLocalStorage(): void;` | Sets Local Storage as default
`definePreferredLanguage(defaultLanguage: string, expiry?: number): void;` | Defines the preferred language. Selects the current language of the browser/user if it has been added, else the default language
`definePreferredLocale(defaultLanguage: string, defaultCountry: string, expiry?: number, script?: string, numberingSystem?: string, calendar?: string): void;` | Defines preferred languange and country, regardless of the browser language
Expand Down Expand Up @@ -699,6 +714,7 @@ 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
`addProvider(prefix: string, dataFormat?: string, webAPI?: boolean): void;` | Asynchronous loading: adds a translation provider
`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
Expand Down

0 comments on commit 0d9cce1

Please sign in to comment.