diff --git a/docs/index.md b/docs/index.md index b213c605..1bf86d1a 100644 --- a/docs/index.md +++ b/docs/index.md @@ -10,7 +10,7 @@ It allows, in addition to translation, to localize numbers and dates of your app --- -Library version: 6.2.0 - [Changelog](https://github.com/robisim74/angular-l10n/releases) +Library version: 6.3.0 - [Changelog](https://github.com/robisim74/angular-l10n/releases) --- diff --git a/docs/spec/api.md b/docs/spec/api.md index 258b8a26..ab9db5c9 100644 --- a/docs/spec/api.md +++ b/docs/spec/api.md @@ -88,32 +88,6 @@ Method | Function --- -## Translation -Property | Value --------- | ----- -`lang: string` | -`protected paramSubscriptions: ISubscription[]` | - -Method | Function ------- | -------- -`protected cancelParamSubscriptions(): void` | - ---- - -## Localization -Property | Value --------- | ----- -`defaultLocale: string` | -`currency: string` | -`timezone: string` | -`protected paramSubscriptions: ISubscription[]` | - -Method | Function ------- | -------- -`protected cancelParamSubscriptions(): void` | - ---- - ## ILocaleValidation Method | Function ------ | -------- diff --git a/docs/spec/getting-the-translation.md b/docs/spec/getting-the-translation.md index 876e2fe7..1c8f7a7e 100644 --- a/docs/spec/getting-the-translation.md +++ b/docs/spec/getting-the-translation.md @@ -186,42 +186,29 @@ where `currencyDisplay` is the currency formatting. Possible values are _'symbol {{ value | l10nCurrency:defaultLocale:currency:'symbol':'1.2-2' }} ``` -### Translation & Localization classes -When using _pipes_, alternatively to _decorators_ you can -extend `Translation` or `Localization` classes. - -Extend `Translation` class in the component to provide _lang_ to the _translate_ pipe: -```TypeScript -export class HomeComponent extends Translation { } -``` -Extend `Localization` class in the component to provide _lang_ to the _translate_ pipe, _defaultLocale_, _currency_, _timezone_ to _l10nDate_, _l10nDecimal_, _l10nPercent_ & _l10nCurrency_ pipes. -```TypeScript -export class HomeComponent extends Localization { } -``` -To cancel subscriptions for the params, you can call the `cancelParamSubscriptions` method into `ngOnDestroy`. - ### OnPush ChangeDetectionStrategy -_Pure pipes_ don't need to set `ChangeDetectionStrategy` to `OnPush`. If into your components you need to use it, you have to extend `Translation` or `Localization` class and pass `ChangeDetectorRef`: +_Pure pipes_ don't need to set `ChangeDetectionStrategy` to `OnPush`. If into your components you need to use it, you have to inject `ChangeDetectorRef`: ```TypeScript import { Component, ChangeDetectionStrategy, ChangeDetectorRef } from '@angular/core'; -import { Translation } from 'angular-l10n' - @Component({ ... changeDetection: ChangeDetectionStrategy.OnPush }) -export class HomeComponent extends Translation { +export class HomeComponent implements OnInit { - constructor(public ref: ChangeDetectorRef) { - super(ref); - ... - } + @Language() lang: string; + + constructor(private cdr: ChangeDetectorRef) { } + + ngOnInit(): void { } } ``` That's because we need to know the component reference that implements the `OnPush` strategy. +> Note that if you use in the component only the _directives_ and not the _pipes_, you don't need to inject `ChangeDetectorRef`. + --- ## Directives diff --git a/docs/spec/library-structure.md b/docs/spec/library-structure.md index 6dfc7ecd..58f75d63 100644 --- a/docs/spec/library-structure.md +++ b/docs/spec/library-structure.md @@ -16,8 +16,6 @@ Class | Contract `L10nLoader` | Initializes the services `LocaleService` | Manages language, default locale, currency & timezone `TranslationService` | Manages the translation data -`Translation` | Provides _lang_ to the _translate_ pipe -`Localization` | Provides _lang_ to the _translate_ pipe, _defaultLocale_, _currency_, _timezone_ to _l10nDate_, _l10nDecimal_, _l10nPercent_ & _l10nCurrency_ pipes `LocaleValidation` | Provides the methods for locale validation `Collator` | Intl.Collator APIs `IntlAPI` | Provides the methods to check if Intl APIs are supported diff --git a/package.json b/package.json index 3a3c3a2f..41948485 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "angular-l10n", "private": true, - "version": "6.2.0", + "version": "6.3.0", "description": "An Angular library to translate messages, dates and numbers", "main": "./bundles/angular-l10n.umd.js", "module": "./fesm5/angular-l10n.js", diff --git a/tslint.json b/tslint.json index 6e24f9c7..5e25a3db 100644 --- a/tslint.json +++ b/tslint.json @@ -34,6 +34,7 @@ true, "ignore-same-line" ], + "deprecation": false, "forin": false, "import-blacklist": false, "interface-name": false,