How to use the @ringcentral-integration/i18n.DEFAULT_LOCALE function in @ringcentral-integration/i18n

To help you get started, we’ve selected a few @ringcentral-integration/i18n examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ringcentral / ringcentral-js-widgets / lib / detectBrowserLocale / index.js View on Github external
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.map
github ringcentral / ringcentral-js-widgets / modules / LocaleSettings / index.js View on Github external
function 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)

@ringcentral-integration/i18n

A simple I18n implementation used in RingCentral Integration projects.

MIT
Latest version published 4 months ago

Package Health Score

70 / 100
Full package analysis

Similar packages