From 0b79b33c6b4c22bf209628b46547987b101f3b3a Mon Sep 17 00:00:00 2001 From: Roberto Simonetti Date: Sun, 29 Nov 2020 17:07:59 +0100 Subject: [PATCH] Update docs --- docs/dependencies.html | 34 +- docs/graph/dependencies.svg | 548 ++++++++++------- docs/images/architecture.png | Bin 113343 -> 123610 bytes docs/index.html | 47 +- docs/injectables/L10nDefaultUserLanguage.html | 19 +- docs/injectables/L10nIntlService.html | 271 +++++++-- docs/injectables/L10nUserLanguage.html | 17 +- docs/js/menu-wc.js | 34 +- docs/js/search/search_index.js | 4 +- docs/miscellaneous/functions.html | 65 ++- docs/modules/L10nIntlModule.html | 394 ++++++++----- docs/modules/L10nIntlModule/dependencies.svg | 360 +++++++----- docs/modules/L10nTranslationModule.html | 80 +-- .../L10nTranslationModule/dependencies.svg | 80 +-- docs/modules/L10nValidationModule.html | 90 +-- .../L10nValidationModule/dependencies.svg | 90 +-- docs/overview.html | 550 ++++++++++-------- docs/pipes/L10nDisplayNamesAsyncPipe.html | 288 +++++++++ docs/pipes/L10nDisplayNamesPipe.html | 292 ++++++++++ docs/pipes/L10nPluralAsyncPipe.html | 300 ++++++++++ docs/pipes/L10nPluralPipe.html | 304 ++++++++++ docs/pipes/L10nTranslateAsyncPipe.html | 8 +- docs/pipes/L10nTranslatePipe.html | 8 +- 23 files changed, 2872 insertions(+), 1011 deletions(-) create mode 100644 docs/pipes/L10nDisplayNamesAsyncPipe.html create mode 100644 docs/pipes/L10nDisplayNamesPipe.html create mode 100644 docs/pipes/L10nPluralAsyncPipe.html create mode 100644 docs/pipes/L10nPluralPipe.html diff --git a/docs/dependencies.html b/docs/dependencies.html index 4a634921..a018a0f3 100644 --- a/docs/dependencies.html +++ b/docs/dependencies.html @@ -48,41 +48,43 @@

Intl API

@@ -357,20 +368,23 @@

Intl API

-

All modern browsers have implemented this API. You can use a polyfill like Polyfill.io to extend support to old browsers.

-

Just add one script tag in your index.html:

-
<script crossorigin="anonymous"
-    src="https://polyfill.io/v3/polyfill.min.js?flags=gated&features=Intl.~locale.en-US"></script>

When specifying the features, you have to specify what languages to load.

-

Other polyfills:

+

You can use polyfills to extend support to old browsers, or to use newest features:

    -
  • Format.JS
  • +
  • Polyfill.io

    +

    Just add one script tag in your index.html, for example:

    +
      <script crossorigin="anonymous"
    +      src="https://polyfill.io/v3/polyfill.min.js?flags=gated&features=Intl.~locale.en-US"></script>

    When specifying the features, you have to specify what languages to load

    +
  • +
  • Format.JS

    +

    Import polyfills you need as in the sample app

    +
-

The L10nIntlService also provides methods for other APIs, such as Collator, PluralRules and ListFormat.

Intl API in Node.js

To use Intl in Node.js, check the support according to the version in the official documentation: Internationalization Support

Server Side Rendering

-

You can find a complete sample app with @nguniversal/express-engine here.

+

You can find a complete sample app with @nguniversal/express-engine here

SSR doesn't work out of the box, so it is important to know:

  • src\app\universal-interceptor.ts: used to handle absolute URLs for HTTP requests on the server
  • @@ -382,6 +396,11 @@

    Server Side Rendering

