diff --git a/.gitignore b/.gitignore index d7e4300b..07e179b2 100644 --- a/.gitignore +++ b/.gitignore @@ -16,6 +16,7 @@ npm-debug.log !bundles/*.js !examples/**/*.js coverage +*.metadata.json ################# ## JetBrains diff --git a/.npmignore b/.npmignore index bd47c473..2904dbc0 100644 --- a/.npmignore +++ b/.npmignore @@ -13,6 +13,7 @@ tests examples .github coverage +!*.metadata.json ################# ## JetBrains diff --git a/bundles/ng2-translate.js b/bundles/ng2-translate.js index dcead031..a66b7604 100644 --- a/bundles/ng2-translate.js +++ b/bundles/ng2-translate.js @@ -1,649 +1,700 @@ -System.registerDynamic("src/translate.pipe", ["@angular/core", "./translate.service"], true, function ($__require, exports, module) { - "use strict"; +!function(e){function r(e,r,t){e in l||(l[e]={name:e,declarative:!0,deps:r,declare:t,normalizedDeps:r})}function t(e){return p[e]||(p[e]={name:e,dependencies:[],exports:{},importers:[]})}function n(r){if(!r.module){var o=r.module=t(r.name),a=r.module.exports,u=r.declare.call(e,function(e,r){if(o.locked=!0,"object"==typeof e)for(var t in e)a[t]=e[t];else a[e]=r;for(var n=0,u=o.importers.length;u>n;n++){var i=o.importers[n];if(!i.locked)for(var l=0;ls;s++){var f,c=r.normalizedDeps[s],v=l[c],m=p[c];m?f=m.exports:v&&!v.declarative?f=v.esModule:v?(n(v),m=v.module,f=m.exports):f=i(c),m&&m.importers?(m.importers.push(o),o.dependencies.push(m)):o.dependencies.push(null),o.setters[s]&&o.setters[s](f)}}}function o(r){var t={};if(("object"==typeof r||"function"==typeof r)&&r!==e)if(d)for(var n in r)"default"!==n&&a(t,r,n);else{var o=r&&r.hasOwnProperty;for(var n in r)"default"===n||o&&!r.hasOwnProperty(n)||(t[n]=r[n])}return t["default"]=r,c(t,"__useDefault",{value:!0}),t}function a(e,r,t){try{var n;(n=Object.getOwnPropertyDescriptor(r,t))&&c(e,t,n)}catch(o){return e[t]=r[t],!1}}function u(r,t){var n=l[r];if(n&&!n.evaluated&&n.declarative){t.push(r);for(var o=0,a=n.normalizedDeps.length;a>o;o++){var d=n.normalizedDeps[o];-1==s.call(t,d)&&(l[d]?u(d,t):i(d))}n.evaluated||(n.evaluated=!0,n.module.execute.call(e))}}function i(e){if(m[e])return m[e];if("@node/"==e.substr(0,6))return m[e]=o(v(e.substr(6)));var r=l[e];if(!r)throw"Module "+e+" not present.";return n(l[e]),u(e,[]),l[e]=void 0,r.declarative&&c(r.module.exports,"__esModule",{value:!0}),m[e]=r.declarative?r.module.exports:r.esModule}var l={},s=Array.prototype.indexOf||function(e){for(var r=0,t=this.length;t>r;r++)if(this[r]===e)return r;return-1},d=!0;try{Object.getOwnPropertyDescriptor({a:0},"a")}catch(f){d=!1}var c;!function(){try{Object.defineProperty({},"a",{})&&(c=Object.defineProperty)}catch(e){c=function(e,r,t){try{e[r]=t.value||t.get.call(e)}catch(n){}}}}();var p={},v="undefined"!=typeof System&&System._nodeRequire||"undefined"!=typeof require&&require.resolve&&"undefined"!=typeof process&&require,m={"@empty":{}};return function(e,t,n,a){return function(u){u(function(u){for(var l=0;l1)for(var l=1;l= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; - }; - var __metadata = this && this.__metadata || function (k, v) { - if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); - }; - var core_1 = $__require("@angular/core"); - var translate_service_1 = $__require("./translate.service"); - var TranslatePipe = function () { - function TranslatePipe(translate, _ref) { - this.translate = translate; - this._ref = _ref; - this.value = ''; - } - /* tslint:disable */ - /** - * @name equals - * - * @description - * Determines if two objects or two values are equivalent. - * - * Two objects or values are considered equivalent if at least one of the following is true: - * - * * Both objects or values pass `===` comparison. - * * Both objects or values are of the same type and all of their properties are equal by - * comparing them with `equals`. - * - * @param {*} o1 Object or value to compare. - * @param {*} o2 Object or value to compare. - * @returns {boolean} True if arguments are equal. - */ - TranslatePipe.prototype.equals = function (o1, o2) { - if (o1 === o2) return true; - if (o1 === null || o2 === null) return false; - if (o1 !== o1 && o2 !== o2) return true; // NaN === NaN - var t1 = typeof o1, - t2 = typeof o2, - length, - key, - keySet; - if (t1 == t2 && t1 == 'object') { - if (Array.isArray(o1)) { - if (!Array.isArray(o2)) return false; - if ((length = o1.length) == o2.length) { - for (key = 0; key < length; key++) { - if (!this.equals(o1[key], o2[key])) return false; - } +(["1"], ["3","c","5","6","8","9","7","a"], false, function($__System) { +var require = this.require, exports = this.exports, module = this.module; +$__System.register("2", ["3", "4"], function(exports_1, context_1) { + "use strict"; + var __moduleName = context_1 && context_1.id; + var core_1, translate_service_1; + var TranslatePipe; + return { + setters:[ + function (core_1_1) { + core_1 = core_1_1; + }, + function (translate_service_1_1) { + translate_service_1 = translate_service_1_1; + }], + execute: function() { + exports_1("TranslatePipe", TranslatePipe = (function () { + function TranslatePipe(translate, _ref) { + this.translate = translate; + this._ref = _ref; + this.value = ''; + } + /* tslint:disable */ + /** + * @name equals + * + * @description + * Determines if two objects or two values are equivalent. + * + * Two objects or values are considered equivalent if at least one of the following is true: + * + * * Both objects or values pass `===` comparison. + * * Both objects or values are of the same type and all of their properties are equal by + * comparing them with `equals`. + * + * @param {*} o1 Object or value to compare. + * @param {*} o2 Object or value to compare. + * @returns {boolean} True if arguments are equal. + */ + TranslatePipe.prototype.equals = function (o1, o2) { + if (o1 === o2) return true; - } - } else { - if (Array.isArray(o2)) { + if (o1 === null || o2 === null) return false; - } - keySet = Object.create(null); - for (key in o1) { - if (!this.equals(o1[key], o2[key])) { - return false; + if (o1 !== o1 && o2 !== o2) + return true; // NaN === NaN + var t1 = typeof o1, t2 = typeof o2, length, key, keySet; + if (t1 == t2 && t1 == 'object') { + if (Array.isArray(o1)) { + if (!Array.isArray(o2)) + return false; + if ((length = o1.length) == o2.length) { + for (key = 0; key < length; key++) { + if (!this.equals(o1[key], o2[key])) + return false; + } + return true; + } + } + else { + if (Array.isArray(o2)) { + return false; + } + keySet = Object.create(null); + for (key in o1) { + if (!this.equals(o1[key], o2[key])) { + return false; + } + keySet[key] = true; + } + for (key in o2) { + if (!(key in keySet) && typeof o2[key] !== 'undefined') { + return false; + } + } + return true; } - keySet[key] = true; } - for (key in o2) { - if (!(key in keySet) && typeof o2[key] !== 'undefined') { - return false; + return false; + }; + /* tslint:enable */ + TranslatePipe.prototype.updateValue = function (key, interpolateParams) { + var _this = this; + this.translate.get(key, interpolateParams).subscribe(function (res) { + _this.value = res ? res : key; + _this.lastKey = key; + _this._ref.markForCheck(); + }); + }; + TranslatePipe.prototype.transform = function (query) { + var _this = this; + var args = []; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; + } + if (!query || query.length === 0) { + return query; + } + // if we ask another time for the same key, return the last value + if (this.equals(query, this.lastKey) && this.equals(args, this.lastParams)) { + return this.value; + } + var interpolateParams; + if (args.length && args[0] !== null) { + if (typeof args[0] === 'string' && args[0].length) { + // we accept objects written in the template such as {n:1}, + // which is why we might need to change it to real JSON objects such as {"n":1} + try { + interpolateParams = JSON.parse(args[0].replace(/(['"])?([a-zA-Z0-9_]+)(['"])?:/g, '"$2": ')); + } + catch (e) { + throw new SyntaxError("Wrong parameter in TranslatePipe. Expected a valid Object, received: " + args[0]); + } + } + else if (typeof args[0] === 'object' && !Array.isArray(args[0])) { + interpolateParams = args[0]; } } - return true; - } - } - return false; - }; - /* tslint:enable */ - TranslatePipe.prototype.updateValue = function (key, interpolateParams) { - var _this = this; - this.translate.get(key, interpolateParams).subscribe(function (res) { - _this.value = res ? res : key; - _this.lastKey = key; - _this._ref.markForCheck(); - }); - }; - TranslatePipe.prototype.transform = function (query) { - var _this = this; - var args = []; - for (var _i = 1; _i < arguments.length; _i++) { - args[_i - 1] = arguments[_i]; - } - if (!query || query.length === 0) { - return query; - } - // if we ask another time for the same key, return the last value - if (this.equals(query, this.lastKey) && this.equals(args, this.lastParams)) { - return this.value; - } - var interpolateParams; - if (args.length && args[0] !== null) { - if (typeof args[0] === 'string' && args[0].length) { - // we accept objects written in the template such as {n:1}, - // which is why we might need to change it to real JSON objects such as {"n":1} - try { - interpolateParams = JSON.parse(args[0].replace(/(['"])?([a-zA-Z0-9_]+)(['"])?:/g, '"$2": ')); - } catch (e) { - throw new SyntaxError("Wrong parameter in TranslatePipe. Expected a valid Object, received: " + args[0]); - } - } else if (typeof args[0] === 'object' && !Array.isArray(args[0])) { - interpolateParams = args[0]; - } - } - // store the query, in case it changes - this.lastKey = query; - // store the params, in case they change - this.lastParams = args; - // set the value - this.updateValue(query, interpolateParams); - // if there is a subscription to onLangChange, clean it - this._dispose(); - // subscribe to onTranslationChange event, in case the translations change - if (!this.onTranslationChange) { - this.onTranslationChange = this.translate.onTranslationChange.subscribe(function (event) { - if (_this.lastKey && event.lang === _this.translate.currentLang) { - _this.lastKey = null; - _this.updateValue(query, interpolateParams); - } - }); - } - // subscribe to onLangChange event, in case the language changes - if (!this.onLangChange) { - this.onLangChange = this.translate.onLangChange.subscribe(function (event) { - if (_this.lastKey) { - _this.lastKey = null; // we want to make sure it doesn't return the same value until it's been updated - _this.updateValue(query, interpolateParams); - } - }); - } - return this.value; - }; - /** - * Clean any existing subscription to change events - * @private - */ - TranslatePipe.prototype._dispose = function () { - if (typeof this.onTranslationChange !== 'undefined') { - this.onTranslationChange.unsubscribe(); - this.onTranslationChange = undefined; - } - if (typeof this.onLangChange !== 'undefined') { - this.onLangChange.unsubscribe(); - this.onLangChange = undefined; - } - }; - TranslatePipe.prototype.ngOnDestroy = function () { - this._dispose(); - }; - TranslatePipe = __decorate([core_1.Injectable(), core_1.Pipe({ - name: 'translate', - pure: false // required to update the value when the promise is resolved - }), __metadata('design:paramtypes', [translate_service_1.TranslateService, core_1.ChangeDetectorRef])], TranslatePipe); - return TranslatePipe; - }(); - exports.TranslatePipe = TranslatePipe; - return module.exports; + // store the query, in case it changes + this.lastKey = query; + // store the params, in case they change + this.lastParams = args; + // set the value + this.updateValue(query, interpolateParams); + // if there is a subscription to onLangChange, clean it + this._dispose(); + // subscribe to onTranslationChange event, in case the translations change + if (!this.onTranslationChange) { + this.onTranslationChange = this.translate.onTranslationChange.subscribe(function (event) { + if (_this.lastKey && event.lang === _this.translate.currentLang) { + _this.lastKey = null; + _this.updateValue(query, interpolateParams); + } + }); + } + // subscribe to onLangChange event, in case the language changes + if (!this.onLangChange) { + this.onLangChange = this.translate.onLangChange.subscribe(function (event) { + if (_this.lastKey) { + _this.lastKey = null; // we want to make sure it doesn't return the same value until it's been updated + _this.updateValue(query, interpolateParams); + } + }); + } + return this.value; + }; + /** + * Clean any existing subscription to change events + * @private + */ + TranslatePipe.prototype._dispose = function () { + if (typeof this.onTranslationChange !== 'undefined') { + this.onTranslationChange.unsubscribe(); + this.onTranslationChange = undefined; + } + if (typeof this.onLangChange !== 'undefined') { + this.onLangChange.unsubscribe(); + this.onLangChange = undefined; + } + }; + TranslatePipe.prototype.ngOnDestroy = function () { + this._dispose(); + }; + TranslatePipe.decorators = [ + { type: core_1.Injectable }, + { type: core_1.Pipe, args: [{ + name: 'translate', + pure: false // required to update the value when the promise is resolved + },] }, + ]; + /** @nocollapse */ + TranslatePipe.ctorParameters = [ + { type: translate_service_1.TranslateService, }, + { type: core_1.ChangeDetectorRef, }, + ]; + return TranslatePipe; + }())); + } + } }); -System.registerDynamic("src/translate.service", ["@angular/core", "rxjs/Observable", "rxjs/add/observable/of", "rxjs/add/operator/share", "rxjs/add/operator/map", "rxjs/add/operator/merge", "rxjs/add/operator/toArray", "./translate.parser"], true, function ($__require, exports, module) { - "use strict"; - var define, - global = this || self, - GLOBAL = global; - var __decorate = this && this.__decorate || function (decorators, target, key, desc) { - var c = arguments.length, - r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, - d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; - }; - var __metadata = this && this.__metadata || function (k, v) { - if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); - }; - var __param = this && this.__param || function (paramIndex, decorator) { - return function (target, key) { - decorator(target, key, paramIndex); - }; - }; - var core_1 = $__require("@angular/core"); - var Observable_1 = $__require("rxjs/Observable"); - $__require("rxjs/add/observable/of"); - $__require("rxjs/add/operator/share"); - $__require("rxjs/add/operator/map"); - $__require("rxjs/add/operator/merge"); - $__require("rxjs/add/operator/toArray"); - var translate_parser_1 = $__require("./translate.parser"); - var MissingTranslationHandler = function () { - function MissingTranslationHandler() {} - return MissingTranslationHandler; - }(); - exports.MissingTranslationHandler = MissingTranslationHandler; - var TranslateLoader = function () { - function TranslateLoader() {} - return TranslateLoader; - }(); - exports.TranslateLoader = TranslateLoader; - var TranslateStaticLoader = function () { - function TranslateStaticLoader(http, prefix, suffix) { - if (prefix === void 0) { - prefix = "i18n"; - } - if (suffix === void 0) { - suffix = ".json"; - } - this.http = http; - this.prefix = prefix; - this.suffix = suffix; - } - /** - * Gets the translations from the server - * @param lang - * @returns {any} - */ - TranslateStaticLoader.prototype.getTranslation = function (lang) { - return this.http.get(this.prefix + "/" + lang + this.suffix).map(function (res) { - return res.json(); - }); - }; - return TranslateStaticLoader; - }(); - exports.TranslateStaticLoader = TranslateStaticLoader; - var TranslateService = function () { - /** - * - * @param http The Angular 2 http provider - * @param currentLoader An instance of the loader currently used - * @param missingTranslationHandler A handler for missing translations. - */ - function TranslateService(currentLoader, missingTranslationHandler) { - this.currentLoader = currentLoader; - this.missingTranslationHandler = missingTranslationHandler; - /** - * The lang currently used - */ - this.currentLang = this.defaultLang; - /** - * An EventEmitter to listen to translation change events - * onTranslationChange.subscribe((params: TranslationChangeEvent) => { - * // do something - * }); - * @type {ng.EventEmitter} - */ - this.onTranslationChange = new core_1.EventEmitter(); - /** - * An EventEmitter to listen to lang change events - * onLangChange.subscribe((params: LangChangeEvent) => { - * // do something - * }); - * @type {ng.EventEmitter} - */ - this.onLangChange = new core_1.EventEmitter(); - this.translations = {}; - this.langs = []; - this.parser = new translate_parser_1.Parser(); - } - /** - * Sets the default language to use as a fallback - * @param lang - */ - TranslateService.prototype.setDefaultLang = function (lang) { - this.defaultLang = lang; - }; - /** - * Changes the lang currently used - * @param lang - * @returns {Observable<*>} - */ - TranslateService.prototype.use = function (lang) { - var _this = this; - var pending; - // check if this language is available - if (typeof this.translations[lang] === "undefined") { - // not available, ask for it - pending = this.getTranslation(lang); - } - if (typeof pending !== "undefined") { - // on init set the currentLang immediately - if (!this.currentLang) { - this.currentLang = lang; +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHJhbnNsYXRlLnBpcGUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJ0cmFuc2xhdGUucGlwZS5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7O1FBRVcsYUFBYTs7Ozs7Ozs7OztZQUFiLDJCQUFBLGFBQWEsR0FBRyxDQUFDO2dCQUN4Qix1QkFBdUIsU0FBUyxFQUFFLElBQUk7b0JBQ2xDLElBQUksQ0FBQyxTQUFTLEdBQUcsU0FBUyxDQUFDO29CQUMzQixJQUFJLENBQUMsSUFBSSxHQUFHLElBQUksQ0FBQztvQkFDakIsSUFBSSxDQUFDLEtBQUssR0FBRyxFQUFFLENBQUM7Z0JBQ3BCLENBQUM7Z0JBQ0Qsb0JBQW9CO2dCQUNwQjs7Ozs7Ozs7Ozs7Ozs7O21CQWVHO2dCQUNILGFBQWEsQ0FBQyxTQUFTLENBQUMsTUFBTSxHQUFHLFVBQVUsRUFBRSxFQUFFLEVBQUU7b0JBQzdDLEVBQUUsQ0FBQyxDQUFDLEVBQUUsS0FBSyxFQUFFLENBQUM7d0JBQ1YsTUFBTSxDQUFDLElBQUksQ0FBQztvQkFDaEIsRUFBRSxDQUFDLENBQUMsRUFBRSxLQUFLLElBQUksSUFBSS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QUUsQ0FBQztnQkFDcEIsQ0FBQyxDQUFDO2dCQUNGLGFBQWEsQ0FBQyxVQUFVLEdBQUc7b0JBQ3ZCLEVBQUUsSUFBSSxFQUFFLGlCQUFVLEVBQUU7b0JBQ3BCLEVBQUUsSUFBSSxFQUFFLFdBQUksRUFBRSxJQUFJLEVBQUUsQ0FBQztnQ0FDVCxJQUFJLEVBQUUsV0FBVztnQ0FDakIsSUFBSSxFQUFFLEtBQUssQ0FBQyw0REFBNEQ7NkJBQzNFLEVBQUUsRUFBRTtpQkFDaEIsQ0FBQztnQkFDRixrQkFBa0I7Z0JBQ2xCLGFBQWEsQ0FBQyxjQUFjLEdBQUc7b0JBQzNCLEVBQUUsSUFBSSxFQUFFLG9DQUFnQixHQUFHO29CQUMzQixFQUFFLElBQUksRUFBRSx3QkFBaUIsR0FBRztpQkFDL0IsQ0FBQztnQkFDRixNQUFNLENBQUMsYUFBYSxDQUFDO1lBQ3pCLENBQUMsRUFBRSxDQUFDLENBQUEsQ0FBQzs7OztBQUNMLDg2ZUFBODZlIn0= +$__System.register("4", ["3", "5", "6", "7", "8", "9", "a", "b"], function(exports_1, context_1) { + "use strict"; + var __moduleName = context_1 && context_1.id; + var core_1, Observable_1, translate_parser_1; + var MissingTranslationHandler, TranslateLoader, TranslateStaticLoader, TranslateService; + return { + setters:[ + function (core_1_1) { + core_1 = core_1_1; + }, + function (Observable_1_1) { + Observable_1 = Observable_1_1; + }, + function (_1) {}, + function (_2) {}, + function (_3) {}, + function (_4) {}, + function (_5) {}, + function (translate_parser_1_1) { + translate_parser_1 = translate_parser_1_1; + }], + execute: function() { + exports_1("MissingTranslationHandler", MissingTranslationHandler = (function () { + function MissingTranslationHandler() { } - pending.subscribe(function (res) { - _this.changeLang(lang); - }); - return pending; - } else { - this.changeLang(lang); - return Observable_1.Observable.of(this.translations[lang]); - } - }; - /** - * Gets an object of translations for a given language with the current loader - * @param lang - * @returns {Observable<*>} - */ - TranslateService.prototype.getTranslation = function (lang) { - var _this = this; - this.pending = this.currentLoader.getTranslation(lang).share(); - this.pending.subscribe(function (res) { - _this.translations[lang] = res; - _this.updateLangs(); - }, function (err) { - throw err; - }, function () { - _this.pending = undefined; - }); - return this.pending; - }; - /** - * Manually sets an object of translations for a given language - * @param lang - * @param translations - * @param shouldMerge - */ - TranslateService.prototype.setTranslation = function (lang, translations, shouldMerge) { - if (shouldMerge === void 0) { - shouldMerge = false; - } - if (shouldMerge && this.translations[lang]) { - Object.assign(this.translations[lang], translations); - this.onTranslationChange.emit({ translations: translations, lang: lang }); - } else { - this.translations[lang] = translations; - } - this.updateLangs(); - }; - /** - * Returns an array of currently available langs - * @returns {any} - */ - TranslateService.prototype.getLangs = function () { - return this.langs; - }; - /** - * @param langs - * Add available langs - */ - TranslateService.prototype.addLangs = function (langs) { - var _this = this; - langs.forEach(function (lang) { - if (_this.langs.indexOf(lang) === -1) { - _this.langs.push(lang); + return MissingTranslationHandler; + }())); + exports_1("TranslateLoader", TranslateLoader = (function () { + function TranslateLoader() { } - }); - }; - /** - * Update the list of available langs - */ - TranslateService.prototype.updateLangs = function () { - this.addLangs(Object.keys(this.translations)); - }; - /** - * Returns the parsed result of the translations - * @param translations - * @param key - * @param interpolateParams - * @returns {any} - */ - TranslateService.prototype.getParsedResult = function (translations, key, interpolateParams) { - var res; - if (key instanceof Array) { - var result = {}, - observables = false; - for (var _i = 0, key_1 = key; _i < key_1.length; _i++) { - var k = key_1[_i]; - result[k] = this.getParsedResult(translations, k, interpolateParams); - if (typeof result[k].subscribe === "function") { - observables = true; + return TranslateLoader; + }())); + exports_1("TranslateStaticLoader", TranslateStaticLoader = (function () { + function TranslateStaticLoader(http, prefix, suffix) { + if (prefix === void 0) { + prefix = "i18n"; + } + if (suffix === void 0) { + suffix = ".json"; } + this.http = http; + this.prefix = prefix; + this.suffix = suffix; } - if (observables) { - var mergedObs = void 0; - for (var _a = 0, key_2 = key; _a < key_2.length; _a++) { - var k = key_2[_a]; - var obs = typeof result[k].subscribe === "function" ? result[k] : Observable_1.Observable.of(result[k]); - if (typeof mergedObs === "undefined") { - mergedObs = obs; - } else { - mergedObs = mergedObs.merge(obs); - } + /** + * Gets the translations from the server + * @param lang + * @returns {any} + */ + TranslateStaticLoader.prototype.getTranslation = function (lang) { + return this.http.get(this.prefix + "/" + lang + this.suffix) + .map(function (res) { return res.json(); }); + }; + return TranslateStaticLoader; + }())); + exports_1("TranslateService", TranslateService = (function () { + /** + * + * @param http The Angular 2 http provider + * @param currentLoader An instance of the loader currently used + * @param missingTranslationHandler A handler for missing translations. + */ + function TranslateService(currentLoader, missingTranslationHandler) { + this.currentLoader = currentLoader; + this.missingTranslationHandler = missingTranslationHandler; + /** + * The lang currently used + */ + this.currentLang = this.defaultLang; + /** + * An EventEmitter to listen to translation change events + * onTranslationChange.subscribe((params: TranslationChangeEvent) => { + * // do something + * }); + * @type {ng.EventEmitter} + */ + this.onTranslationChange = new core_1.EventEmitter(); + /** + * An EventEmitter to listen to lang change events + * onLangChange.subscribe((params: LangChangeEvent) => { + * // do something + * }); + * @type {ng.EventEmitter} + */ + this.onLangChange = new core_1.EventEmitter(); + this.translations = {}; + this.langs = []; + this.parser = new translate_parser_1.Parser(); + } + /** + * Sets the default language to use as a fallback + * @param lang + */ + TranslateService.prototype.setDefaultLang = function (lang) { + this.defaultLang = lang; + }; + /** + * Changes the lang currently used + * @param lang + * @returns {Observable<*>} + */ + TranslateService.prototype.use = function (lang) { + var _this = this; + var pending; + // check if this language is available + if (typeof this.translations[lang] === "undefined") { + // not available, ask for it + pending = this.getTranslation(lang); } - return mergedObs.toArray().map(function (arr) { - var obj = {}; - arr.forEach(function (value, index) { - obj[key[index]] = value; + if (typeof pending !== "undefined") { + // on init set the currentLang immediately + if (!this.currentLang) { + this.currentLang = lang; + } + pending.subscribe(function (res) { + _this.changeLang(lang); }); - return obj; + return pending; + } + else { + this.changeLang(lang); + return Observable_1.Observable.of(this.translations[lang]); + } + }; + /** + * Gets an object of translations for a given language with the current loader + * @param lang + * @returns {Observable<*>} + */ + TranslateService.prototype.getTranslation = function (lang) { + var _this = this; + this.pending = this.currentLoader.getTranslation(lang).share(); + this.pending.subscribe(function (res) { + _this.translations[lang] = res; + _this.updateLangs(); + }, function (err) { + throw err; + }, function () { + _this.pending = undefined; }); - } - return result; - } - if (translations) { - res = this.parser.interpolate(this.parser.getValue(translations, key), interpolateParams); - } - if (typeof res === "undefined" && this.defaultLang && this.defaultLang !== this.currentLang) { - res = this.parser.interpolate(this.parser.getValue(this.translations[this.defaultLang], key), interpolateParams); - } - if (!res && this.missingTranslationHandler) { - res = this.missingTranslationHandler.handle(key); - } - return res || key; - }; - /** - * Gets the translated value of a key (or an array of keys) - * @param key - * @param interpolateParams - * @returns {any} the translated key, or an object of translated keys - */ - TranslateService.prototype.get = function (key, interpolateParams) { - var _this = this; - if (!key) { - throw new Error("Parameter \"key\" required"); - } - // check if we are loading a new translation to use - if (this.pending) { - return Observable_1.Observable.create(function (observer) { - var onComplete = function (res) { - observer.next(res); - observer.complete(); - }; - _this.pending.subscribe(function (res) { - res = _this.getParsedResult(res, key, interpolateParams); - if (typeof res.subscribe === "function") { - res.subscribe(onComplete); - } else { - onComplete(res); + return this.pending; + }; + /** + * Manually sets an object of translations for a given language + * @param lang + * @param translations + * @param shouldMerge + */ + TranslateService.prototype.setTranslation = function (lang, translations, shouldMerge) { + if (shouldMerge === void 0) { + shouldMerge = false; + } + if (shouldMerge && this.translations[lang]) { + Object.assign(this.translations[lang], translations); + this.onTranslationChange.emit({ translations: translations, lang: lang }); + } + else { + this.translations[lang] = translations; + } + this.updateLangs(); + }; + /** + * Returns an array of currently available langs + * @returns {any} + */ + TranslateService.prototype.getLangs = function () { + return this.langs; + }; + /** + * @param langs + * Add available langs + */ + TranslateService.prototype.addLangs = function (langs) { + var _this = this; + langs.forEach(function (lang) { + if (_this.langs.indexOf(lang) === -1) { + _this.langs.push(lang); } }); - }); - } else { - var res = this.getParsedResult(this.translations[this.currentLang], key, interpolateParams); - if (typeof res.subscribe === "function") { - return res; - } else { - return Observable_1.Observable.of(res); - } - } - }; - /** - * Returns a translation instantly from the internal state of loaded translation. - * All rules regarding the current language, the preferred language of even fallback languages will be used except any promise handling. - * @param key - * @param interpolateParams - * @returns {string} - */ - TranslateService.prototype.instant = function (key, interpolateParams) { - if (!key) { - throw new Error("Parameter \"key\" required"); - } - var res = this.getParsedResult(this.translations[this.currentLang], key, interpolateParams); - if (typeof res.subscribe !== "undefined") { - if (key instanceof Array) { - var obj_1 = {}; - key.forEach(function (value, index) { - obj_1[key[index]] = key[index]; - }); - return obj_1; - } - return key; - } else { - return res; - } - }; - /** - * Sets the translated value of a key - * @param key - * @param value - * @param lang - */ - TranslateService.prototype.set = function (key, value, lang) { - if (lang === void 0) { - lang = this.currentLang; - } - this.translations[lang][key] = value; - this.updateLangs(); - this.onTranslationChange.emit({ translations: (_a = {}, _a[key] = value, _a), lang: lang }); - var _a; - }; - /** - * Changes the current lang - * @param lang - */ - TranslateService.prototype.changeLang = function (lang) { - this.currentLang = lang; - this.onLangChange.emit({ lang: lang, translations: this.translations[lang] }); - }; - /** - * Allows to reload the lang file from the file - * @param lang - * @returns {Observable} - */ - TranslateService.prototype.reloadLang = function (lang) { - this.resetLang(lang); - return this.getTranslation(lang); - }; - /** - * Deletes inner translation - * @param lang - */ - TranslateService.prototype.resetLang = function (lang) { - this.translations[lang] = undefined; - }; - TranslateService.prototype.getBrowserLang = function () { - if (typeof window === 'undefined' || typeof window.navigator === 'undefined') { - return undefined; - } - var browserLang = window.navigator.languages ? window.navigator.languages[0] : null; - browserLang = browserLang || window.navigator.language || window.navigator.browserLanguage || window.navigator.userLanguage; - if (browserLang.indexOf('-') !== -1) { - browserLang = browserLang.split('-')[0]; - } - if (browserLang.indexOf('_') !== -1) { - browserLang = browserLang.split('_')[0]; - } - return browserLang; - }; - TranslateService = __decorate([core_1.Injectable(), __param(1, core_1.Optional()), __metadata('design:paramtypes', [TranslateLoader, MissingTranslationHandler])], TranslateService); - return TranslateService; - }(); - exports.TranslateService = TranslateService; - return module.exports; + }; + /** + * Update the list of available langs + */ + TranslateService.prototype.updateLangs = function () { + this.addLangs(Object.keys(this.translations)); + }; + /** + * Returns the parsed result of the translations + * @param translations + * @param key + * @param interpolateParams + * @returns {any} + */ + TranslateService.prototype.getParsedResult = function (translations, key, interpolateParams) { + var res; + if (key instanceof Array) { + var result = {}, observables = false; + for (var _i = 0, key_1 = key; _i < key_1.length; _i++) { + var k = key_1[_i]; + result[k] = this.getParsedResult(translations, k, interpolateParams); + if (typeof result[k].subscribe === "function") { + observables = true; + } + } + if (observables) { + var mergedObs = void 0; + for (var _a = 0, key_2 = key; _a < key_2.length; _a++) { + var k = key_2[_a]; + var obs = typeof result[k].subscribe === "function" ? result[k] : Observable_1.Observable.of(result[k]); + if (typeof mergedObs === "undefined") { + mergedObs = obs; + } + else { + mergedObs = mergedObs.merge(obs); + } + } + return mergedObs.toArray().map(function (arr) { + var obj = {}; + arr.forEach(function (value, index) { + obj[key[index]] = value; + }); + return obj; + }); + } + return result; + } + if (translations) { + res = this.parser.interpolate(this.parser.getValue(translations, key), interpolateParams); + } + if (typeof res === "undefined" && this.defaultLang && this.defaultLang !== this.currentLang) { + res = this.parser.interpolate(this.parser.getValue(this.translations[this.defaultLang], key), interpolateParams); + } + if (!res && this.missingTranslationHandler) { + res = this.missingTranslationHandler.handle(key); + } + return res || key; + }; + /** + * Gets the translated value of a key (or an array of keys) + * @param key + * @param interpolateParams + * @returns {any} the translated key, or an object of translated keys + */ + TranslateService.prototype.get = function (key, interpolateParams) { + var _this = this; + if (!key) { + throw new Error("Parameter \"key\" required"); + } + // check if we are loading a new translation to use + if (this.pending) { + return Observable_1.Observable.create(function (observer) { + var onComplete = function (res) { + observer.next(res); + observer.complete(); + }; + _this.pending.subscribe(function (res) { + res = _this.getParsedResult(res, key, interpolateParams); + if (typeof res.subscribe === "function") { + res.subscribe(onComplete); + } + else { + onComplete(res); + } + }); + }); + } + else { + var res = this.getParsedResult(this.translations[this.currentLang], key, interpolateParams); + if (typeof res.subscribe === "function") { + return res; + } + else { + return Observable_1.Observable.of(res); + } + } + }; + /** + * Returns a translation instantly from the internal state of loaded translation. + * All rules regarding the current language, the preferred language of even fallback languages will be used except any promise handling. + * @param key + * @param interpolateParams + * @returns {string} + */ + TranslateService.prototype.instant = function (key, interpolateParams) { + if (!key) { + throw new Error("Parameter \"key\" required"); + } + var res = this.getParsedResult(this.translations[this.currentLang], key, interpolateParams); + if (typeof res.subscribe !== "undefined") { + if (key instanceof Array) { + var obj_1 = {}; + key.forEach(function (value, index) { + obj_1[key[index]] = key[index]; + }); + return obj_1; + } + return key; + } + else { + return res; + } + }; + /** + * Sets the translated value of a key + * @param key + * @param value + * @param lang + */ + TranslateService.prototype.set = function (key, value, lang) { + if (lang === void 0) { + lang = this.currentLang; + } + this.translations[lang][key] = value; + this.updateLangs(); + this.onTranslationChange.emit({ translations: (_a = {}, _a[key] = value, _a), lang: lang }); + var _a; + }; + /** + * Changes the current lang + * @param lang + */ + TranslateService.prototype.changeLang = function (lang) { + this.currentLang = lang; + this.onLangChange.emit({ lang: lang, translations: this.translations[lang] }); + }; + /** + * Allows to reload the lang file from the file + * @param lang + * @returns {Observable} + */ + TranslateService.prototype.reloadLang = function (lang) { + this.resetLang(lang); + return this.getTranslation(lang); + }; + /** + * Deletes inner translation + * @param lang + */ + TranslateService.prototype.resetLang = function (lang) { + this.translations[lang] = undefined; + }; + TranslateService.prototype.getBrowserLang = function () { + if (typeof window === 'undefined' || typeof window.navigator === 'undefined') { + return undefined; + } + var browserLang = window.navigator.languages ? window.navigator.languages[0] : null; + browserLang = browserLang || window.navigator.language || window.navigator.browserLanguage || window.navigator.userLanguage; + if (browserLang.indexOf('-') !== -1) { + browserLang = browserLang.split('-')[0]; + } + if (browserLang.indexOf('_') !== -1) { + browserLang = browserLang.split('_')[0]; + } + return browserLang; + }; + TranslateService.decorators = [ + { type: core_1.Injectable }, + ]; + /** @nocollapse */ + TranslateService.ctorParameters = [ + { type: TranslateLoader, }, + { type: MissingTranslationHandler, decorators: [{ type: core_1.Optional },] }, + ]; + return TranslateService; + }())); + } + } }); -System.registerDynamic('src/translate.parser', [], true, function ($__require, exports, module) { - "use strict"; - var define, - global = this || self, - GLOBAL = global; - var Parser = function () { - function Parser() { - this.templateMatcher = /{{\s?([^{}\s]*)\s?}}/g; - } - /** - * Interpolates a string to replace parameters - * "This is a {{ key }}" ==> "This is a value", with params = { key: "value" } - * @param expr - * @param params - * @returns {string} - */ - Parser.prototype.interpolate = function (expr, params) { - var _this = this; - if (typeof expr !== 'string' || !params) { - return expr; - } - return expr.replace(this.templateMatcher, function (substring, b) { - var r = _this.getValue(params, b); - return typeof r !== 'undefined' ? r : substring; - }); - }; - /** - * Gets a value from an object by composed key - * parser.getValue({ key1: { keyA: 'valueI' }}, 'key1.keyA') ==> 'valueI' - * @param target - * @param key - * @returns {string} - */ - Parser.prototype.getValue = function (target, key) { - var keys = key.split('.'); - key = ''; - do { - key += keys.shift(); - if (target !== undefined && target[key] !== undefined && (typeof target[key] === 'object' || !keys.length)) { - target = target[key]; - key = ''; - } else if (!keys.length) { - target = undefined; - } else { - key += '.'; +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHJhbnNsYXRlLnNlcnZpY2UuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJ0cmFuc2xhdGUuc2VydmljZS5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7O1FBUVcseUJBQXlCLEVBS3pCLGVBQWUsRUFLZixxQkFBcUIsRUFtQnJCLGdCQUFnQjs7Ozs7Ozs7Ozs7Ozs7Ozs7O1lBN0JoQix1Q0FBQSx5QkFBeUIsR0FBRyxDQUFDO2dCQUNwQztnQkFDQSxDQUFDO2dCQUNELE1BQU0sQ0FBQyx5QkFBeUIsQ0FBQztZQUNyQyxDQUFDLEVBQUUsQ0FBQyxDQUFBLENBQUM7WUFDTSw2QkFBQSxlQUFlLE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FLLENBQUMsR0FBRyxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUM7b0JBQzVDLENBQUM7b0JBQ0QsRUFBRSxDQUFDLENBQUMsV0FBVyxDQUFDLE9BQU8sQ0FBQyxHQUFHLENBQUMsS0FBSyxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUM7d0JBQ2xDLFdBQVcsR0FBRyxXQUFXLENBQUMsS0FBSyxDQUFDLEdBQUcsQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDO29CQUM1QyxDQUFDO29CQUNELE1BQU0sQ0FBQyxXQUFXLENBQUM7Z0JBQ3ZCLENBQUMsQ0FBQztnQkFDRixnQkFBZ0IsQ0FBQyxVQUFVLEdBQUc7b0JBQzFCLEVBQUUsSUFBSSxFQUFFLGlCQUFVLEVBQUU7aUJBQ3ZCLENBQUM7Z0JBQ0Ysa0JBQWtCO2dCQUNsQixnQkFBZ0IsQ0FBQyxjQUFjLEdBQUc7b0JBQzlCLEVBQUUsSUFBSSxFQUFFLGVBQWUsR0FBRztvQkFDMUIsRUFBRSxJQUFJLEVBQUUseUJBQXlCLEVBQUUsVUFBVSxFQUFFLENBQUMsRUFBRSxJQUFJLEVBQUUsZUFBUSxFQUFFLEVBQUUsRUFBRTtpQkFDekUsQ0FBQztnQkFDRixNQUFNLENBQUMsZ0JBQWdCLENBQUM7WUFDNUIsQ0FBQyxFQUFFLENBQUMsQ0FBQSxDQUFDOzs7O0FBQ0wscys1QkFBcys1QiJ9 +$__System.register("b", [], function(exports_1, context_1) { + "use strict"; + var __moduleName = context_1 && context_1.id; + var Parser; + return { + setters:[], + execute: function() { + exports_1("Parser", Parser = (function () { + function Parser() { + this.templateMatcher = /{{\s?([^{}\s]*)\s?}}/g; } - } while (keys.length); - return target; - }; - return Parser; - }(); - exports.Parser = Parser; - return module.exports; + /** + * Interpolates a string to replace parameters + * "This is a {{ key }}" ==> "This is a value", with params = { key: "value" } + * @param expr + * @param params + * @returns {string} + */ + Parser.prototype.interpolate = function (expr, params) { + var _this = this; + if (typeof expr !== 'string' || !params) { + return expr; + } + return expr.replace(this.templateMatcher, function (substring, b) { + var r = _this.getValue(params, b); + return typeof r !== 'undefined' ? r : substring; + }); + }; + /** + * Gets a value from an object by composed key + * parser.getValue({ key1: { keyA: 'valueI' }}, 'key1.keyA') ==> 'valueI' + * @param target + * @param key + * @returns {string} + */ + Parser.prototype.getValue = function (target, key) { + var keys = key.split('.'); + key = ''; + do { + key += keys.shift(); + if (target !== undefined && target[key] !== undefined && (typeof target[key] === 'object' || !keys.length)) { + target = target[key]; + key = ''; + } + else if (!keys.length) { + target = undefined; + } + else { + key += '.'; + } + } while (keys.length); + return target; + }; + return Parser; + }())); + } + } }); -System.registerDynamic("ng2-translate", ["@angular/core", "@angular/http", "./src/translate.pipe", "./src/translate.service", "./src/translate.parser"], true, function ($__require, exports, module) { - "use strict"; - var define, - global = this || self, - GLOBAL = global; - var __decorate = this && this.__decorate || function (decorators, target, key, desc) { - var c = arguments.length, - r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, - d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; - }; - var __metadata = this && this.__metadata || function (k, v) { - if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); - }; - function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; - } - var core_1 = $__require("@angular/core"); - var http_1 = $__require("@angular/http"); - var translate_pipe_1 = $__require("./src/translate.pipe"); - var translate_service_1 = $__require("./src/translate.service"); - __export($__require("./src/translate.pipe")); - __export($__require("./src/translate.service")); - __export($__require("./src/translate.parser")); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.default = { - pipes: [translate_pipe_1.TranslatePipe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UUsR0FBRztvQkFDN0MsSUFBSSxJQUFJLEdBQUcsR0FBRyxDQUFDLEtBQUssQ0FBQyxHQUFHLENBQUMsQ0FBQztvQkFDMUIsR0FBRyxHQUFHLEVBQUUsQ0FBQztvQkFDVCxHQUFHLENBQUM7d0JBQ0EsR0FBRyxJQUFJLElBQUksQ0FBQyxLQUFLLEVBQUUsQ0FBQzt3QkFDcEIsRUFBRSxDQUFDLENBQUMsTUFBTSxLQUFLLFNBQVMsSUFBSSxNQUFNLENBQUMsR0FBRyxDQUFDLEtBQUssU0FBUyxJQUFJLENBQUMsT0FBTyxNQUFNLENBQUMsR0FBRyxDQUFDLEtBQUssUUFBUSxJQUFJLENBQUMsSUFBSSxDQUFDLE1BQU0sQ0FBQyxDQUFDLENBQUMsQ0FBQzs0QkFDekcsTUFBTSxHQUFHLE1BQU0sQ0FBQyxHQUFHLENBQUMsQ0FBQzs0QkFDckIsR0FBRyxHQUFHLEVBQUUsQ0FBQzt3QkFDYixDQUFDO3dCQUNELElBQUksQ0FBQyxFQUFFLENBQUMsQ0FBQyxDQUFDLElBQUksQ0FBQyxNQUFNLENBQUMsQ0FBQyxDQUFDOzRCQUNwQixNQUFNLEdBQUcsU0FBUyxDQUFDO3dCQUN2QixDQUFDO3dCQUNELElBQUksQ0FBQyxDQUFDOzRCQUNGLEdBQUcsSUFBSSxHQUFHLENBQUM7d0JBQ2YsQ0FBQztvQkFDTCxDQUFDLFFBQVEsSUFBSSxDQUFDLE1BQU0sRUFBRTtvQkFDdEIsTUFBTSxDQUFDLE1BQU0sQ0FBQztnQkFDbEIsQ0FBQyxDQUFDO2dCQUNGLE1BQU0sQ0FBQyxNQUFNLENBQUM7WUFDbEIsQ0FBQyxFQUFFLENBQUMsQ0FBQSxDQUFDOzs7O0FBQ0wsczNIQUFzM0gifQ== +$__System.register("1", ["3", "c", "2", "4", "b"], function(exports_1, context_1) { + "use strict"; + var __moduleName = context_1 && context_1.id; + var core_1, http_1, translate_pipe_1, translate_service_1; + var TranslateModule; function translateLoaderFactory(http) { return new translate_service_1.TranslateStaticLoader(http); } - exports.translateLoaderFactory = translateLoaderFactory; - var TranslateModule = function () { - function TranslateModule() {} - TranslateModule.forRoot = function (providedLoader) { - if (providedLoader === void 0) { - providedLoader = { - provide: translate_service_1.TranslateLoader, - useFactory: translateLoaderFactory, - deps: [http_1.Http] + exports_1("translateLoaderFactory", translateLoaderFactory); + var exportedNames_1 = { + 'TranslateModule': true, + 'translateLoaderFactory': true + }; + function exportStar_1(m) { + var exports = {}; + for(var n in m) { + if (n !== "default"&& !exportedNames_1.hasOwnProperty(n)) exports[n] = m[n]; + } + exports_1(exports); + } + return { + setters:[ + function (core_1_1) { + core_1 = core_1_1; + }, + function (http_1_1) { + http_1 = http_1_1; + }, + function (translate_pipe_1_1) { + translate_pipe_1 = translate_pipe_1_1; + exportStar_1(translate_pipe_1_1); + }, + function (translate_service_1_1) { + translate_service_1 = translate_service_1_1; + exportStar_1(translate_service_1_1); + }, + function (translate_parser_1_1) { + exportStar_1(translate_parser_1_1); + }], + execute: function() { + exports_1("TranslateModule", TranslateModule = (function () { + function TranslateModule() { + } + TranslateModule.forRoot = function (providedLoader) { + if (providedLoader === void 0) { + providedLoader = { + provide: translate_service_1.TranslateLoader, + useFactory: translateLoaderFactory, + deps: [http_1.Http] + }; + } + return { + ngModule: TranslateModule, + providers: [providedLoader, translate_service_1.TranslateService] + }; }; - } - return { - ngModule: TranslateModule, - providers: [providedLoader, translate_service_1.TranslateService] - }; - }; - TranslateModule = __decorate([core_1.NgModule({ - imports: [http_1.HttpModule], - declarations: [translate_pipe_1.TranslatePipe], - exports: [http_1.HttpModule, translate_pipe_1.TranslatePipe] - }), __metadata('design:paramtypes', [])], TranslateModule); - return TranslateModule; - }(); - exports.TranslateModule = TranslateModule; - return module.exports; + TranslateModule.decorators = [ + { type: core_1.NgModule, args: [{ + imports: [http_1.HttpModule], + declarations: [ + translate_pipe_1.TranslatePipe + ], + exports: [ + http_1.HttpModule, + translate_pipe_1.TranslatePipe + ] + },] }, + ]; + /** @nocollapse */ + TranslateModule.ctorParameters = []; + return TranslateModule; + }())); + } + } +}); + +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmcyLXRyYW5zbGF0ZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIm5nMi10cmFuc2xhdGUuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7OztRQVVXLGVBQWU7SUFIMUIsZ0NBQXVDLElBQUk7UUFDdkMsTUFBTSxDQUFDLElBQUkseUNBQXFCLENBQUMsSUFBSSxDQUFDLENBQUM7SUFDM0MsQ0FBQztJQUZELDJEQUVDLENBQUE7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7O1lBQ1UsNkJBQUEsZUFBZSxHQUFHLENBQUM7Z0JBQzFCO2dCQUNBLENBQUM7Z0JBQ0QsZUFBZSxDQUFDLE9BQU8sR0FBRyxVQUFVLGNBQWM7b0JBQzlDLEVBQUUsQ0FBQyxDQUFDLGNBQWMsS0FBSyxLQUFLLENBQUMsQ0FBQyxDQUFDLENBQUM7d0JBQUMsY0FBYyxHQUFHOzRCQUM5QyxPQUFPLEVBQUUsbUNBQWU7NEJBQ3hCLFVBQVUsRUFBRSxzQkFBc0I7NEJBQ2xDLElBQUksRUFBRSxDQUFDLFdBQUksQ0FBQzt5QkFDZixDQUFDO29CQUFDLENBQUM7b0JBQ0osTUFBTSxDQUFDO3dCQUNILFFBQVEsRUFBRSxlQUFlO3dCQUN6QixTQUFTLEVBQUUsQ0FBQyxjQUFjLEVBQUUsb0NBQWdCLENBQUM7cUJBQ2hELENBQUM7Z0JBQ04sQ0FBQyxDQUFDO2dCQUNGLGVBQWUsQ0FBQyxVQUFVLEdBQUc7b0JBQ3pCLEVBQUUsSUFBSSxFQUFFLGVBQVEsRUFBRSxJQUFJLEVBQUUsQ0FBQztnQ0FDYixPQUFPLEVBQUUsQ0FBQyxpQkFBVSxDQUFDO2dDQUNyQixZQUFZLEVBQUU7b0NBQ1YsOEJBQWE7aUNBQ2hCO2dDQUNELE9BQU8sRUFBRTtvQ0FDTCxpQkFBVTtvQ0FDViw4QkFBYTtpQ0FDaEI7NkJBQ0osRUFBRSxFQUFFO2lCQUNoQixDQUFDO2dCQUNGLGtCQUFrQjtnQkFDbEIsZUFBZSxDQUFDLGNBQWMsR0FBRyxFQUFFLENBQUM7Z0JBQ3BDLE1BQU0sQ0FBQyxlQUFlLENBQUM7WUFDM0IsQ0FBQyxFQUFFLENBQUMsQ0FBQSxDQUFDOzs7O0FBQ0wsc25HQUFzbkcifQ== +}) +(function(factory) { + if (typeof define == 'function' && define.amd) + define(["@angular/core","@angular/http","rxjs/Observable","rxjs/add/observable/of","rxjs/add/operator/map","rxjs/add/operator/merge","rxjs/add/operator/share","rxjs/add/operator/toArray"], factory); + else if (typeof module == 'object' && module.exports && typeof require == 'function') + module.exports = factory(require("@angular/core"), require("@angular/http"), require("rxjs/Observable"), require("rxjs/add/observable/of"), require("rxjs/add/operator/map"), require("rxjs/add/operator/merge"), require("rxjs/add/operator/share"), require("rxjs/add/operator/toArray")); + else + throw new Error("Module must be loaded as AMD or CommonJS"); }); \ No newline at end of file diff --git a/package.json b/package.json index 2d56f642..c6a4b04d 100644 --- a/package.json +++ b/package.json @@ -32,24 +32,25 @@ "@angular/http": "~2.0.0" }, "devDependencies": { - "@angular/common": "2.0.0", - "@angular/compiler": "2.0.0", + "@angular/common": "2.0.1", + "@angular/compiler": "2.0.1", "@angular/compiler-cli": "^0.6.3", - "@angular/core": "2.0.0", - "@angular/http": "2.0.0", - "@angular/platform-browser": "2.0.0", - "@angular/platform-browser-dynamic": "2.0.0", - "@types/hammerjs": "2.0.32", - "@types/jasmine": "2.2.33", - "@types/node": "6.0.38", + "@angular/core": "2.0.1", + "@angular/http": "2.0.1", + "@angular/platform-browser": "2.0.1", + "@angular/platform-browser-dynamic": "2.0.1", + "@angular/platform-server": "2.0.1", + "@types/hammerjs": "2.0.33", + "@types/jasmine": "2.2.34", + "@types/node": "6.0.41", "awesome-typescript-loader": "2.2.4", - "codelyzer": "0.0.28", + "codelyzer": "1.0.0-beta.0", "commitizen": "2.8.6", - "concurrently": "2.2.0", + "concurrently": "3.0.0", "core-js": "2.4.1", "cz-conventional-changelog": "1.2.0", "istanbul-instrumenter-loader": "0.2.0", - "jasmine-core": "2.5.1", + "jasmine-core": "2.5.2", "karma": "1.3.0", "karma-chrome-launcher": "2.0.0", "karma-coverage": "1.1.1", @@ -61,14 +62,14 @@ "rxjs": "5.0.0-beta.12", "semantic-release": "4.3.5", "source-map-loader": "0.1.5", - "systemjs": "0.19.38", - "systemjs-builder": "0.15.31", + "systemjs": "0.19.39", + "systemjs-builder": "0.15.32", "ts-helpers": "1.1.1", "tslint": "3.15.1", "tslint-loader": "2.1.5", - "typescript": "2.0.2", + "typescript": "2.0.3", "webpack": "2.1.0-beta.21", - "zone.js": "0.6.22" + "zone.js": "0.6.25" }, "config": { "commitizen": {