Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function detectBrowserLocale() {
var defaultLocale = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _i18n.DEFAULT_LOCALE;
if (typeof navigator !== 'undefined') {
if (navigator.languages && navigator.languages.length) {
return (0, _formatLocale["default"])(navigator.languages[0]);
}
if (navigator.language) {
return (0, _formatLocale["default"])(navigator.language);
}
}
return (0, _formatLocale["default"])(defaultLocale);
}
//# sourceMappingURL=index.js.mapfunction LocaleSettings() {
var _context;
var _this;
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var globalStorage = _ref.globalStorage,
locale = _ref.locale,
_ref$supportedLocales = _ref.supportedLocales,
supportedLocales = _ref$supportedLocales === void 0 ? [_i18n.DEFAULT_LOCALE] : _ref$supportedLocales,
options = _objectWithoutProperties(_ref, ["globalStorage", "locale", "supportedLocales"]);
_classCallCheck(this, LocaleSettings);
_this = _possibleConstructorReturn(this, _getPrototypeOf(LocaleSettings).call(this, _objectSpread({}, options)));
_initializerDefineProperty(_this, "supportedLocales", _descriptor, _assertThisInitialized(_this));
_this._globalStorage = (_context = _assertThisInitialized(_this), _ensureExist["default"]).call(_context, globalStorage, 'globalStorage');
_this._locale = (_context = _assertThisInitialized(_this), _ensureExist["default"]).call(_context, locale, 'locale');
_this._supportedLocales = supportedLocales;
_this._storageKey = 'localeSettingsData';
_this._globalStorage.registerReducer({
key: _this._storageKey,
reducer: (0, _reducers.getSavedLocaleReducer)(_this.actionTypes)