angular-l10n
Version:
An Angular library to translate messages, dates and numbers
48 lines • 1.42 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';
var TranslatePipe = /** @class */ (function () {
function TranslatePipe(translation) {
this.translation = translation;
}
/**
* @param {?} key
* @param {?} lang
* @param {?=} args
* @return {?}
*/
TranslatePipe.prototype.transform = /**
* @param {?} key
* @param {?} lang
* @param {?=} args
* @return {?}
*/
function (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 = function () { return [
{ type: TranslationService }
]; };
return TranslatePipe;
}());
export { TranslatePipe };
if (false) {
/** @type {?} */
TranslatePipe.prototype.translation;
}
//# sourceMappingURL=translate.pipe.js.map