angular-l10n
Version:
An Angular library to translate messages, dates and numbers
922 lines • 33.5 kB
JavaScript
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
*/
import * as tslib_1 from "tslib";
import { Injectable, Inject } from '@angular/core';
import { Subject } from 'rxjs';
import { IntlAPI } from './intl-api';
import { LocaleStorage } from './locale-storage';
import { L10N_CONFIG } from "../models/l10n-config";
import { DefaultLocale } from '../models/default-locale';
import { IntlFormatter } from '../models/intl-formatter';
import { ISOCode, NumberFormatStyle } from '../models/types';
/**
* @record
*/
export function ILocaleService() { }
if (false) {
/** @type {?} */
ILocaleService.prototype.languageCodeChanged;
/** @type {?} */
ILocaleService.prototype.defaultLocaleChanged;
/** @type {?} */
ILocaleService.prototype.currencyCodeChanged;
/** @type {?} */
ILocaleService.prototype.timezoneChanged;
/**
* @return {?}
*/
ILocaleService.prototype.getConfiguration = function () { };
/**
* @return {?}
*/
ILocaleService.prototype.init = function () { };
/**
* @return {?}
*/
ILocaleService.prototype.getBrowserLanguage = function () { };
/**
* @return {?}
*/
ILocaleService.prototype.getAvailableLanguages = function () { };
/**
* @param {?=} languageCode
* @return {?}
*/
ILocaleService.prototype.getLanguageDirection = function (languageCode) { };
/**
* @return {?}
*/
ILocaleService.prototype.getCurrentLanguage = function () { };
/**
* @return {?}
*/
ILocaleService.prototype.getCurrentCountry = function () { };
/**
* @return {?}
*/
ILocaleService.prototype.getCurrentScript = function () { };
/**
* @return {?}
*/
ILocaleService.prototype.getCurrentLocale = function () { };
/**
* @return {?}
*/
ILocaleService.prototype.getCurrentNumberingSystem = function () { };
/**
* @return {?}
*/
ILocaleService.prototype.getCurrentCalendar = function () { };
/**
* @return {?}
*/
ILocaleService.prototype.getDefaultLocale = function () { };
/**
* @return {?}
*/
ILocaleService.prototype.getCurrentCurrency = function () { };
/**
* @param {?=} currencyDisplay
* @param {?=} defaultLocale
* @param {?=} currency
* @return {?}
*/
ILocaleService.prototype.getCurrencySymbol = function (currencyDisplay, defaultLocale, currency) { };
/**
* @return {?}
*/
ILocaleService.prototype.getCurrentTimezone = function () { };
/**
* @param {?} languageCode
* @return {?}
*/
ILocaleService.prototype.setCurrentLanguage = function (languageCode) { };
/**
* @param {?} languageCode
* @param {?=} countryCode
* @param {?=} scriptCode
* @param {?=} numberingSystem
* @param {?=} calendar
* @return {?}
*/
ILocaleService.prototype.setDefaultLocale = function (languageCode, countryCode, scriptCode, numberingSystem, calendar) { };
/**
* @param {?} currencyCode
* @return {?}
*/
ILocaleService.prototype.setCurrentCurrency = function (currencyCode) { };
/**
* @param {?} zoneName
* @return {?}
*/
ILocaleService.prototype.setCurrentTimezone = function (zoneName) { };
/**
* @param {?} value
* @param {?=} format
* @param {?=} defaultLocale
* @param {?=} timezone
* @return {?}
*/
ILocaleService.prototype.formatDate = function (value, format, defaultLocale, timezone) { };
/**
* @param {?} value
* @param {?} unit
* @param {?=} format
* @param {?=} defaultLocale
* @return {?}
*/
ILocaleService.prototype.formatRelativeTime = function (value, unit, format, defaultLocale) { };
/**
* @param {?} value
* @param {?=} digits
* @param {?=} defaultLocale
* @return {?}
*/
ILocaleService.prototype.formatDecimal = function (value, digits, defaultLocale) { };
/**
* @param {?} value
* @param {?=} digits
* @param {?=} defaultLocale
* @return {?}
*/
ILocaleService.prototype.formatPercent = function (value, digits, defaultLocale) { };
/**
* @param {?} value
* @param {?=} digits
* @param {?=} currencyDisplay
* @param {?=} defaultLocale
* @param {?=} currency
* @return {?}
*/
ILocaleService.prototype.formatCurrency = function (value, digits, currencyDisplay, defaultLocale, currency) { };
/**
* @param {?} codes
* @return {?}
*/
ILocaleService.prototype.composeLocale = function (codes) { };
/**
* @return {?}
*/
ILocaleService.prototype.rollback = function () { };
}
/**
* Manages language, default locale, currency & timezone.
*/
var LocaleService = /** @class */ (function () {
function LocaleService(configuration, storage) {
this.configuration = configuration;
this.storage = storage;
/**
* Fired when the language changes. Returns the language code.
*/
this.languageCodeChanged = new Subject();
/**
* Fired when the default locale changes. Returns the default locale.
*/
this.defaultLocaleChanged = new Subject();
/**
* Fired when the currency changes. Returns the currency code.
*/
this.currencyCodeChanged = new Subject();
/**
* Fired when the timezone changes. Returns the timezone.
*/
this.timezoneChanged = new Subject();
this.defaultLocale = new DefaultLocale();
}
/**
* @return {?}
*/
LocaleService.prototype.getConfiguration = /**
* @return {?}
*/
function () {
return this.configuration.locale;
};
/**
* @return {?}
*/
LocaleService.prototype.init = /**
* @return {?}
*/
function () {
return tslib_1.__awaiter(this, void 0, void 0, function () {
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.initLanguage()];
case 1:
_a.sent();
return [4 /*yield*/, this.initDefaultLocale()];
case 2:
_a.sent();
return [4 /*yield*/, this.initCurrency()];
case 3:
_a.sent();
return [4 /*yield*/, this.initTimezone()];
case 4:
_a.sent();
return [2 /*return*/];
}
});
});
};
/**
* @return {?}
*/
LocaleService.prototype.getBrowserLanguage = /**
* @return {?}
*/
function () {
/** @type {?} */
var browserLanguage = null;
if (typeof navigator !== "undefined" && navigator.language) {
browserLanguage = navigator.language;
}
if (browserLanguage != null) {
browserLanguage = browserLanguage.split("-")[0];
}
return browserLanguage;
};
/**
* @return {?}
*/
LocaleService.prototype.getAvailableLanguages = /**
* @return {?}
*/
function () {
/** @type {?} */
var languages = [];
if (this.configuration.locale.languages) {
languages = this.configuration.locale.languages.map(function (language) { return language.code; });
}
return languages;
};
/**
* @param {?=} languageCode
* @return {?}
*/
LocaleService.prototype.getLanguageDirection = /**
* @param {?=} languageCode
* @return {?}
*/
function (languageCode) {
if (languageCode === void 0) { languageCode = this.defaultLocale.languageCode; }
/** @type {?} */
var matchedLanguage = this.matchLanguage(languageCode);
return matchedLanguage ? matchedLanguage.dir : "";
};
/**
* @return {?}
*/
LocaleService.prototype.getCurrentLanguage = /**
* @return {?}
*/
function () {
return this.defaultLocale.languageCode;
};
/**
* @return {?}
*/
LocaleService.prototype.getCurrentCountry = /**
* @return {?}
*/
function () {
return this.defaultLocale.countryCode || "";
};
/**
* @return {?}
*/
LocaleService.prototype.getCurrentScript = /**
* @return {?}
*/
function () {
return this.defaultLocale.scriptCode || "";
};
/**
* Returns the well formatted locale as {languageCode}[-scriptCode][-countryCode]
*/
/**
* Returns the well formatted locale as {languageCode}[-scriptCode][-countryCode]
* @return {?}
*/
LocaleService.prototype.getCurrentLocale = /**
* Returns the well formatted locale as {languageCode}[-scriptCode][-countryCode]
* @return {?}
*/
function () {
/** @type {?} */
var locale = this.defaultLocale.languageCode;
locale += !!this.defaultLocale.scriptCode ? "-" + this.defaultLocale.scriptCode : "";
locale += !!this.defaultLocale.countryCode ? "-" + this.defaultLocale.countryCode : "";
return locale;
};
/**
* @return {?}
*/
LocaleService.prototype.getCurrentNumberingSystem = /**
* @return {?}
*/
function () {
return this.defaultLocale.numberingSystem || "";
};
/**
* @return {?}
*/
LocaleService.prototype.getCurrentCalendar = /**
* @return {?}
*/
function () {
return this.defaultLocale.calendar || "";
};
/**
* @return {?}
*/
LocaleService.prototype.getDefaultLocale = /**
* @return {?}
*/
function () {
return this.defaultLocale.value;
};
/**
* @return {?}
*/
LocaleService.prototype.getCurrentCurrency = /**
* @return {?}
*/
function () {
return this.currencyCode;
};
/**
* @param {?} currencyDisplay
* @param {?=} defaultLocale
* @param {?=} currency
* @return {?}
*/
LocaleService.prototype.getCurrencySymbol = /**
* @param {?} currencyDisplay
* @param {?=} defaultLocale
* @param {?=} currency
* @return {?}
*/
function (currencyDisplay, defaultLocale, currency) {
/** @type {?} */
var currencySymbol = this.currencyCode;
if (IntlAPI.hasNumberFormat()) {
/** @type {?} */
var localeZero = this.formatDecimal(0, '1.0-0', defaultLocale);
/** @type {?} */
var localeValue = this.formatCurrency(0, '1.0-0', currencyDisplay, defaultLocale, currency);
currencySymbol = localeValue.replace(localeZero, "");
currencySymbol = currencySymbol.trim();
}
return currencySymbol;
};
/**
* @return {?}
*/
LocaleService.prototype.getCurrentTimezone = /**
* @return {?}
*/
function () {
return this.timezone;
};
/**
* @param {?} languageCode
* @return {?}
*/
LocaleService.prototype.setCurrentLanguage = /**
* @param {?} languageCode
* @return {?}
*/
function (languageCode) {
if (this.defaultLocale.languageCode != languageCode) {
this.rollbackLanguageCode = this.defaultLocale.languageCode;
this.defaultLocale.build(languageCode);
this.releaseLanguage();
}
};
/**
* @param {?} languageCode
* @param {?=} countryCode
* @param {?=} scriptCode
* @param {?=} numberingSystem
* @param {?=} calendar
* @return {?}
*/
LocaleService.prototype.setDefaultLocale = /**
* @param {?} languageCode
* @param {?=} countryCode
* @param {?=} scriptCode
* @param {?=} numberingSystem
* @param {?=} calendar
* @return {?}
*/
function (languageCode, countryCode, scriptCode, numberingSystem, calendar) {
if (this.defaultLocale.languageCode != languageCode ||
this.defaultLocale.countryCode != countryCode ||
this.defaultLocale.scriptCode != scriptCode ||
this.defaultLocale.numberingSystem != numberingSystem ||
this.defaultLocale.calendar != calendar) {
this.rollbackDefaultLocale = this.defaultLocale.value;
this.defaultLocale.build(languageCode, countryCode, scriptCode, numberingSystem, calendar);
this.releaseDefaultLocale();
}
};
/**
* @param {?} currencyCode
* @return {?}
*/
LocaleService.prototype.setCurrentCurrency = /**
* @param {?} currencyCode
* @return {?}
*/
function (currencyCode) {
if (this.currencyCode != currencyCode) {
this.rollbackCurrencyCode = this.currencyCode;
this.currencyCode = currencyCode;
this.releaseCurrency();
}
};
/**
* @param {?} zoneName
* @return {?}
*/
LocaleService.prototype.setCurrentTimezone = /**
* @param {?} zoneName
* @return {?}
*/
function (zoneName) {
if (this.timezone != zoneName) {
this.rollbackTimezone = this.timezone;
this.timezone = zoneName;
this.releaseTimezone();
}
};
/**
* Formats a date according to default locale.
* @param value A Date, a number (milliseconds since UTC epoch) or an ISO string
* @param format An alias or a DateTimeOptions object of the format. Default is 'mediumDate'
* @param defaultLocale The default locale to use. Default is the current locale
* @param timezone The time zone name. Default is the current timezone
*/
/**
* Formats a date according to default locale.
* @param {?} value A Date, a number (milliseconds since UTC epoch) or an ISO string
* @param {?=} format An alias or a DateTimeOptions object of the format. Default is 'mediumDate'
* @param {?=} defaultLocale The default locale to use. Default is the current locale
* @param {?=} timezone The time zone name. Default is the current timezone
* @return {?}
*/
LocaleService.prototype.formatDate = /**
* Formats a date according to default locale.
* @param {?} value A Date, a number (milliseconds since UTC epoch) or an ISO string
* @param {?=} format An alias or a DateTimeOptions object of the format. Default is 'mediumDate'
* @param {?=} defaultLocale The default locale to use. Default is the current locale
* @param {?=} timezone The time zone name. Default is the current timezone
* @return {?}
*/
function (value, format, defaultLocale, timezone) {
return IntlFormatter.formatDate(value, defaultLocale || this.defaultLocale.value, format || 'mediumDate', timezone || this.timezone);
};
/**
* Formats a relative time according to default locale.
* @param value Negative (or positive) number
* @param unit Unit of the value. Possible values are: 'year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second'
* @param format RelativeTimeOptions object of the format
* @param defaultLocale The default locale to use. Default is the current locale
*/
/**
* Formats a relative time according to default locale.
* @param {?} value Negative (or positive) number
* @param {?} unit Unit of the value. Possible values are: 'year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second'
* @param {?=} format RelativeTimeOptions object of the format
* @param {?=} defaultLocale The default locale to use. Default is the current locale
* @return {?}
*/
LocaleService.prototype.formatRelativeTime = /**
* Formats a relative time according to default locale.
* @param {?} value Negative (or positive) number
* @param {?} unit Unit of the value. Possible values are: 'year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second'
* @param {?=} format RelativeTimeOptions object of the format
* @param {?=} defaultLocale The default locale to use. Default is the current locale
* @return {?}
*/
function (value, unit, format, defaultLocale) {
return IntlFormatter.formatRelativeTime(value, unit, defaultLocale || this.defaultLocale.value, format);
};
/**
* Formats a decimal number according to default locale.
* @param value The number to be formatted
* @param digits An alias or a DigitsOptions object of the format
* @param defaultLocale The default locale to use. Default is the current locale
*/
/**
* Formats a decimal number according to default locale.
* @param {?} value The number to be formatted
* @param {?=} digits An alias or a DigitsOptions object of the format
* @param {?=} defaultLocale The default locale to use. Default is the current locale
* @return {?}
*/
LocaleService.prototype.formatDecimal = /**
* Formats a decimal number according to default locale.
* @param {?} value The number to be formatted
* @param {?=} digits An alias or a DigitsOptions object of the format
* @param {?=} defaultLocale The default locale to use. Default is the current locale
* @return {?}
*/
function (value, digits, defaultLocale) {
return IntlFormatter.formatNumber(value, defaultLocale || this.defaultLocale.value, NumberFormatStyle.Decimal, digits);
};
/**
* Formats a number as a percentage according to default locale.
* @param value The number to be formatted
* @param digits An alias or a DigitsOptions object of the format
* @param defaultLocale The default locale to use. Default is the current locale
*/
/**
* Formats a number as a percentage according to default locale.
* @param {?} value The number to be formatted
* @param {?=} digits An alias or a DigitsOptions object of the format
* @param {?=} defaultLocale The default locale to use. Default is the current locale
* @return {?}
*/
LocaleService.prototype.formatPercent = /**
* Formats a number as a percentage according to default locale.
* @param {?} value The number to be formatted
* @param {?=} digits An alias or a DigitsOptions object of the format
* @param {?=} defaultLocale The default locale to use. Default is the current locale
* @return {?}
*/
function (value, digits, defaultLocale) {
return IntlFormatter.formatNumber(value, defaultLocale || this.defaultLocale.value, NumberFormatStyle.Percent, digits);
};
/**
* Formats a number as a currency according to default locale.
* @param value The number to be formatted
* @param digits An alias or a DigitsOptions object of the format
* @param currencyDisplay The format for the currency. Possible values are 'code', 'symbol', 'name'. Default is 'symbol'
* @param defaultLocale The default locale to use. Default is the current locale
* @param currency The currency to use. Default is the current currency
*/
/**
* Formats a number as a currency according to default locale.
* @param {?} value The number to be formatted
* @param {?=} digits An alias or a DigitsOptions object of the format
* @param {?=} currencyDisplay The format for the currency. Possible values are 'code', 'symbol', 'name'. Default is 'symbol'
* @param {?=} defaultLocale The default locale to use. Default is the current locale
* @param {?=} currency The currency to use. Default is the current currency
* @return {?}
*/
LocaleService.prototype.formatCurrency = /**
* Formats a number as a currency according to default locale.
* @param {?} value The number to be formatted
* @param {?=} digits An alias or a DigitsOptions object of the format
* @param {?=} currencyDisplay The format for the currency. Possible values are 'code', 'symbol', 'name'. Default is 'symbol'
* @param {?=} defaultLocale The default locale to use. Default is the current locale
* @param {?=} currency The currency to use. Default is the current currency
* @return {?}
*/
function (value, digits, currencyDisplay, defaultLocale, currency) {
return IntlFormatter.formatNumber(value, defaultLocale || this.defaultLocale.value, NumberFormatStyle.Currency, digits, currency || this.currencyCode, currencyDisplay || 'symbol');
};
/**
* @param {?} codes
* @return {?}
*/
LocaleService.prototype.composeLocale = /**
* @param {?} codes
* @return {?}
*/
function (codes) {
/** @type {?} */
var locale = "";
if (this.defaultLocale.languageCode) {
for (var _i = 0, codes_1 = codes; _i < codes_1.length; _i++) {
var code = codes_1[_i];
switch (code) {
case ISOCode.Script:
locale += "-" + this.defaultLocale.scriptCode;
break;
case ISOCode.Country:
locale += "-" + this.defaultLocale.countryCode;
break;
default:
locale += this.defaultLocale.languageCode;
}
}
}
return locale;
};
/**
* Rollbacks to previous language, default locale, currency & timezone.
*/
/**
* Rollbacks to previous language, default locale, currency & timezone.
* @return {?}
*/
LocaleService.prototype.rollback = /**
* Rollbacks to previous language, default locale, currency & timezone.
* @return {?}
*/
function () {
if (this.rollbackLanguageCode && this.rollbackLanguageCode != this.defaultLocale.languageCode) {
this.defaultLocale.value = this.rollbackLanguageCode;
this.releaseLanguage();
}
if (this.rollbackDefaultLocale && this.rollbackDefaultLocale != this.defaultLocale.value) {
this.defaultLocale.value = this.rollbackDefaultLocale;
this.releaseDefaultLocale();
}
if (this.rollbackCurrencyCode && this.rollbackCurrencyCode != this.currencyCode) {
this.currencyCode = this.rollbackCurrencyCode;
this.releaseCurrency();
}
if (this.rollbackTimezone && this.rollbackTimezone != this.timezone) {
this.timezone = this.rollbackTimezone;
this.releaseTimezone();
}
};
/**
* @return {?}
*/
LocaleService.prototype.initLanguage = /**
* @return {?}
*/
function () {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var defaultLocale, browserLanguage, matchedLanguage;
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0:
if (!this.configuration.locale.language) return [3 /*break*/, 2];
if (!!this.defaultLocale.languageCode) return [3 /*break*/, 2];
// Tries to get the language from the storage.
return [4 /*yield*/, this.storage.read("defaultLocale")];
case 1:
defaultLocale = _a.sent();
if (!!defaultLocale) {
this.defaultLocale.value = defaultLocale;
}
else {
// Tries to get the language from the browser.
browserLanguage = this.getBrowserLanguage();
matchedLanguage = this.matchLanguage(browserLanguage);
if (!!browserLanguage && matchedLanguage) {
this.defaultLocale.build(browserLanguage);
}
else {
// Uses the language set in the configuration.
this.defaultLocale.build(this.configuration.locale.language);
}
this.storage.write("defaultLocale", this.defaultLocale.value);
}
this.rollbackLanguageCode = this.defaultLocale.languageCode;
this.sendLanguageEvents();
_a.label = 2;
case 2: return [2 /*return*/];
}
});
});
};
/**
* @return {?}
*/
LocaleService.prototype.initDefaultLocale = /**
* @return {?}
*/
function () {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var defaultLocale;
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0:
if (!this.configuration.locale.defaultLocale) return [3 /*break*/, 2];
if (!!this.defaultLocale.value) return [3 /*break*/, 2];
return [4 /*yield*/, this.storage.read("defaultLocale")];
case 1:
defaultLocale = _a.sent();
if (!!defaultLocale) {
this.defaultLocale.value = defaultLocale;
}
else {
this.defaultLocale.build(this.configuration.locale.defaultLocale.languageCode, this.configuration.locale.defaultLocale.countryCode, this.configuration.locale.defaultLocale.scriptCode, this.configuration.locale.defaultLocale.numberingSystem, this.configuration.locale.defaultLocale.calendar);
this.storage.write("defaultLocale", this.defaultLocale.value);
}
this.rollbackDefaultLocale = this.defaultLocale.value;
this.sendDefaultLocaleEvents();
_a.label = 2;
case 2: return [2 /*return*/];
}
});
});
};
/**
* @return {?}
*/
LocaleService.prototype.initCurrency = /**
* @return {?}
*/
function () {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var currencyCode;
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0:
if (!this.configuration.locale.currency) return [3 /*break*/, 2];
if (!!this.currencyCode) return [3 /*break*/, 2];
return [4 /*yield*/, this.storage.read("currency")];
case 1:
currencyCode = _a.sent();
if (!!currencyCode) {
this.currencyCode = currencyCode;
}
else {
this.currencyCode = this.configuration.locale.currency;
this.storage.write("currency", this.currencyCode);
}
this.rollbackCurrencyCode = this.currencyCode;
this.sendCurrencyEvents();
_a.label = 2;
case 2: return [2 /*return*/];
}
});
});
};
/**
* @return {?}
*/
LocaleService.prototype.initTimezone = /**
* @return {?}
*/
function () {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var zoneName;
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0:
if (!this.configuration.locale.timezone) return [3 /*break*/, 2];
if (!!this.timezone) return [3 /*break*/, 2];
return [4 /*yield*/, this.storage.read("timezone")];
case 1:
zoneName = _a.sent();
if (!!zoneName) {
this.timezone = zoneName;
}
else {
this.timezone = this.configuration.locale.timezone;
this.storage.write("timezone", this.timezone);
}
this.rollbackTimezone = this.timezone;
this.sendTimezoneEvents();
_a.label = 2;
case 2: return [2 /*return*/];
}
});
});
};
/**
* @param {?} languageCode
* @return {?}
*/
LocaleService.prototype.matchLanguage = /**
* @param {?} languageCode
* @return {?}
*/
function (languageCode) {
/** @type {?} */
var matchedLanguage;
if (this.configuration.locale.languages && languageCode != null) {
matchedLanguage = this.configuration.locale.languages.find(function (language) { return language.code == languageCode; });
}
return matchedLanguage;
};
/**
* @return {?}
*/
LocaleService.prototype.releaseLanguage = /**
* @return {?}
*/
function () {
this.storage.write("defaultLocale", this.defaultLocale.value);
this.sendLanguageEvents();
};
/**
* @return {?}
*/
LocaleService.prototype.releaseDefaultLocale = /**
* @return {?}
*/
function () {
this.storage.write("defaultLocale", this.defaultLocale.value);
this.sendDefaultLocaleEvents();
};
/**
* @return {?}
*/
LocaleService.prototype.releaseCurrency = /**
* @return {?}
*/
function () {
this.storage.write("currency", this.currencyCode);
this.sendCurrencyEvents();
};
/**
* @return {?}
*/
LocaleService.prototype.releaseTimezone = /**
* @return {?}
*/
function () {
this.storage.write("timezone", this.timezone);
this.sendTimezoneEvents();
};
/**
* @return {?}
*/
LocaleService.prototype.sendLanguageEvents = /**
* @return {?}
*/
function () {
this.languageCodeChanged.next(this.defaultLocale.languageCode);
};
/**
* @return {?}
*/
LocaleService.prototype.sendDefaultLocaleEvents = /**
* @return {?}
*/
function () {
this.defaultLocaleChanged.next(this.defaultLocale.value);
};
/**
* @return {?}
*/
LocaleService.prototype.sendCurrencyEvents = /**
* @return {?}
*/
function () {
this.currencyCodeChanged.next(this.currencyCode);
};
/**
* @return {?}
*/
LocaleService.prototype.sendTimezoneEvents = /**
* @return {?}
*/
function () {
this.timezoneChanged.next(this.timezone);
};
LocaleService.decorators = [
{ type: Injectable }
];
/** @nocollapse */
LocaleService.ctorParameters = function () { return [
{ type: undefined, decorators: [{ type: Inject, args: [L10N_CONFIG,] }] },
{ type: LocaleStorage }
]; };
return LocaleService;
}());
export { LocaleService };
if (false) {
/**
* Fired when the language changes. Returns the language code.
* @type {?}
*/
LocaleService.prototype.languageCodeChanged;
/**
* Fired when the default locale changes. Returns the default locale.
* @type {?}
*/
LocaleService.prototype.defaultLocaleChanged;
/**
* Fired when the currency changes. Returns the currency code.
* @type {?}
*/
LocaleService.prototype.currencyCodeChanged;
/**
* Fired when the timezone changes. Returns the timezone.
* @type {?}
*/
LocaleService.prototype.timezoneChanged;
/** @type {?} */
LocaleService.prototype.defaultLocale;
/** @type {?} */
LocaleService.prototype.currencyCode;
/** @type {?} */
LocaleService.prototype.timezone;
/** @type {?} */
LocaleService.prototype.rollbackLanguageCode;
/** @type {?} */
LocaleService.prototype.rollbackDefaultLocale;
/** @type {?} */
LocaleService.prototype.rollbackCurrencyCode;
/** @type {?} */
LocaleService.prototype.rollbackTimezone;
/** @type {?} */
LocaleService.prototype.configuration;
/** @type {?} */
LocaleService.prototype.storage;
}
//# sourceMappingURL=locale.service.js.map