Previous versions

    +
  • Angular v10 (Angular l10n v10.1.2)

    + +
  • Angular v9 (Angular l10n v9.3.0)

    • Branch
    • @@ -420,13 +439,15 @@

      Previous versions

    Contributing

      -
    • Building the library:

      +
    • First, install the packages & build the library:

        npm install
         npm run build
    • Testing:

        npm test
    • Serving the sample app:

        npm start
    • +
    • Serving the sample ssr app:

      +
        npm run dev:ssr

    License

    MIT

    diff --git a/docs/injectables/L10nDefaultUserLanguage.html b/docs/injectables/L10nDefaultUserLanguage.html index 2710f808..b5f88fc6 100644 --- a/docs/injectables/L10nDefaultUserLanguage.html +++ b/docs/injectables/L10nDefaultUserLanguage.html @@ -103,7 +103,7 @@

    Constructor

    - + @@ -171,8 +171,8 @@

    - + @@ -197,6 +197,7 @@

    import { Injectable, Inject } from '@angular/core';
     
     import { L10N_CONFIG, L10nConfig } from '../models/l10n-config';
    +import { getBrowserLanguage } from '../models/utils';
     
     /**
      * Implement this class-interface to get the user language.
    @@ -216,17 +217,7 @@ 

    constructor(@Inject(L10N_CONFIG) private config: L10nConfig) { } public async get(): Promise<string | null> { - let browserLanguage = null; - if (typeof navigator !== 'undefined' && navigator.language) { - switch (this.config.format) { - case 'language': - browserLanguage = navigator.language.split('-')[0]; - break; - case 'language-region': - browserLanguage = navigator.language; - break; - } - } + const browserLanguage = getBrowserLanguage(this.config.format); return Promise.resolve(browserLanguage); } diff --git a/docs/injectables/L10nIntlService.html b/docs/injectables/L10nIntlService.html index 1fc9de59..026841b4 100644 --- a/docs/injectables/L10nIntlService.html +++ b/docs/injectables/L10nIntlService.html @@ -79,6 +79,10 @@

    Methods
    Public compare

  • +
  • + Public + displayNames +
  • Public formatDate @@ -121,12 +125,12 @@

    Constructor

    -constructor(locale: L10nLocale, translation: L10nTranslationService) +constructor(config: L10nConfig, locale: L10nLocale, translation: L10nTranslationService) - + @@ -143,6 +147,18 @@

    Constructor

    + + config + + + L10nConfig + + + + No + + + locale @@ -205,8 +221,8 @@

    - + @@ -243,7 +259,7 @@

    -

    , First key to compare

    +

    First key to compare

    @@ -277,7 +293,7 @@

    -

    A Intl CollatorOptions object

    +

    An Intl CollatorOptions object

    @@ -318,6 +334,124 @@

    + + + + + + + + + + + + + + + + + + + +
    + + + + Public + displayNames + + + +
    + + displayNames(code: string, options?: any, language) +
    + +
    +

    Returns translation of language, region, script or currency display names

    +
    + +
    + Parameters : + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeOptionalDefault valueDescription
    code + string + + No + + +

    ISO code of language, region, script or currency

    + +
    options + any + + Yes + + +

    A DisplayNamesOptions object

    + +
    language + + No + + this.locale.language + +

    The current language

    + +
    +
    +
    +
    +
    + Returns : string + +
    +
    + +
    +
    @@ -342,8 +476,8 @@

    @@ -478,8 +612,8 @@

    @@ -614,8 +748,8 @@

    @@ -688,7 +822,7 @@

    @@ -750,8 +884,8 @@

    @@ -822,8 +956,8 @@

    @@ -878,7 +1012,7 @@

    @@ -933,22 +1067,22 @@

    + + + + + + + + + + @@ -1043,7 +1196,7 @@

    import { Injectable, Inject } from '@angular/core';
     
     import { L10nLocale, L10nDateTimeFormatOptions, L10nNumberFormatOptions, Unit } from '../models/types';
    -import { L10N_LOCALE } from '../models/l10n-config';
    +import { L10nConfig, L10N_CONFIG, L10N_LOCALE } from '../models/l10n-config';
     import {
         hasDateTimeFormat,
         hasTimeZone,
    @@ -1052,6 +1205,7 @@ 

    hasCollator, hasPluralRules, hasListFormat, + hasDisplayNames, toDate, toNumber, PARSE_DATE_STYLE, @@ -1062,7 +1216,11 @@

    @Injectable() export class L10nIntlService { - constructor(@Inject(L10N_LOCALE) private locale: L10nLocale, private translation: L10nTranslationService) { } + constructor( + @Inject(L10N_CONFIG) private config: L10nConfig, + @Inject(L10N_LOCALE) private locale: L10nLocale, + private translation: L10nTranslationService + ) { } /** * Formats a date. @@ -1136,7 +1294,7 @@

    * Formats a relative time. * @param value A negative (or positive) number * @param unit The unit of the value - * @param options A Intl RelativeTimeFormatOptions object + * @param options An Intl RelativeTimeFormatOptions object * @param language The current language */ public formatRelativeTime( @@ -1153,26 +1311,26 @@

    } public getCurrencySymbol(locale = this.locale): string | undefined { - let symbol = locale.currency; - if (hasNumberFormat()) { - const decimal = this.formatNumber(0, { digits: '1.0-0' }, locale.numberLanguage || locale.language); - const currency = this.formatNumber( - 0, - { digits: '1.0-0', style: 'currency', currencyDisplay: 'symbol' }, - locale.numberLanguage || locale.language, - locale.currency - ); - symbol = currency.replace(decimal, ''); - symbol = symbol.trim(); - } + if (!hasNumberFormat()) return locale.currency; + + const decimal = this.formatNumber(0, { digits: '1.0-0' }, locale.numberLanguage || locale.language); + const currency = this.formatNumber( + 0, + { digits: '1.0-0', style: 'currency', currencyDisplay: 'symbol' }, + locale.numberLanguage || locale.language, + locale.currency + ); + let symbol = currency.replace(decimal, ''); + symbol = symbol.trim(); + return symbol; } /** * Compares two keys by the value of translation. - * @param key1, First key to compare - * @param key1, Second key to compare - * @param options A Intl CollatorOptions object + * @param key1 First key to compare + * @param key1 Second key to compare + * @param options An Intl CollatorOptions object * @param language The current language * @return A negative value if the value of translation of key1 comes before the value of translation of key2; * a positive value if key1 comes after key2; @@ -1188,32 +1346,49 @@

    } /** - * Gets the plural for a number. + * Gets the plural by a number. * @param value The number to get the plural - * @param options A Intl PluralRulesOptions object + * @param options An Intl PluralRulesOptions object + * @param prefix Optional prefix for the key * @param language The current language */ - public plural(value: number, options?: Intl.PluralRulesOptions, language = this.locale.language): string { + public plural(value: any, prefix: string = '', options?: Intl.PluralRulesOptions, language = this.locale.language): string { if (!hasPluralRules() || language == null || language === '') return value.toString(); + value = toNumber(value); + const rule = new Intl.PluralRules(language, options).select(value); - return this.translation.has(rule) ? this.translation.translate(rule) : rule; + const key = prefix ? `${prefix}${this.config.keySeparator}${rule}` : rule; + + return this.translation.translate(key); } /** * Returns the representation of a list. * @param list An array of keys - * @param options A Intl ListFormatOptions object + * @param options An Intl ListFormatOptions object * @param language The current language */ public list(list: string[], options?: any, language = this.locale.language): string { const values = list.map(key => this.translation.translate(key)); - if (!hasListFormat() || language == null || language === '') return values.toString(); + if (!hasListFormat() || language == null || language === '') return values.join(', '); return new (Intl as any).ListFormat(language, options).format(values); } + /** + * Returns translation of language, region, script or currency display names + * @param code ISO code of language, region, script or currency + * @param options A DisplayNamesOptions object + * @param language The current language + */ + public displayNames(code: string, options?: any, language = this.locale.language): string { + if (!hasDisplayNames() || language == null || language === '') return code; + + return new (Intl as any).DisplayNames(language, options).of(code); + } + }

    diff --git a/docs/injectables/L10nUserLanguage.html b/docs/injectables/L10nUserLanguage.html index daa70b81..24f92d15 100644 --- a/docs/injectables/L10nUserLanguage.html +++ b/docs/injectables/L10nUserLanguage.html @@ -132,8 +132,8 @@

    @@ -166,6 +166,7 @@

    import { Injectable, Inject } from '@angular/core';
     
     import { L10N_CONFIG, L10nConfig } from '../models/l10n-config';
    +import { getBrowserLanguage } from '../models/utils';
     
     /**
      * Implement this class-interface to get the user language.
    @@ -185,17 +186,7 @@ 

    constructor(@Inject(L10N_CONFIG) private config: L10nConfig) { } public async get(): Promise<string | null> { - let browserLanguage = null; - if (typeof navigator !== 'undefined' && navigator.language) { - switch (this.config.format) { - case 'language': - browserLanguage = navigator.language.split('-')[0]; - break; - case 'language-region': - browserLanguage = navigator.language; - break; - } - } + const browserLanguage = getBrowserLanguage(this.config.format); return Promise.resolve(browserLanguage); } diff --git a/docs/js/menu-wc.js b/docs/js/menu-wc.js index 3d39ee43..5b0aa003 100644 --- a/docs/js/menu-wc.js +++ b/docs/js/menu-wc.js @@ -60,13 +60,13 @@ customElements.define('compodoc-menu', class extends HTMLElement { L10nIntlModule
  • -
  • - +
    - +
    - +
    -

    A Intl RelativeTimeFormatOptions object

    +

    An Intl RelativeTimeFormatOptions object

    - +
    - +
    -

    A Intl ListFormatOptions object

    +

    An Intl ListFormatOptions object

    - plural(value: number, options?: Intl.PluralRulesOptions, language) + plural(value: any, prefix: string, options?: Intl.PluralRulesOptions, language)
    - +
    -

    Gets the plural for a number.

    +

    Gets the plural by a number.

    @@ -967,7 +1101,7 @@

    value - number + any @@ -982,6 +1116,25 @@

    prefix + string + + No + + '' + +

    Optional prefix for the key

    + +
    options @@ -996,7 +1149,7 @@

    -

    A Intl PluralRulesOptions object

    +

    An Intl PluralRulesOptions object

    - +
    @@ -247,9 +250,36 @@

    -getBrowserLanguage() +getBrowserLanguage(format)
    @@ -541,6 +571,39 @@

    +
    + Parameters : + + + + + + + + + + + + + + + + +
    NameOptional
    format + No +
    +
    +
    +
    Returns : string | null +
    +
    +
    + + + + +
    + +
    + Returns : boolean + +
    +
    + + + + + + + + + + + + @@ -129,7 +129,7 @@

    @@ -133,7 +133,7 @@

    + + + + hasDisplayNames + + + +
    +hasDisplayNames() +
    diff --git a/docs/modules/L10nIntlModule.html b/docs/modules/L10nIntlModule.html index 325a24aa..6f6265cf 100644 --- a/docs/modules/L10nIntlModule.html +++ b/docs/modules/L10nIntlModule.html @@ -42,274 +42,370 @@ - - + dependencies - -Legend - -  Declarations - -  Module - -  Bootstrap - -  Providers - -  Exports + +Legend + +  Declarations + +  Module + +  Bootstrap + +  Providers + +  Exports cluster_L10nIntlModule - + cluster_L10nIntlModule_declarations - + - + cluster_L10nIntlModule_exports - + - + cluster_L10nIntlModule_providers - + L10nDateAsyncPipe - -L10nDateAsyncPipe + +L10nDateAsyncPipe - + L10nIntlModule - -L10nIntlModule + +L10nIntlModule L10nDateAsyncPipe->L10nIntlModule - - + + L10nDateDirective - -L10nDateDirective + +L10nDateDirective L10nDateDirective->L10nIntlModule - - + + L10nDatePipe - -L10nDatePipe + +L10nDatePipe L10nDatePipe->L10nIntlModule - - + + - + +L10nDisplayNamesAsyncPipe + +L10nDisplayNamesAsyncPipe + + + +L10nDisplayNamesAsyncPipe->L10nIntlModule + + + + + +L10nDisplayNamesPipe + +L10nDisplayNamesPipe + + + +L10nDisplayNamesPipe->L10nIntlModule + + + + + L10nNumberAsyncPipe - -L10nNumberAsyncPipe + +L10nNumberAsyncPipe - + L10nNumberAsyncPipe->L10nIntlModule - - + + - + L10nNumberDirective - -L10nNumberDirective + +L10nNumberDirective - + L10nNumberDirective->L10nIntlModule - - + + - + L10nNumberPipe - -L10nNumberPipe + +L10nNumberPipe - + L10nNumberPipe->L10nIntlModule - - + + + + + +L10nPluralAsyncPipe + +L10nPluralAsyncPipe + + + +L10nPluralAsyncPipe->L10nIntlModule + + + + + +L10nPluralPipe + +L10nPluralPipe + + + +L10nPluralPipe->L10nIntlModule + + - + L10nTimeAgoAsyncPipe - -L10nTimeAgoAsyncPipe + +L10nTimeAgoAsyncPipe - + L10nTimeAgoAsyncPipe->L10nIntlModule - - + + - + L10nTimeAgoDirective - -L10nTimeAgoDirective + +L10nTimeAgoDirective - + L10nTimeAgoDirective->L10nIntlModule - - + + - + L10nTimeAgoPipe - -L10nTimeAgoPipe + +L10nTimeAgoPipe - + L10nTimeAgoPipe->L10nIntlModule - - + + - + L10nDateAsyncPipe - -L10nDateAsyncPipe + +L10nDateAsyncPipe - + L10nIntlModule->L10nDateAsyncPipe - - + + - + L10nDateDirective - -L10nDateDirective + +L10nDateDirective - + L10nIntlModule->L10nDateDirective - - + + - + L10nDatePipe - -L10nDatePipe + +L10nDatePipe - + L10nIntlModule->L10nDatePipe - - + + + + + +L10nDisplayNamesAsyncPipe + +L10nDisplayNamesAsyncPipe + + + +L10nIntlModule->L10nDisplayNamesAsyncPipe + + + + + +L10nDisplayNamesPipe + +L10nDisplayNamesPipe + + + +L10nIntlModule->L10nDisplayNamesPipe + + - + L10nNumberAsyncPipe - -L10nNumberAsyncPipe + +L10nNumberAsyncPipe - + L10nIntlModule->L10nNumberAsyncPipe - - + + - + L10nNumberDirective - -L10nNumberDirective + +L10nNumberDirective - + L10nIntlModule->L10nNumberDirective - - + + - + L10nNumberPipe - -L10nNumberPipe + +L10nNumberPipe - + L10nIntlModule->L10nNumberPipe - - + + + + + +L10nPluralAsyncPipe + +L10nPluralAsyncPipe + + + +L10nIntlModule->L10nPluralAsyncPipe + + + + + +L10nPluralPipe + +L10nPluralPipe + + + +L10nIntlModule->L10nPluralPipe + + - + L10nTimeAgoAsyncPipe - -L10nTimeAgoAsyncPipe + +L10nTimeAgoAsyncPipe - + L10nIntlModule->L10nTimeAgoAsyncPipe - - + + - + L10nTimeAgoDirective - -L10nTimeAgoDirective + +L10nTimeAgoDirective - + L10nIntlModule->L10nTimeAgoDirective - - + + - + L10nTimeAgoPipe - -L10nTimeAgoPipe + +L10nTimeAgoPipe - + L10nIntlModule->L10nTimeAgoPipe - - + + - + L10nIntlService - -L10nIntlService + +L10nIntlService - + L10nIntlService->L10nIntlModule - - + + @@ -362,6 +458,12 @@

    Declarations L10nDatePipe +
  • + L10nDisplayNamesAsyncPipe +
  • +
  • + L10nDisplayNamesPipe +
  • L10nNumberAsyncPipe
  • @@ -371,6 +473,12 @@

    Declarations L10nNumberPipe +
  • + L10nPluralAsyncPipe +
  • +
  • + L10nPluralPipe +
  • L10nTimeAgoAsyncPipe
  • @@ -404,6 +512,12 @@

    Exports L10nDatePipe +
  • + L10nDisplayNamesAsyncPipe +
  • +
  • + L10nDisplayNamesPipe +
  • L10nNumberAsyncPipe
  • @@ -413,6 +527,12 @@

    Exports L10nNumberPipe +
  • + L10nPluralAsyncPipe +
  • +
  • + L10nPluralPipe +
  • L10nTimeAgoAsyncPipe
  • @@ -437,6 +557,8 @@

    Exports - - + dependencies - -Legend - -  Declarations - -  Module - -  Bootstrap - -  Providers - -  Exports + +Legend + +  Declarations + +  Module + +  Bootstrap + +  Providers + +  Exports cluster_L10nIntlModule - + cluster_L10nIntlModule_declarations - + - + cluster_L10nIntlModule_exports - + - + cluster_L10nIntlModule_providers - + L10nDateAsyncPipe - -L10nDateAsyncPipe + +L10nDateAsyncPipe - + L10nIntlModule - -L10nIntlModule + +L10nIntlModule L10nDateAsyncPipe->L10nIntlModule - - + + L10nDateDirective - -L10nDateDirective + +L10nDateDirective L10nDateDirective->L10nIntlModule - - + + L10nDatePipe - -L10nDatePipe + +L10nDatePipe L10nDatePipe->L10nIntlModule - - + + - + +L10nDisplayNamesAsyncPipe + +L10nDisplayNamesAsyncPipe + + + +L10nDisplayNamesAsyncPipe->L10nIntlModule + + + + + +L10nDisplayNamesPipe + +L10nDisplayNamesPipe + + + +L10nDisplayNamesPipe->L10nIntlModule + + + + + L10nNumberAsyncPipe - -L10nNumberAsyncPipe + +L10nNumberAsyncPipe - + L10nNumberAsyncPipe->L10nIntlModule - - + + - + L10nNumberDirective - -L10nNumberDirective + +L10nNumberDirective - + L10nNumberDirective->L10nIntlModule - - + + - + L10nNumberPipe - -L10nNumberPipe + +L10nNumberPipe - + L10nNumberPipe->L10nIntlModule - - + + + + + +L10nPluralAsyncPipe + +L10nPluralAsyncPipe + + + +L10nPluralAsyncPipe->L10nIntlModule + + + + + +L10nPluralPipe + +L10nPluralPipe + + + +L10nPluralPipe->L10nIntlModule + + - + L10nTimeAgoAsyncPipe - -L10nTimeAgoAsyncPipe + +L10nTimeAgoAsyncPipe - + L10nTimeAgoAsyncPipe->L10nIntlModule - - + + - + L10nTimeAgoDirective - -L10nTimeAgoDirective + +L10nTimeAgoDirective - + L10nTimeAgoDirective->L10nIntlModule - - + + - + L10nTimeAgoPipe - -L10nTimeAgoPipe + +L10nTimeAgoPipe - + L10nTimeAgoPipe->L10nIntlModule - - + + - + L10nDateAsyncPipe - -L10nDateAsyncPipe + +L10nDateAsyncPipe - + L10nIntlModule->L10nDateAsyncPipe - - + + - + L10nDateDirective - -L10nDateDirective + +L10nDateDirective - + L10nIntlModule->L10nDateDirective - - + + - + L10nDatePipe - -L10nDatePipe + +L10nDatePipe - + L10nIntlModule->L10nDatePipe - - + + + + + +L10nDisplayNamesAsyncPipe + +L10nDisplayNamesAsyncPipe + + + +L10nIntlModule->L10nDisplayNamesAsyncPipe + + + + + +L10nDisplayNamesPipe + +L10nDisplayNamesPipe + + + +L10nIntlModule->L10nDisplayNamesPipe + + - + L10nNumberAsyncPipe - -L10nNumberAsyncPipe + +L10nNumberAsyncPipe - + L10nIntlModule->L10nNumberAsyncPipe - - + + - + L10nNumberDirective - -L10nNumberDirective + +L10nNumberDirective - + L10nIntlModule->L10nNumberDirective - - + + - + L10nNumberPipe - -L10nNumberPipe + +L10nNumberPipe - + L10nIntlModule->L10nNumberPipe - - + + + + + +L10nPluralAsyncPipe + +L10nPluralAsyncPipe + + + +L10nIntlModule->L10nPluralAsyncPipe + + + + + +L10nPluralPipe + +L10nPluralPipe + + + +L10nIntlModule->L10nPluralPipe + + - + L10nTimeAgoAsyncPipe - -L10nTimeAgoAsyncPipe + +L10nTimeAgoAsyncPipe - + L10nIntlModule->L10nTimeAgoAsyncPipe - - + + - + L10nTimeAgoDirective - -L10nTimeAgoDirective + +L10nTimeAgoDirective - + L10nIntlModule->L10nTimeAgoDirective - - + + - + L10nTimeAgoPipe - -L10nTimeAgoPipe + +L10nTimeAgoPipe - + L10nIntlModule->L10nTimeAgoPipe - - + + - + L10nIntlService - -L10nIntlService + +L10nIntlService - + L10nIntlService->L10nIntlModule - - + + diff --git a/docs/modules/L10nTranslationModule.html b/docs/modules/L10nTranslationModule.html index dbe3ab77..495d800d 100644 --- a/docs/modules/L10nTranslationModule.html +++ b/docs/modules/L10nTranslationModule.html @@ -42,114 +42,114 @@ - dependencies - -Legend + +Legend -  Declarations +  Declarations -  Module +  Module -  Bootstrap +  Bootstrap -  Providers +  Providers -  Exports +  Exports cluster_L10nTranslationModule - - - -cluster_L10nTranslationModule_declarations - + cluster_L10nTranslationModule_exports - + + + +cluster_L10nTranslationModule_declarations + L10nTranslateAsyncPipe - -L10nTranslateAsyncPipe + +L10nTranslateAsyncPipe L10nTranslationModule - -L10nTranslationModule + +L10nTranslationModule L10nTranslateAsyncPipe->L10nTranslationModule - - + + L10nTranslateDirective - -L10nTranslateDirective + +L10nTranslateDirective L10nTranslateDirective->L10nTranslationModule - - + + L10nTranslatePipe - -L10nTranslatePipe + +L10nTranslatePipe L10nTranslatePipe->L10nTranslationModule - - + + L10nTranslateAsyncPipe - -L10nTranslateAsyncPipe + +L10nTranslateAsyncPipe L10nTranslationModule->L10nTranslateAsyncPipe - - + + L10nTranslateDirective - -L10nTranslateDirective + +L10nTranslateDirective L10nTranslationModule->L10nTranslateDirective - - + + L10nTranslatePipe - -L10nTranslatePipe + +L10nTranslatePipe L10nTranslationModule->L10nTranslatePipe - - + + diff --git a/docs/modules/L10nTranslationModule/dependencies.svg b/docs/modules/L10nTranslationModule/dependencies.svg index 2d8aa533..a075edef 100644 --- a/docs/modules/L10nTranslationModule/dependencies.svg +++ b/docs/modules/L10nTranslationModule/dependencies.svg @@ -1,114 +1,114 @@ - dependencies - -Legend + +Legend -  Declarations +  Declarations -  Module +  Module -  Bootstrap +  Bootstrap -  Providers +  Providers -  Exports +  Exports cluster_L10nTranslationModule - - - -cluster_L10nTranslationModule_declarations - + cluster_L10nTranslationModule_exports - + + + +cluster_L10nTranslationModule_declarations + L10nTranslateAsyncPipe - -L10nTranslateAsyncPipe + +L10nTranslateAsyncPipe L10nTranslationModule - -L10nTranslationModule + +L10nTranslationModule L10nTranslateAsyncPipe->L10nTranslationModule - - + + L10nTranslateDirective - -L10nTranslateDirective + +L10nTranslateDirective L10nTranslateDirective->L10nTranslationModule - - + + L10nTranslatePipe - -L10nTranslatePipe + +L10nTranslatePipe L10nTranslatePipe->L10nTranslationModule - - + + L10nTranslateAsyncPipe - -L10nTranslateAsyncPipe + +L10nTranslateAsyncPipe L10nTranslationModule->L10nTranslateAsyncPipe - - + + L10nTranslateDirective - -L10nTranslateDirective + +L10nTranslateDirective L10nTranslationModule->L10nTranslateDirective - - + + L10nTranslatePipe - -L10nTranslatePipe + +L10nTranslatePipe L10nTranslationModule->L10nTranslatePipe - - + + diff --git a/docs/modules/L10nValidationModule.html b/docs/modules/L10nValidationModule.html index 5dedbc27..b42350a8 100644 --- a/docs/modules/L10nValidationModule.html +++ b/docs/modules/L10nValidationModule.html @@ -42,122 +42,122 @@ - dependencies - -Legend + +Legend -  Declarations +  Declarations -  Module +  Module -  Bootstrap +  Bootstrap -  Providers +  Providers -  Exports +  Exports cluster_L10nValidationModule - - - -cluster_L10nValidationModule_declarations - - - -cluster_L10nValidationModule_L10nValidateDateDirective_providers - + cluster_L10nValidationModule_L10nValidateNumberDirective_providers - + + + +cluster_L10nValidationModule_declarations + cluster_L10nValidationModule_exports - + + + +cluster_L10nValidationModule_L10nValidateDateDirective_providers + L10nValidateDateDirective - -L10nValidateDateDirective + +L10nValidateDateDirective L10nValidationModule - -L10nValidationModule + +L10nValidationModule L10nValidateDateDirective->L10nValidationModule - - + + L10nValidateNumberDirective - -L10nValidateNumberDirective + +L10nValidateNumberDirective L10nValidateNumberDirective->L10nValidationModule - - + + L10nValidateDateDirective - -L10nValidateDateDirective + +L10nValidateDateDirective L10nValidationModule->L10nValidateDateDirective - - + + L10nValidateNumberDirective - -L10nValidateNumberDirective + +L10nValidateNumberDirective L10nValidationModule->L10nValidateNumberDirective - - + + { provide: NG_VALIDATORS, useExisting: forwardRef(() => L10nValidateDateDirective), multi: true } - -{ provide: NG_VALIDATORS, useExisting: forwardRef(() => L10nValidateDateDirective), multi: true } + +{ provide: NG_VALIDATORS, useExisting: forwardRef(() => L10nValidateDateDirective), multi: true } { provide: NG_VALIDATORS, useExisting: forwardRef(() => L10nValidateDateDirective), multi: true }->L10nValidateDateDirective - - + + { provide: NG_VALIDATORS, useExisting: forwardRef(() => L10nValidateNumberDirective), multi: true } - -{ provide: NG_VALIDATORS, useExisting: forwardRef(() => L10nValidateNumberDirective), multi: true } + +{ provide: NG_VALIDATORS, useExisting: forwardRef(() => L10nValidateNumberDirective), multi: true } { provide: NG_VALIDATORS, useExisting: forwardRef(() => L10nValidateNumberDirective), multi: true }->L10nValidateNumberDirective - - + + diff --git a/docs/modules/L10nValidationModule/dependencies.svg b/docs/modules/L10nValidationModule/dependencies.svg index ef622023..aea7e76f 100644 --- a/docs/modules/L10nValidationModule/dependencies.svg +++ b/docs/modules/L10nValidationModule/dependencies.svg @@ -1,122 +1,122 @@ - dependencies - -Legend + +Legend -  Declarations +  Declarations -  Module +  Module -  Bootstrap +  Bootstrap -  Providers +  Providers -  Exports +  Exports cluster_L10nValidationModule - - - -cluster_L10nValidationModule_declarations - - - -cluster_L10nValidationModule_L10nValidateDateDirective_providers - + cluster_L10nValidationModule_L10nValidateNumberDirective_providers - + + + +cluster_L10nValidationModule_declarations + cluster_L10nValidationModule_exports - + + + +cluster_L10nValidationModule_L10nValidateDateDirective_providers + L10nValidateDateDirective - -L10nValidateDateDirective + +L10nValidateDateDirective L10nValidationModule - -L10nValidationModule + +L10nValidationModule L10nValidateDateDirective->L10nValidationModule - - + + L10nValidateNumberDirective - -L10nValidateNumberDirective + +L10nValidateNumberDirective L10nValidateNumberDirective->L10nValidationModule - - + + L10nValidateDateDirective - -L10nValidateDateDirective + +L10nValidateDateDirective L10nValidationModule->L10nValidateDateDirective - - + + L10nValidateNumberDirective - -L10nValidateNumberDirective + +L10nValidateNumberDirective L10nValidationModule->L10nValidateNumberDirective - - + + { provide: NG_VALIDATORS, useExisting: forwardRef(() => L10nValidateDateDirective), multi: true } - -{ provide: NG_VALIDATORS, useExisting: forwardRef(() => L10nValidateDateDirective), multi: true } + +{ provide: NG_VALIDATORS, useExisting: forwardRef(() => L10nValidateDateDirective), multi: true } { provide: NG_VALIDATORS, useExisting: forwardRef(() => L10nValidateDateDirective), multi: true }->L10nValidateDateDirective - - + + { provide: NG_VALIDATORS, useExisting: forwardRef(() => L10nValidateNumberDirective), multi: true } - -{ provide: NG_VALIDATORS, useExisting: forwardRef(() => L10nValidateNumberDirective), multi: true } + +{ provide: NG_VALIDATORS, useExisting: forwardRef(() => L10nValidateNumberDirective), multi: true } { provide: NG_VALIDATORS, useExisting: forwardRef(() => L10nValidateNumberDirective), multi: true }->L10nValidateNumberDirective - - + + diff --git a/docs/overview.html b/docs/overview.html index e8c07a8f..68716ae6 100644 --- a/docs/overview.html +++ b/docs/overview.html @@ -40,462 +40,558 @@ - - + dependencies - -Legend - -  Declarations - -  Module - -  Bootstrap - -  Providers - -  Exports + +Legend + +  Declarations + +  Module + +  Bootstrap + +  Providers + +  Exports cluster_L10nIntlModule - + cluster_L10nIntlModule_declarations - + - + cluster_L10nIntlModule_exports - + - + cluster_L10nIntlModule_providers - + - + cluster_L10nTranslationModule - + - + cluster_L10nTranslationModule_declarations - + - + cluster_L10nTranslationModule_exports - + - + cluster_L10nValidationModule - + - + cluster_L10nValidationModule_declarations - + - + cluster_L10nValidationModule_L10nValidateDateDirective_providers - + - + cluster_L10nValidationModule_L10nValidateNumberDirective_providers - + - + cluster_L10nValidationModule_exports - + L10nDateAsyncPipe - -L10nDateAsyncPipe + +L10nDateAsyncPipe - + L10nIntlModule - -L10nIntlModule + +L10nIntlModule L10nDateAsyncPipe->L10nIntlModule - - + + L10nDateDirective - -L10nDateDirective + +L10nDateDirective L10nDateDirective->L10nIntlModule - - + + L10nDatePipe - -L10nDatePipe + +L10nDatePipe L10nDatePipe->L10nIntlModule - - + + - + +L10nDisplayNamesAsyncPipe + +L10nDisplayNamesAsyncPipe + + + +L10nDisplayNamesAsyncPipe->L10nIntlModule + + + + + +L10nDisplayNamesPipe + +L10nDisplayNamesPipe + + + +L10nDisplayNamesPipe->L10nIntlModule + + + + + L10nNumberAsyncPipe - -L10nNumberAsyncPipe + +L10nNumberAsyncPipe - + L10nNumberAsyncPipe->L10nIntlModule - - + + - + L10nNumberDirective - -L10nNumberDirective + +L10nNumberDirective - + L10nNumberDirective->L10nIntlModule - - + + - + L10nNumberPipe - -L10nNumberPipe + +L10nNumberPipe - + L10nNumberPipe->L10nIntlModule - - + + + + + +L10nPluralAsyncPipe + +L10nPluralAsyncPipe + + + +L10nPluralAsyncPipe->L10nIntlModule + + + + + +L10nPluralPipe + +L10nPluralPipe + + + +L10nPluralPipe->L10nIntlModule + + - + L10nTimeAgoAsyncPipe - -L10nTimeAgoAsyncPipe + +L10nTimeAgoAsyncPipe - + L10nTimeAgoAsyncPipe->L10nIntlModule - - + + - + L10nTimeAgoDirective - -L10nTimeAgoDirective + +L10nTimeAgoDirective - + L10nTimeAgoDirective->L10nIntlModule - - + + - + L10nTimeAgoPipe - -L10nTimeAgoPipe + +L10nTimeAgoPipe - + L10nTimeAgoPipe->L10nIntlModule - - + + - + L10nDateAsyncPipe - -L10nDateAsyncPipe + +L10nDateAsyncPipe - + L10nIntlModule->L10nDateAsyncPipe - - + + - + L10nDateDirective - -L10nDateDirective + +L10nDateDirective - + L10nIntlModule->L10nDateDirective - - + + - + L10nDatePipe - -L10nDatePipe + +L10nDatePipe - + L10nIntlModule->L10nDatePipe - - + + + + + +L10nDisplayNamesAsyncPipe + +L10nDisplayNamesAsyncPipe + + + +L10nIntlModule->L10nDisplayNamesAsyncPipe + + + + + +L10nDisplayNamesPipe + +L10nDisplayNamesPipe + + + +L10nIntlModule->L10nDisplayNamesPipe + + - + L10nNumberAsyncPipe - -L10nNumberAsyncPipe + +L10nNumberAsyncPipe - + L10nIntlModule->L10nNumberAsyncPipe - - + + - + L10nNumberDirective - -L10nNumberDirective + +L10nNumberDirective - + L10nIntlModule->L10nNumberDirective - - + + - + L10nNumberPipe - -L10nNumberPipe + +L10nNumberPipe - + L10nIntlModule->L10nNumberPipe - - + + + + + +L10nPluralAsyncPipe + +L10nPluralAsyncPipe + + + +L10nIntlModule->L10nPluralAsyncPipe + + + + + +L10nPluralPipe + +L10nPluralPipe + + + +L10nIntlModule->L10nPluralPipe + + - + L10nTimeAgoAsyncPipe - -L10nTimeAgoAsyncPipe + +L10nTimeAgoAsyncPipe - + L10nIntlModule->L10nTimeAgoAsyncPipe - - + + - + L10nTimeAgoDirective - -L10nTimeAgoDirective + +L10nTimeAgoDirective - + L10nIntlModule->L10nTimeAgoDirective - - + + - + L10nTimeAgoPipe - -L10nTimeAgoPipe + +L10nTimeAgoPipe - + L10nIntlModule->L10nTimeAgoPipe - - + + - + L10nIntlService - -L10nIntlService + +L10nIntlService - + L10nIntlService->L10nIntlModule - - + + - + L10nTranslateAsyncPipe - -L10nTranslateAsyncPipe + +L10nTranslateAsyncPipe - + L10nTranslationModule - -L10nTranslationModule + +L10nTranslationModule - + L10nTranslateAsyncPipe->L10nTranslationModule - - + + - + L10nTranslateDirective - -L10nTranslateDirective + +L10nTranslateDirective - + L10nTranslateDirective->L10nTranslationModule - - + + - + L10nTranslatePipe - -L10nTranslatePipe + +L10nTranslatePipe - + L10nTranslatePipe->L10nTranslationModule - - + + - + L10nTranslateAsyncPipe - -L10nTranslateAsyncPipe + +L10nTranslateAsyncPipe - + L10nTranslationModule->L10nTranslateAsyncPipe - - + + - + L10nTranslateDirective - -L10nTranslateDirective + +L10nTranslateDirective - + L10nTranslationModule->L10nTranslateDirective - - + + - + L10nTranslatePipe - -L10nTranslatePipe + +L10nTranslatePipe - + L10nTranslationModule->L10nTranslatePipe - - + + - + L10nValidateDateDirective - -L10nValidateDateDirective + +L10nValidateDateDirective - + L10nValidationModule - -L10nValidationModule + +L10nValidationModule - + L10nValidateDateDirective->L10nValidationModule - - + + - + L10nValidateNumberDirective - -L10nValidateNumberDirective + +L10nValidateNumberDirective - + L10nValidateNumberDirective->L10nValidationModule - - + + - + L10nValidateDateDirective - -L10nValidateDateDirective + +L10nValidateDateDirective - + L10nValidationModule->L10nValidateDateDirective - - + + - + L10nValidateNumberDirective - -L10nValidateNumberDirective + +L10nValidateNumberDirective - + L10nValidationModule->L10nValidateNumberDirective - - + + - + { provide: NG_VALIDATORS, useExisting: forwardRef(() => L10nValidateDateDirective), multi: true } - -{ provide: NG_VALIDATORS, useExisting: forwardRef(() => L10nValidateDateDirective), multi: true } + +{ provide: NG_VALIDATORS, useExisting: forwardRef(() => L10nValidateDateDirective), multi: true } - + { provide: NG_VALIDATORS, useExisting: forwardRef(() => L10nValidateDateDirective), multi: true }->L10nValidateDateDirective - - + + - + { provide: NG_VALIDATORS, useExisting: forwardRef(() => L10nValidateNumberDirective), multi: true } - -{ provide: NG_VALIDATORS, useExisting: forwardRef(() => L10nValidateNumberDirective), multi: true } + +{ provide: NG_VALIDATORS, useExisting: forwardRef(() => L10nValidateNumberDirective), multi: true } - + { provide: NG_VALIDATORS, useExisting: forwardRef(() => L10nValidateNumberDirective), multi: true }->L10nValidateNumberDirective - - + + @@ -541,7 +637,7 @@

    -

    8 Pipes

    +

    12 Pipes

    diff --git a/docs/pipes/L10nDisplayNamesAsyncPipe.html b/docs/pipes/L10nDisplayNamesAsyncPipe.html new file mode 100644 index 00000000..9bcd6eae --- /dev/null +++ b/docs/pipes/L10nDisplayNamesAsyncPipe.html @@ -0,0 +1,288 @@ + + + + + + Angular l10n Specification + + + + + + + + +
    + + + +
    +
    + + +
    +
    + + + + + + + + + + + + + + +
    +
    + +

    +

    File

    +

    +

    + projects/angular-l10n/src/lib/pipes/l10n-display-names.pipe.ts +

    + + + +
    +

    Metadata

    + + + + + + + +
    Namel10nDisplayNamesAsync
    +
    + +
    + +

    + Methods +

    + + + + + + + + + + + + + + + + + + + +
    + + + + Public + transform + + + +
    + + transform(value: any, options?: any, language?: string) +
    + +
    + +
    + Parameters : + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeOptional
    value + any + + No +
    options + any + + Yes +
    language + string + + Yes +
    +
    +
    +
    +
    + Returns : string | null + +
    +
    + +
    +
    +
    + +
    + + +
    +
    import { Pipe, PipeTransform, ChangeDetectorRef } from '@angular/core';
    +
    +import { L10nAsyncPipe } from '../models/l10n-async-pipe';
    +import { L10nIntlService } from '../services/l10n-intl.service';
    +import { L10nTranslationService } from '../services/l10n-translation.service';
    +
    +@Pipe({
    +    name: 'l10nDisplayNames',
    +    pure: true
    +})
    +export class L10nDisplayNamesPipe implements PipeTransform {
    +
    +    constructor(protected intl: L10nIntlService) { }
    +
    +    public transform(value: any, language: string, options?: any): string | null {
    +        if (value == null || value === '') return null;
    +
    +        return this.intl.displayNames(value, options, language);
    +    }
    +
    +}
    +
    +@Pipe({
    +    name: 'l10nDisplayNamesAsync',
    +    pure: false
    +})
    +export class L10nDisplayNamesAsyncPipe extends L10nAsyncPipe implements PipeTransform {
    +
    +    constructor(protected translation: L10nTranslationService, protected cdr: ChangeDetectorRef, protected intl: L10nIntlService) {
    +        super(translation, cdr);
    +    }
    +
    +    public transform(value: any, options?: any, language?: string): string | null {
    +        if (value == null || value === '') return null;
    +
    +        return this.intl.displayNames(value, options, language);
    +    }
    +
    +}
    +
    +
    + +
    + + + + + + + + + +
    +
    +

    result-matching ""

    +
      +
      +
      +

      No results matching ""

      +
      +
      +
      + +
      +
      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/pipes/L10nDisplayNamesPipe.html b/docs/pipes/L10nDisplayNamesPipe.html new file mode 100644 index 00000000..ce55a4f5 --- /dev/null +++ b/docs/pipes/L10nDisplayNamesPipe.html @@ -0,0 +1,292 @@ + + + + + + Angular l10n Specification + + + + + + + + + + + + +
      +
      + + +
      +
      + + + + + + + + + + + + + + +
      +
      + +

      +

      File

      +

      +

      + projects/angular-l10n/src/lib/pipes/l10n-display-names.pipe.ts +

      + + + +
      +

      Metadata

      + + + + + + + + + + + +
      Namel10nDisplayNames
      Puretrue
      +
      + +
      + +

      + Methods +

      + + + + + + + + + + + + + + + + + + + +
      + + + + Public + transform + + + +
      + + transform(value: any, language: string, options?: any) +
      + +
      + +
      + Parameters : + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      NameTypeOptional
      value + any + + No +
      language + string + + No +
      options + any + + Yes +
      +
      +
      +
      +
      + Returns : string | null + +
      +
      + +
      +
      +
      + +
      + + +
      +
      import { Pipe, PipeTransform, ChangeDetectorRef } from '@angular/core';
      +
      +import { L10nAsyncPipe } from '../models/l10n-async-pipe';
      +import { L10nIntlService } from '../services/l10n-intl.service';
      +import { L10nTranslationService } from '../services/l10n-translation.service';
      +
      +@Pipe({
      +    name: 'l10nDisplayNames',
      +    pure: true
      +})
      +export class L10nDisplayNamesPipe implements PipeTransform {
      +
      +    constructor(protected intl: L10nIntlService) { }
      +
      +    public transform(value: any, language: string, options?: any): string | null {
      +        if (value == null || value === '') return null;
      +
      +        return this.intl.displayNames(value, options, language);
      +    }
      +
      +}
      +
      +@Pipe({
      +    name: 'l10nDisplayNamesAsync',
      +    pure: false
      +})
      +export class L10nDisplayNamesAsyncPipe extends L10nAsyncPipe implements PipeTransform {
      +
      +    constructor(protected translation: L10nTranslationService, protected cdr: ChangeDetectorRef, protected intl: L10nIntlService) {
      +        super(translation, cdr);
      +    }
      +
      +    public transform(value: any, options?: any, language?: string): string | null {
      +        if (value == null || value === '') return null;
      +
      +        return this.intl.displayNames(value, options, language);
      +    }
      +
      +}
      +
      +
      + +
      + + + + + + + + + +
      +
      +

      result-matching ""

      +
        +
        +
        +

        No results matching ""

        +
        +
        +
        + +
        +
        + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/pipes/L10nPluralAsyncPipe.html b/docs/pipes/L10nPluralAsyncPipe.html new file mode 100644 index 00000000..08ba1569 --- /dev/null +++ b/docs/pipes/L10nPluralAsyncPipe.html @@ -0,0 +1,300 @@ + + + + + + Angular l10n Specification + + + + + + + + + + + + +
        +
        + + +
        +
        + + + + + + + + + + + + + + +
        +
        + +

        +

        File

        +

        +

        + projects/angular-l10n/src/lib/pipes/l10n-plural.pipe.ts +

        + + + +
        +

        Metadata

        + + + + + + + +
        Namel10nPluralAsync
        +
        + +
        + +

        + Methods +

        + + + + + + + + + + + + + + + + + + + +
        + + + + Public + transform + + + +
        + + transform(value: any, language: string, prefix?: string, options?: any) +
        + +
        + +
        + Parameters : + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
        NameTypeOptional
        value + any + + No +
        language + string + + No +
        prefix + string + + Yes +
        options + any + + Yes +
        +
        +
        +
        +
        + Returns : string | null + +
        +
        + +
        +
        +
        + +
        + + +
        +
        import { Pipe, PipeTransform, ChangeDetectorRef } from '@angular/core';
        +
        +import { L10nAsyncPipe } from '../models/l10n-async-pipe';
        +import { L10nIntlService } from '../services/l10n-intl.service';
        +import { L10nTranslationService } from '../services/l10n-translation.service';
        +
        +@Pipe({
        +    name: 'l10nPlural',
        +    pure: true
        +})
        +export class L10nPluralPipe implements PipeTransform {
        +
        +    constructor(protected intl: L10nIntlService) { }
        +
        +    public transform(value: any, language: string, prefix?: string, options?: any): string | null {
        +        if (value == null || value === '') return null;
        +
        +        return this.intl.plural(value, prefix, options, language);
        +    }
        +
        +}
        +
        +@Pipe({
        +    name: 'l10nPluralAsync',
        +    pure: false
        +})
        +export class L10nPluralAsyncPipe extends L10nAsyncPipe implements PipeTransform {
        +
        +    constructor(protected translation: L10nTranslationService, protected cdr: ChangeDetectorRef, protected intl: L10nIntlService) {
        +        super(translation, cdr);
        +    }
        +
        +    public transform(value: any, language: string, prefix?: string, options?: any): string | null {
        +        if (value == null || value === '') return null;
        +
        +        return this.intl.plural(value, prefix, options, language);
        +    }
        +
        +}
        +
        +
        + +
        + + + + + + + + + +
        +
        +

        result-matching ""

        +
          +
          +
          +

          No results matching ""

          +
          +
          +
          + +
          +
          + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/pipes/L10nPluralPipe.html b/docs/pipes/L10nPluralPipe.html new file mode 100644 index 00000000..019326a4 --- /dev/null +++ b/docs/pipes/L10nPluralPipe.html @@ -0,0 +1,304 @@ + + + + + + Angular l10n Specification + + + + + + + + + + + + +
          +
          + + +
          +
          + + + + + + + + + + + + + + +
          +
          + +

          +

          File

          +

          +

          + projects/angular-l10n/src/lib/pipes/l10n-plural.pipe.ts +

          + + + +
          +

          Metadata

          + + + + + + + + + + + +
          Namel10nPlural
          Puretrue
          +
          + +
          + +

          + Methods +

          + + + + + + + + + + + + + + + + + + + +
          + + + + Public + transform + + + +
          + + transform(value: any, language: string, prefix?: string, options?: any) +
          + +
          + +
          + Parameters : + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
          NameTypeOptional
          value + any + + No +
          language + string + + No +
          prefix + string + + Yes +
          options + any + + Yes +
          +
          +
          +
          +
          + Returns : string | null + +
          +
          + +
          +
          +
          + +
          + + +
          +
          import { Pipe, PipeTransform, ChangeDetectorRef } from '@angular/core';
          +
          +import { L10nAsyncPipe } from '../models/l10n-async-pipe';
          +import { L10nIntlService } from '../services/l10n-intl.service';
          +import { L10nTranslationService } from '../services/l10n-translation.service';
          +
          +@Pipe({
          +    name: 'l10nPlural',
          +    pure: true
          +})
          +export class L10nPluralPipe implements PipeTransform {
          +
          +    constructor(protected intl: L10nIntlService) { }
          +
          +    public transform(value: any, language: string, prefix?: string, options?: any): string | null {
          +        if (value == null || value === '') return null;
          +
          +        return this.intl.plural(value, prefix, options, language);
          +    }
          +
          +}
          +
          +@Pipe({
          +    name: 'l10nPluralAsync',
          +    pure: false
          +})
          +export class L10nPluralAsyncPipe extends L10nAsyncPipe implements PipeTransform {
          +
          +    constructor(protected translation: L10nTranslationService, protected cdr: ChangeDetectorRef, protected intl: L10nIntlService) {
          +        super(translation, cdr);
          +    }
          +
          +    public transform(value: any, language: string, prefix?: string, options?: any): string | null {
          +        if (value == null || value === '') return null;
          +
          +        return this.intl.plural(value, prefix, options, language);
          +    }
          +
          +}
          +
          +
          + +
          + + + + + + + + + +
          +
          +

          result-matching ""

          +
            +
            +
            +

            No results matching ""

            +
            +
            +
            + +
            +
            + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/pipes/L10nTranslateAsyncPipe.html b/docs/pipes/L10nTranslateAsyncPipe.html index 281e7ef9..40211d3b 100644 --- a/docs/pipes/L10nTranslateAsyncPipe.html +++ b/docs/pipes/L10nTranslateAsyncPipe.html @@ -99,7 +99,7 @@

            - transform(key: string, params?: any, language?: string) + transform(key: any, params?: any, language?: string)
            key - string + any @@ -197,7 +197,7 @@

            constructor(protected translation: L10nTranslationService) { } - public transform(key: string, language: string, params?: any): string | null { + public transform(key: any, language: string, params?: any): string | null { if (key == null || key === '') return null; return this.translation.translate(key, params, language); @@ -215,7 +215,7 @@

            super(translation, cdr); } - public transform(key: string, params?: any, language?: string): string | null { + public transform(key: any, params?: any, language?: string): string | null { if (key == null || key === '') return null; return this.translation.translate(key, params, language); diff --git a/docs/pipes/L10nTranslatePipe.html b/docs/pipes/L10nTranslatePipe.html index 73e6fa5b..01aa098f 100644 --- a/docs/pipes/L10nTranslatePipe.html +++ b/docs/pipes/L10nTranslatePipe.html @@ -103,7 +103,7 @@

            - transform(key: string, language: string, params?: any) + transform(key: any, language: string, params?: any)
            key - string + any @@ -201,7 +201,7 @@

            constructor(protected translation: L10nTranslationService) { } - public transform(key: string, language: string, params?: any): string | null { + public transform(key: any, language: string, params?: any): string | null { if (key == null || key === '') return null; return this.translation.translate(key, params, language); @@ -219,7 +219,7 @@

            super(translation, cdr); } - public transform(key: string, params?: any, language?: string): string | null { + public transform(key: any, params?: any, language?: string): string | null { if (key == null || key === '') return null; return this.translation.translate(key, params, language);