diff --git a/README.md b/README.md index 7bac341b..0a46c72f 100644 --- a/README.md +++ b/README.md @@ -46,8 +46,8 @@ If you build apps in Angular using ES5, you can include the `umd` bundle in your ``` and use global `ng.l10n` namespace. -## AoT compilation & Server-side prerendering -This library is compatible with AoT compilation & Server-side prerendering. +## AoT compilation, Server-side prerendering & strict +This library is compatible with AoT compilation & Server-side prerendering. It also supports the `strict` TypeScript compiler option. ## Usage **Angular v4**: [quick start](https://github.com/robisim74/angular-l10n/blob/master/doc/quick-start.md) and [library specification](https://github.com/robisim74/angular-l10n/blob/master/doc/spec.md). diff --git a/doc/spec.md b/doc/spec.md index bc1ad929..4047f1a8 100644 --- a/doc/spec.md +++ b/doc/spec.md @@ -1,5 +1,5 @@ # Angular localization library specification -Library version: 3.0.4 +Library version: 3.1.0 ## Table of contents * [1 Library structure](#1) @@ -112,6 +112,7 @@ Method | Function `disableStorage();` | Disables the browser storage for language, default locale & currency `setCookieExpiration(days?: number);` | If the cookie expiration is omitted, the cookie becomes a session cookie `useLocalStorage();` | Sets browser LocalStorage as default for language, default locale & currency +`useSessionStorage();` | Sets browser SessionStorage as default for language, default locale & currency `defineLanguage(languageCode: string);` | Defines the language to be used `defineDefaultLocale(languageCode: string, countryCode: string, scriptCode?: string, numberingSystem?: string, calendar?: string);` | Defines the default locale to be used, regardless of the browser language `defineCurrency(currencyCode: string);` | Defines the currency to be used @@ -133,11 +134,11 @@ Method | Function You can use `addTranslation` when you configure the service, adding all the translation data: ```TypeScript -const translationEN = { - "Title": "Angular localization" +const translationEN: any = { + Title: "Angular localization" } -const translationIT = { - "Title": "Localizzazione in Angular" +const translationIT: any = { + Title: "Localizzazione in Angular" } this.translation.addConfiguration() @@ -335,7 +336,7 @@ ngOnDestroy() { ### 3.2 Directives Type | Format | Html syntax ---- | ------ | ----------- -Message | String | `expression` +Message | String | `expression` or `expression` Date | Date/Number/ISO string | `expression` Number | Decimal | `expression` Number | Percentage | `expression` @@ -536,11 +537,11 @@ Property | Value `defaultLocaleChanged: EventEmitter;` | `currencyCodeChanged: EventEmitter;` | `loadTranslation: Subject;` | -`readonly configuration: Config;` | Method | Function ------ | -------- -`addConfiguration(): LocaleConfig;` | Configure the service in the application root module or bootstrap component +`addConfiguration(): ILocaleConfigAPI;` | Configure the service in the application root module or bootstrap component +`getConfiguration(): ILocaleConfig;` | `init(): void;` | Call this method after the configuration to initialize the service `getAvailableLanguages(): string[];` | `getLanguageDirection(languageCode?: string): string;` | @@ -560,12 +561,12 @@ Property | Value ---------- | ----- `translationChanged: EventEmitter;` | `translationError: EventEmitter;` | -`readonly configuration: Config` | `serviceState: ServiceState;` | Method | Function ------ | -------- -`addConfiguration(): TranslationConfig;` | Configure the service in the application root module or bootstrap component +`addConfiguration(): ITranslationConfigAPI;` | Configure the service in the application root module or bootstrap component +`getConfiguration(): ITranslationConfig;` | `init(): void;` | Call this method after the configuration to initialize the service `getLanguage(): string;` | The language of the translation service is updated when the translation data has been loaded `translate(key: string, args?: any, lang?: string): string;` | @@ -574,7 +575,7 @@ Method | Function ### 8.3 LocaleValidation Method | Function ------ | -------- -`parseNumber(s: string): number;` | Converts a string to a number according to default locale +`parseNumber(s: string): number | null;` | Converts a string to a number according to default locale ### 8.4 Collator Method | Function