sample-piral 1.4.0-beta.6257 → 1.4.0-beta.6276

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5917,6 +5917,7 @@ __webpack_require__.r(__webpack_exports__);
5917
5917
  /* harmony import */ var _actions__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./actions */ "../../plugins/piral-translate/esm/actions.js");
5918
5918
  /* harmony import */ var _localize__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./localize */ "../../plugins/piral-translate/esm/localize.js");
5919
5919
  /* harmony import */ var _default__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./default */ "../../plugins/piral-translate/esm/default.js");
5920
+ /* harmony import */ var _flatten_translations__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./flatten-translations */ "../../plugins/piral-translate/esm/flatten-translations.js");
5920
5921
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
5921
5922
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
5922
5923
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
@@ -5927,6 +5928,7 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
5927
5928
 
5928
5929
 
5929
5930
 
5931
+
5930
5932
  /**
5931
5933
  * Sets up a new localizer by using the given config.
5932
5934
  * @param config The configuration for the new localizer.
@@ -5991,7 +5993,7 @@ function createLocaleApi() {
5991
5993
  return selected;
5992
5994
  },
5993
5995
  setTranslations: function setTranslations(messages) {
5994
- localTranslations = messages;
5996
+ localTranslations = (0,_flatten_translations__WEBPACK_IMPORTED_MODULE_4__.flattenTranslations)(messages);
5995
5997
  },
5996
5998
  getTranslations: function getTranslations() {
5997
5999
  return localTranslations;
@@ -6059,6 +6061,53 @@ var DefaultPicker = function DefaultPicker(props) {
6059
6061
 
6060
6062
  /***/ }),
6061
6063
 
6064
+ /***/ "../../plugins/piral-translate/esm/flatten-translations.js":
6065
+ /*!*****************************************************************!*\
6066
+ !*** ../../plugins/piral-translate/esm/flatten-translations.js ***!
6067
+ \*****************************************************************/
6068
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
6069
+
6070
+ "use strict";
6071
+ __webpack_require__.r(__webpack_exports__);
6072
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
6073
+ /* harmony export */ flattenTranslations: () => (/* binding */ flattenTranslations)
6074
+ /* harmony export */ });
6075
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
6076
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
6077
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
6078
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
6079
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
6080
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
6081
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
6082
+ function flattenTranslations(messages) {
6083
+ return Object.fromEntries(Object.entries(messages).map(function (_ref) {
6084
+ var _ref2 = _slicedToArray(_ref, 2),
6085
+ language = _ref2[0],
6086
+ translations = _ref2[1];
6087
+ return [language, flat(translations)];
6088
+ }));
6089
+ }
6090
+ function flat(source) {
6091
+ var target = {};
6092
+ flatten(source, target);
6093
+ return target;
6094
+ }
6095
+ function flatten(source, target) {
6096
+ var prop = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
6097
+ if (typeof source === 'string') {
6098
+ target[prop] = source;
6099
+ return;
6100
+ }
6101
+ if (_typeof(source) === 'object' && source !== null) {
6102
+ Object.keys(source).forEach(function (key) {
6103
+ flatten(source[key], target, prop ? "".concat(prop, ".").concat(key) : key);
6104
+ });
6105
+ return;
6106
+ }
6107
+ }
6108
+
6109
+ /***/ }),
6110
+
6062
6111
  /***/ "../../plugins/piral-translate/esm/hooks.js":
6063
6112
  /*!**************************************************!*\
6064
6113
  !*** ../../plugins/piral-translate/esm/hooks.js ***!
@@ -6132,12 +6181,14 @@ __webpack_require__.r(__webpack_exports__);
6132
6181
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
6133
6182
  /* harmony export */ Localizer: () => (/* binding */ Localizer)
6134
6183
  /* harmony export */ });
6184
+ /* harmony import */ var _flatten_translations__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./flatten-translations */ "../../plugins/piral-translate/esm/flatten-translations.js");
6135
6185
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
6136
6186
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
6137
6187
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
6138
6188
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
6139
6189
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6140
6190
  function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
6191
+
6141
6192
  function defaultFallback(key, language) {
6142
6193
  if (false) {} else {
6143
6194
  if (language) {
@@ -6160,10 +6211,10 @@ var Localizer = /*#__PURE__*/function () {
6160
6211
  function Localizer(messages, language, languages) {
6161
6212
  var fallback = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : defaultFallback;
6162
6213
  _classCallCheck(this, Localizer);
6163
- this.messages = messages;
6164
6214
  this.language = language;
6165
6215
  this.languages = languages;
6166
6216
  this.fallback = fallback;
6217
+ this.messages = (0,_flatten_translations__WEBPACK_IMPORTED_MODULE_0__.flattenTranslations)(messages);
6167
6218
  }
6168
6219
  /**
6169
6220
  * Localizes the given key via the global translations.
@@ -6667,12 +6718,12 @@ function installPiralDebug(options) {
6667
6718
  debug: debugApiVersion,
6668
6719
  instance: {
6669
6720
  name: "sample-piral",
6670
- version: "1.4.0-beta.6257",
6721
+ version: "1.4.0-beta.6276",
6671
6722
  dependencies: "reactstrap,tslib,react,react-dom,react-router,react-router-dom"
6672
6723
  },
6673
6724
  build: {
6674
- date: "2023-11-24T19:46:32.658Z",
6675
- cli: "1.4.0-beta.6257",
6725
+ date: "2023-11-29T10:07:38.936Z",
6726
+ cli: "1.4.0-beta.6276",
6676
6727
  compat: "1"
6677
6728
  }
6678
6729
  };
@@ -66516,4 +66567,4 @@ root.render( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1__.createElement(piral
66516
66567
 
66517
66568
  /******/ })()
66518
66569
  ;
66519
- //# sourceMappingURL=index.bb2530.js.map
66570
+ //# sourceMappingURL=index.5d6015.js.map