UNPKG

igniteui-angular-core

Version:

Ignite UI Angular Core logic used in multiple UI components.

105 lines (104 loc) 3.56 kB
/* THIS INFRAGISTICS ULTIMATE SOFTWARE LICENSE AGREEMENT ("AGREEMENT") LOCATED HERE: https://www.infragistics.com/legal/license/igultimate-la https://www.infragistics.com/legal/license/igultimate-eula GOVERNS THE LICENSING, INSTALLATION AND USE OF INFRAGISTICS SOFTWARE. BY DOWNLOADING AND/OR INSTALLING AND USING INFRAGISTICS SOFTWARE: you are indicating that you have read and understand this Agreement, and agree to be legally bound by it on behalf of the yourself and your company. */ import { __extends, __read, __spreadArray } from "tslib"; import { Base, markType, NotSupportedException } from "./type"; import { stringIsNullOrEmpty } from "./string"; import { stringFormat1 } from "./stringExtended"; /** * @hidden */ var Localization = /** @class */ /*@__PURE__*/ (function (_super) { __extends(Localization, _super); function Localization() { return _super !== null && _super.apply(this, arguments) || this; } Localization.register = function (a, b) { if (Localization.c == null) { Localization.c = {}; } Localization.c[a] = b; }; Localization.getString = function (a, b) { var c = []; for (var _i = 2; _i < arguments.length; _i++) { c[_i - 2] = arguments[_i]; } var d; if (Localization.b != null) { d = Localization.b(a, b); } else { var e = null; if (Localization.c != null) { e = Localization.c[a]; } if (e != null) { d = (e[b]); } else { throw new NotSupportedException(1, "string override must be specified for localization"); } } if (stringIsNullOrEmpty(d)) { d = ""; } else if (c != null && c.length > 0) { d = stringFormat1.apply(void 0, __spreadArray([d], __read(c))); } return d; }; Localization.setString = function (a, b, c) { var d = null; if (Localization.c != null) { d = Localization.c[a]; } if (d != null) { d[b] = c; } else { throw new NotSupportedException(1, "locale set for " + a + " was not loaded."); } }; Localization.isRegistered = function (a) { return (Localization.c && Localization.c[a] !== undefined); }; Localization.d = function (a) { var b = (navigator.language ? navigator.language.toLowerCase() : ""); var c = a + "-"; while (true) { if (Localization.isRegistered(c + b)) { return b; } var d = Localization.e(b); if (d != null && Localization.isRegistered(c + d)) { return d; } var e = b.lastIndexOf('-'); if (e <= 0) { break; } b = b.substr(0, e); } return "en"; }; Localization.e = function (a) { switch (a) { case "zh-hk": case "zh-tw": case "zh-mo": return "zh-Hant"; case "zh-cn": case "zh-sg": case "zh": return "zh-Hans"; } return null; }; Localization.$t = markType(Localization, 'Localization'); Localization.b = null; Localization.c = null; return Localization; }(Base)); export { Localization };