@lxlib/theme
Version:
This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 9.1.1.
97 lines • 6.54 kB
JavaScript
/**
* @fileoverview added by tsickle
* Generated from: src/locale/locale.service.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
import { Inject, Injectable, Optional, SkipSelf } from '@angular/core';
import { BehaviorSubject } from 'rxjs';
import zhCN from './languages/zh-CN';
import { LXLIB_LOCALE } from './locale.tokens';
var LxlibLocaleService = /** @class */ (function () {
function LxlibLocaleService(locale) {
this.change$ = new BehaviorSubject(this._locale);
this.setLocale(locale || zhCN);
}
Object.defineProperty(LxlibLocaleService.prototype, "change", {
get: /**
* @return {?}
*/
function () {
return this.change$.asObservable();
},
enumerable: true,
configurable: true
});
/**
* @param {?} locale
* @return {?}
*/
LxlibLocaleService.prototype.setLocale = /**
* @param {?} locale
* @return {?}
*/
function (locale) {
if (this._locale && this._locale.abbr === locale.abbr) {
return;
}
this._locale = locale;
this.change$.next(locale);
};
Object.defineProperty(LxlibLocaleService.prototype, "locale", {
get: /**
* @return {?}
*/
function () {
return this._locale;
},
enumerable: true,
configurable: true
});
/**
* @param {?} path
* @return {?}
*/
LxlibLocaleService.prototype.getData = /**
* @param {?} path
* @return {?}
*/
function (path) {
return (/** @type {?} */ ((this._locale[path] || {})));
};
LxlibLocaleService.decorators = [
{ type: Injectable }
];
/** @nocollapse */
LxlibLocaleService.ctorParameters = function () { return [
{ type: undefined, decorators: [{ type: Inject, args: [LXLIB_LOCALE,] }] }
]; };
return LxlibLocaleService;
}());
export { LxlibLocaleService };
if (false) {
/**
* @type {?}
* @private
*/
LxlibLocaleService.prototype._locale;
/**
* @type {?}
* @private
*/
LxlibLocaleService.prototype.change$;
}
/**
* @param {?} exist
* @param {?} locale
* @return {?}
*/
export function LXLIB_LOCALE_SERVICE_PROVIDER_FACTORY(exist, locale) {
return exist || new LxlibLocaleService(locale);
}
/** @type {?} */
export var LXLIB_LOCALE_SERVICE_PROVIDER = {
provide: LxlibLocaleService,
useFactory: LXLIB_LOCALE_SERVICE_PROVIDER_FACTORY,
deps: [[new Optional(), new SkipSelf(), LxlibLocaleService], LXLIB_LOCALE],
};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibG9jYWxlLnNlcnZpY2UuanMiLCJzb3VyY2VSb290Ijoibmc6Ly9AbHhsaWIvdGhlbWUvIiwic291cmNlcyI6WyJzcmMvbG9jYWxlL2xvY2FsZS5zZXJ2aWNlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7O0FBQUEsT0FBTyxFQUFFLE1BQU0sRUFBRSxVQUFVLEVBQUUsUUFBUSxFQUFZLFFBQVEsRUFBRSxNQUFNLGVBQWUsQ0FBQztBQUNqRixPQUFPLEVBQUUsZUFBZSxFQUFjLE1BQU0sTUFBTSxDQUFDO0FBRW5ELE9BQU8sSUFBSSxNQUFNLG1CQUFtQixDQUFDO0FBQ3JDLE9BQU8sRUFBRSxZQUFZLEVBQUUsTUFBTSxpQkFBaUIsQ0FBQztBQUcvQztJQUtFLDRCQUFrQyxNQUE2QjtRQUZ2RCxZQUFPLEdBQUcsSUFBSSxlQUFlLENBQWlCLElBQUksQ0FBQyxPQUFPLENBQUMsQ0FBQztRQUdsRSxJQUFJLENBQUMsU0FBUyxDQUFDLE1BQU0sSUFBSSxJQUFJLENBQUMsQ0FBQztJQUNqQyxDQUFDO0lBRUQsc0JBQUksc0NBQU07Ozs7UUFBVjtZQUNFLE9BQU8sSUFBSSxDQUFDLE9BQU8sQ0FBQyxZQUFZLEVBQUUsQ0FBQztRQUNyQyxDQUFDOzs7T0FBQTs7Ozs7SUFFRCxzQ0FBUzs7OztJQUFULFVBQVUsTUFBc0I7UUFDOUIsSUFBSSxJQUFJLENBQUMsT0FBTyxJQUFJLElBQUksQ0FBQyxPQUFPLENBQUMsSUFBSSxLQUFLLE1BQU0sQ0FBQyxJQUFJLE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