angular-l10n
Version:
An Angular library to translate messages, dates and numbers
89 lines • 2.99 kB
JavaScript
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
*/
import { NgModule } from '@angular/core';
import { TranslationModule, provideRoot, provideChild } from './translation.module';
import { InjectorRef } from '../models/injector-ref';
import { Logger } from '../models/logger';
import { L10nDatePipe } from '../pipes/l10n-date.pipe';
import { L10nDecimalPipe, L10nPercentPipe, L10nCurrencyPipe } from '../pipes/l10n-number.pipe';
import { L10nDateDirective } from '../directives/l10n-date.directive';
import { L10nDecimalDirective, L10nPercentDirective, L10nCurrencyDirective } from '../directives/l10n-number.directive';
/**
* Provides dependencies, pipes & directives for translating messages, dates & numbers.
*/
export class LocalizationModule {
/**
* @param {?} injector
* @param {?} logger
*/
constructor(injector, logger) {
this.injector = injector;
this.logger = logger;
}
/**
* Use in AppModule: new instances of LocaleService & TranslationService.
* @param {?} l10nConfig
* @param {?=} token
* @return {?}
*/
static forRoot(l10nConfig, token = {}) {
return {
ngModule: LocalizationModule,
providers: provideRoot(l10nConfig, token)
};
}
/**
* Use in feature modules with lazy loading: new instance of TranslationService.
* @param {?} l10nConfig
* @param {?=} token
* @return {?}
*/
static forChild(l10nConfig, token = {}) {
return {
ngModule: LocalizationModule,
providers: provideChild(l10nConfig, token)
};
}
}
LocalizationModule.decorators = [
{ type: NgModule, args: [{
declarations: [
L10nDatePipe,
L10nDecimalPipe,
L10nPercentPipe,
L10nCurrencyPipe,
L10nDateDirective,
L10nDecimalDirective,
L10nPercentDirective,
L10nCurrencyDirective
],
imports: [
TranslationModule
],
exports: [
TranslationModule,
L10nDatePipe,
L10nDecimalPipe,
L10nPercentPipe,
L10nCurrencyPipe,
L10nDateDirective,
L10nDecimalDirective,
L10nPercentDirective,
L10nCurrencyDirective
]
},] }
];
/** @nocollapse */
LocalizationModule.ctorParameters = () => [
{ type: InjectorRef },
{ type: Logger }
];
if (false) {
/** @type {?} */
LocalizationModule.prototype.injector;
/** @type {?} */
LocalizationModule.prototype.logger;
}
//# sourceMappingURL=localization.module.js.map