UNPKG

angular-l10n

Version:

An Angular library to translate messages, dates and numbers

85 lines 2 kB
/** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc */ /** * Provides the methods to check if Intl APIs are supported. */ var /** * Provides the methods to check if Intl APIs are supported. */ IntlAPI = /** @class */ (function () { function IntlAPI() { } /** * @return {?} */ IntlAPI.hasIntl = /** * @return {?} */ function () { /** @type {?} */ var hasIntl = typeof Intl === "object" && !!Intl; return hasIntl; }; /** * @return {?} */ IntlAPI.hasDateTimeFormat = /** * @return {?} */ function () { return IntlAPI.hasIntl() && Intl.hasOwnProperty("DateTimeFormat"); }; /** * @return {?} */ IntlAPI.hasTimezone = /** * @return {?} */ function () { if (IntlAPI.hasIntl() && IntlAPI.hasDateTimeFormat()) { try { new Intl.DateTimeFormat('en-US', { timeZone: 'America/Los_Angeles' }).format(new Date()); } catch (e) { return false; } return true; } return false; }; /** * @return {?} */ IntlAPI.hasNumberFormat = /** * @return {?} */ function () { return IntlAPI.hasIntl() && Intl.hasOwnProperty("NumberFormat"); }; /** * @return {?} */ IntlAPI.hasCollator = /** * @return {?} */ function () { return IntlAPI.hasIntl() && Intl.hasOwnProperty("Collator"); }; /** * @return {?} */ IntlAPI.hasRelativeTimeFormat = /** * @return {?} */ function () { return IntlAPI.hasIntl() && Intl.hasOwnProperty("RelativeTimeFormat"); }; return IntlAPI; }()); /** * Provides the methods to check if Intl APIs are supported. */ export { IntlAPI }; //# sourceMappingURL=intl-api.js.map