angular-l10n
Version:
An Angular library to translate messages, dates and numbers
43 lines • 1.17 kB
JavaScript
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
*/
import { Pipe } from '@angular/core';
import { TranslationService } from '../services/translation.service';
import { Logger } from '../models/logger';
export class TranslatePipe {
/**
* @param {?} translation
*/
constructor(translation) {
this.translation = translation;
}
/**
* @param {?} key
* @param {?} lang
* @param {?=} args
* @return {?}
*/
transform(key, lang, args) {
if (key == null || key === "")
return null;
if (typeof lang === "undefined")
Logger.log('TranslatePipe', 'missingLang');
return this.translation.translate(key, args, lang);
}
}
TranslatePipe.decorators = [
{ type: Pipe, args: [{
name: 'translate',
pure: true
},] }
];
/** @nocollapse */
TranslatePipe.ctorParameters = () => [
{ type: TranslationService }
];
if (false) {
/** @type {?} */
TranslatePipe.prototype.translation;
}
//# sourceMappingURL=translate.pipe.js.map