Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
robisim74 committed Dec 21, 2016
1 parent ed6425b commit ed57083
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 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.3.0**
**Angular version: ^2.4.0**

## Angular 2 i18n solutions
| _Feature_ | [Angular 2](https://angular.io/docs/ts/latest/cookbook/i18n.html) _Native_ | [ng2-translate](https://github.com/ocombe/ng2-translate) _External library_ | [angular2localization](https://github.com/robisim74/angular2localization/blob/master/doc/spec.md) _External library_ |
Expand Down
24 changes: 12 additions & 12 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: 1.3.0
Library version: 1.4.0

## Table of contents
* [1 The library structure](#1)
Expand Down Expand Up @@ -67,7 +67,7 @@ Module | Class | Type | Contract
| `IntlSupport` | Service | Provides the methods to check if Intl is supported

## <a name="2"/>2 Getting the translation
To get the translation, this library uses _pure pipes_ (see [here](https://angular.io/docs/ts/latest/guide/pipes.html)) or _Html attributes_.
To get the translation, this library uses _pure pipes_ (to know the difference between _pure_ and _impure pipes_ see [here](https://angular.io/docs/ts/latest/guide/pipes.html)) or [Html attributes](#2.4).

Type | Format | Pipe syntax
---- | ------ | -----------
Expand All @@ -77,14 +77,6 @@ Number | Decimal | `expression | localeDecimal[:defaultLocale[:digitInfo]]`
Number | Percentage | `expression | localePercent[:defaultLocale[:digitInfo]]`
Number | Currency | `expression | localeCurrency[:defaultLocale[:currency[:symbolDisplay[:digitInfo]]]]`

Type | Format | Html syntax
---- | ------ | -----------
Message | String | `<tagname translate>expression</tagname>`
Date | Date/Number/ISO string | `<tagname localeDate="[format]">expression</tagname>`
Number | Decimal | `<tagname localeDecimal="[digitInfo]">expression</tagname>`
Number | Percentage | `<tagname localePercent="[digitInfo]">expression</tagname>`
Number | Currency | `<tagname localeCurrency="[digitInfo]" [symbol]="[symbolDisplay]">expression</tagname>`

### <a name="2.1"/>2.1 Messages
```
expression | translate:lang
Expand Down Expand Up @@ -229,7 +221,15 @@ These methods use the [Intl.Collator](https://developer.mozilla.org/en-US/docs/W
*N.B. This feature is not supported by all browsers, even with the use of `Intl.js`.*

### <a name="2.4"/>2.4 Getting the translation using Html attributes
Examples for translating messages:
Type | Format | Html syntax
---- | ------ | -----------
Message | String | `<tagname translate>expression</tagname>`
Date | Date/Number/ISO string | `<tagname localeDate="[format]">expression</tagname>`
Number | Decimal | `<tagname localeDecimal="[digitInfo]">expression</tagname>`
Number | Percentage | `<tagname localePercent="[digitInfo]">expression</tagname>`
Number | Currency | `<tagname localeCurrency="[digitInfo]" [symbol]="[symbolDisplay]">expression</tagname>`

For example:
```Html
<h1 translate>TITLE</h1>
```
Expand All @@ -238,7 +238,7 @@ If you want to use parameters:
<p [translate]="{ user: username, NoMessages: messages.length }">USER_NOTIFICATIONS</p>
```

Examples for localization of dates & numbers:
Examples of localization of dates & numbers:
```Html
<p localeDate>{{ today }}</p>
<p localeDate="fullDate">{{ today }}</p>
Expand Down

0 comments on commit ed57083

Please sign in to comment.