@absolutesight/react-gettext 1.0.0 → 1.0.1

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.
@@ -27,83 +27,83 @@ __webpack_require__.r(__webpack_exports__);
27
27
  /* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! prop-types */ "prop-types");
28
28
  /* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_1__);
29
29
  /* harmony import */ var _gettext__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./gettext */ "./gettext.js");
30
-
31
-
32
-
33
-
34
-
35
- class TextDomain extends react__WEBPACK_IMPORTED_MODULE_0__.Component {
36
-
37
- getChildContext() {
38
- const self = this;
39
-
40
- return {
41
- gettext: self.gettext.bind(self),
42
- xgettext: self.xgettext.bind(self),
43
- ngettext: self.ngettext.bind(self),
44
- nxgettext: self.nxgettext.bind(self),
45
- };
46
- }
47
-
48
- gettext(message) {
49
- const { translations } = this.props;
50
- return (0,_gettext__WEBPACK_IMPORTED_MODULE_2__.gettext)(translations, message);
51
- }
52
-
53
- ngettext(singular, plural, n) {
54
- const { translations, plural: plurality } = this.props;
55
- return (0,_gettext__WEBPACK_IMPORTED_MODULE_2__.ngettext)(translations, plurality, singular, plural, n);
56
- }
57
-
58
- xgettext(message, context) {
59
- const { translations } = this.props;
60
- return (0,_gettext__WEBPACK_IMPORTED_MODULE_2__.xgettext)(translations, message, context);
61
- }
62
-
63
- nxgettext(singular, plural, n, context) {
64
- const { translations, plural: plurality } = this.props;
65
- return (0,_gettext__WEBPACK_IMPORTED_MODULE_2__.nxgettext)(translations, plurality, singular, plural, n, context);
66
- }
67
-
68
- render() {
69
- const { children } = this.props;
70
- return children;
71
- }
72
-
73
- }
74
-
75
- TextDomain.propTypes = {
76
- translations: prop_types__WEBPACK_IMPORTED_MODULE_1___default().oneOfType([
77
- (prop_types__WEBPACK_IMPORTED_MODULE_1___default().func),
78
- prop_types__WEBPACK_IMPORTED_MODULE_1___default().objectOf(prop_types__WEBPACK_IMPORTED_MODULE_1___default().oneOfType([
79
- (prop_types__WEBPACK_IMPORTED_MODULE_1___default().string),
80
- prop_types__WEBPACK_IMPORTED_MODULE_1___default().arrayOf((prop_types__WEBPACK_IMPORTED_MODULE_1___default().string)),
81
- ])),
82
- ]),
83
- plural: prop_types__WEBPACK_IMPORTED_MODULE_1___default().oneOfType([
84
- (prop_types__WEBPACK_IMPORTED_MODULE_1___default().func),
85
- (prop_types__WEBPACK_IMPORTED_MODULE_1___default().string),
86
- ]),
87
- children: prop_types__WEBPACK_IMPORTED_MODULE_1___default().oneOfType([
88
- (prop_types__WEBPACK_IMPORTED_MODULE_1___default().node),
89
- prop_types__WEBPACK_IMPORTED_MODULE_1___default().arrayOf((prop_types__WEBPACK_IMPORTED_MODULE_1___default().node)),
90
- ]),
91
- };
92
-
93
- TextDomain.defaultProps = {
94
- translations: {},
95
- plural: 'n != 1',
96
- children: [],
97
- };
98
-
99
- TextDomain.childContextTypes = {
100
- gettext: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().func),
101
- ngettext: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().func),
102
- xgettext: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().func),
103
- nxgettext: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().func),
104
- };
105
-
106
- /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (TextDomain);
30
+
31
+
32
+
33
+
34
+
35
+ class TextDomain extends react__WEBPACK_IMPORTED_MODULE_0__.Component {
36
+
37
+ getChildContext() {
38
+ const self = this;
39
+
40
+ return {
41
+ gettext: self.gettext.bind(self),
42
+ xgettext: self.xgettext.bind(self),
43
+ ngettext: self.ngettext.bind(self),
44
+ nxgettext: self.nxgettext.bind(self),
45
+ };
46
+ }
47
+
48
+ gettext(message) {
49
+ const { translations } = this.props;
50
+ return (0,_gettext__WEBPACK_IMPORTED_MODULE_2__.gettext)(translations, message);
51
+ }
52
+
53
+ ngettext(singular, plural, n) {
54
+ const { translations, plural: plurality } = this.props;
55
+ return (0,_gettext__WEBPACK_IMPORTED_MODULE_2__.ngettext)(translations, plurality, singular, plural, n);
56
+ }
57
+
58
+ xgettext(message, context) {
59
+ const { translations } = this.props;
60
+ return (0,_gettext__WEBPACK_IMPORTED_MODULE_2__.xgettext)(translations, message, context);
61
+ }
62
+
63
+ nxgettext(singular, plural, n, context) {
64
+ const { translations, plural: plurality } = this.props;
65
+ return (0,_gettext__WEBPACK_IMPORTED_MODULE_2__.nxgettext)(translations, plurality, singular, plural, n, context);
66
+ }
67
+
68
+ render() {
69
+ const { children } = this.props;
70
+ return children;
71
+ }
72
+
73
+ }
74
+
75
+ TextDomain.propTypes = {
76
+ translations: prop_types__WEBPACK_IMPORTED_MODULE_1___default().oneOfType([
77
+ (prop_types__WEBPACK_IMPORTED_MODULE_1___default().func),
78
+ prop_types__WEBPACK_IMPORTED_MODULE_1___default().objectOf(prop_types__WEBPACK_IMPORTED_MODULE_1___default().oneOfType([
79
+ (prop_types__WEBPACK_IMPORTED_MODULE_1___default().string),
80
+ prop_types__WEBPACK_IMPORTED_MODULE_1___default().arrayOf((prop_types__WEBPACK_IMPORTED_MODULE_1___default().string)),
81
+ ])),
82
+ ]),
83
+ plural: prop_types__WEBPACK_IMPORTED_MODULE_1___default().oneOfType([
84
+ (prop_types__WEBPACK_IMPORTED_MODULE_1___default().func),
85
+ (prop_types__WEBPACK_IMPORTED_MODULE_1___default().string),
86
+ ]),
87
+ children: prop_types__WEBPACK_IMPORTED_MODULE_1___default().oneOfType([
88
+ (prop_types__WEBPACK_IMPORTED_MODULE_1___default().node),
89
+ prop_types__WEBPACK_IMPORTED_MODULE_1___default().arrayOf((prop_types__WEBPACK_IMPORTED_MODULE_1___default().node)),
90
+ ]),
91
+ };
92
+
93
+ TextDomain.defaultProps = {
94
+ translations: {},
95
+ plural: 'n != 1',
96
+ children: [],
97
+ };
98
+
99
+ TextDomain.childContextTypes = {
100
+ gettext: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().func),
101
+ ngettext: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().func),
102
+ xgettext: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().func),
103
+ nxgettext: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().func),
104
+ };
105
+
106
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (TextDomain);
107
107
 
108
108
 
109
109
  /***/ }),
@@ -121,12 +121,12 @@ __webpack_require__.r(__webpack_exports__);
121
121
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
122
122
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
123
123
  /* harmony import */ var _buildTextDomain__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./buildTextDomain */ "./buildTextDomain.js");
124
-
125
-
126
-
127
- const TextDomainContext = react__WEBPACK_IMPORTED_MODULE_0___default().createContext((0,_buildTextDomain__WEBPACK_IMPORTED_MODULE_1__["default"])({}, 'n != 1'));
128
-
129
- /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (TextDomainContext);
124
+
125
+
126
+
127
+ const TextDomainContext = react__WEBPACK_IMPORTED_MODULE_0___default().createContext((0,_buildTextDomain__WEBPACK_IMPORTED_MODULE_1__["default"])({}, 'n != 1'));
128
+
129
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (TextDomainContext);
130
130
 
131
131
 
132
132
  /***/ }),
@@ -142,24 +142,24 @@ __webpack_require__.r(__webpack_exports__);
142
142
  /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
143
143
  /* harmony export */ });
144
144
  /* harmony import */ var _gettext__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./gettext */ "./gettext.js");
145
-
146
-
147
- /**
148
- * TODO: We need to add description here
149
- * @param {object} translations JSON
150
- * @param {any} plural TODO: No idea obout type
151
- * @returns {object} JSON
152
- */
153
- function buildTextDomain(translations = {}, plural = "n != 1") {
154
- return {
155
- gettext: _gettext__WEBPACK_IMPORTED_MODULE_0__.gettext.bind(null, translations),
156
- ngettext: _gettext__WEBPACK_IMPORTED_MODULE_0__.ngettext.bind(null, translations, plural),
157
- xgettext: _gettext__WEBPACK_IMPORTED_MODULE_0__.xgettext.bind(null, translations),
158
- nxgettext: _gettext__WEBPACK_IMPORTED_MODULE_0__.nxgettext.bind(null, translations, plural)
159
- };
160
- }
161
-
162
- /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (buildTextDomain);
145
+
146
+
147
+ /**
148
+ * TODO: We need to add description here
149
+ * @param {object} translations JSON
150
+ * @param {any} plural TODO: No idea obout type
151
+ * @returns {object} JSON
152
+ */
153
+ function buildTextDomain(translations = {}, plural = "n != 1") {
154
+ return {
155
+ gettext: _gettext__WEBPACK_IMPORTED_MODULE_0__.gettext.bind(null, translations),
156
+ ngettext: _gettext__WEBPACK_IMPORTED_MODULE_0__.ngettext.bind(null, translations, plural),
157
+ xgettext: _gettext__WEBPACK_IMPORTED_MODULE_0__.xgettext.bind(null, translations),
158
+ nxgettext: _gettext__WEBPACK_IMPORTED_MODULE_0__.nxgettext.bind(null, translations, plural)
159
+ };
160
+ }
161
+
162
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (buildTextDomain);
163
163
 
164
164
 
165
165
  /***/ }),
@@ -178,129 +178,129 @@ __webpack_require__.r(__webpack_exports__);
178
178
  /* harmony export */ nxgettext: () => (/* binding */ nxgettext),
179
179
  /* harmony export */ xgettext: () => (/* binding */ xgettext)
180
180
  /* harmony export */ });
181
- const DELIMITER = "\u0004"; // End of Transmission (EOT)
182
-
183
- /**
184
- * TODO: We need to add description here
185
- * @param {any} catalog string or function
186
- * @returns {string} string or string from a function
187
- */
188
- function getTranslations(catalog) {
189
- return typeof catalog === "function" ? catalog() : catalog;
190
- }
191
-
192
- /**
193
- * TODO: We need to add description here
194
- * @param {any} plural string or function
195
- * @param {any} n TODO: No idea what will pass in it
196
- * @returns {any} 0 if nothing
197
- */
198
- function getPluralForm(plural, n) {
199
- // return 0 if n is not integer
200
- if (Number.isNaN(parseInt(n, 10))) {
201
- return 0;
202
- }
203
-
204
- // if pluralForm is function, use it to get plural form index
205
- if (typeof plural === "function") {
206
- return plural(n);
207
- }
208
-
209
- // if pluralForm is string and contains only "n", "0-9", " ", "!=?:%+-/*><&|()"
210
- // characters, then we can "eval" it to calculate plural form
211
- if (typeof plural === "string" && !plural.match(/[^n0-9 !=?:%+-/*><&|()]/i)) {
212
- /* eslint-disable no-new-func */
213
- const calcPlural = Function("n", `return ${plural}`);
214
- /* eslint-enable no-new-func */
215
- return +calcPlural(n);
216
- }
217
-
218
- return 0;
219
- }
220
-
221
- /**
222
- * TODO: We need to add description here
223
- * @param {string} catalog Catalog
224
- * @param {string} message Message
225
- * @returns {string} Message
226
- */
227
- function gettext(catalog, message) {
228
- const messages = getTranslations(catalog);
229
- return Object.prototype.hasOwnProperty.call(messages, message)
230
- ? messages[message]
231
- : message;
232
- }
233
-
234
- /**
235
- * TODO: WE need to add description here
236
- * @param {string} catalog Catalog
237
- * @param {string} plurality Plurality
238
- * @param {string} singular Singular
239
- * @param {string} plural Plural
240
- * @param {number} n n
241
- * @returns {string} Message
242
- */
243
- function ngettext(catalog, plurality, singular, plural, n) {
244
- const messages = getTranslations(catalog);
245
- const pluralIndex = getPluralForm(plurality, n);
246
- const defaultValue = n > 1 ? plural : singular;
247
-
248
- return Object.prototype.hasOwnProperty.call(messages, singular) &&
249
- Array.isArray(messages[singular]) &&
250
- messages[singular].length > pluralIndex &&
251
- pluralIndex >= 0
252
- ? messages[singular][pluralIndex]
253
- : defaultValue;
254
- }
255
-
256
- /**
257
- * TODO: We need to add description here
258
- * @param {string} catalog Catalog
259
- * @param {string} message Message
260
- * @param {string} context Context
261
- * @returns {string} Message
262
- */
263
- function xgettext(catalog, message, context) {
264
- const messages = getTranslations(catalog);
265
- const key = context + DELIMITER + message;
266
-
267
- return Object.prototype.hasOwnProperty.call(messages, key)
268
- ? messages[key]
269
- : message;
270
- }
271
-
272
- /**
273
- * TODO: We need to add description here
274
- * @param {string} catalog Catalog
275
- * @param {string} plurality Plurality
276
- * @param {string} singular Singular
277
- * @param {string} plural Plural
278
- * @param {number} n n
279
- * @param {string} context Context
280
- * @returns {string} Message
281
- */
282
- function nxgettext(catalog, plurality, singular, plural, n, context) {
283
- const messages = getTranslations(catalog);
284
- const pluralIndex = getPluralForm(plurality, n);
285
- const defaultValue = n > 1 ? plural : singular;
286
- const key = context + DELIMITER + singular;
287
-
288
- return Object.prototype.hasOwnProperty.call(messages, key) &&
289
- Array.isArray(messages[key]) &&
290
- messages[key].length > pluralIndex &&
291
- pluralIndex >= 0
292
- ? messages[key][pluralIndex]
293
- : defaultValue;
294
- }
295
-
296
- const allDomain = {
297
- gettext,
298
- ngettext,
299
- xgettext,
300
- nxgettext
301
- };
302
-
303
- /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (allDomain);
181
+ const DELIMITER = "\u0004"; // End of Transmission (EOT)
182
+
183
+ /**
184
+ * TODO: We need to add description here
185
+ * @param {any} catalog string or function
186
+ * @returns {string} string or string from a function
187
+ */
188
+ function getTranslations(catalog) {
189
+ return typeof catalog === "function" ? catalog() : catalog;
190
+ }
191
+
192
+ /**
193
+ * TODO: We need to add description here
194
+ * @param {any} plural string or function
195
+ * @param {any} n TODO: No idea what will pass in it
196
+ * @returns {any} 0 if nothing
197
+ */
198
+ function getPluralForm(plural, n) {
199
+ // return 0 if n is not integer
200
+ if (Number.isNaN(parseInt(n, 10))) {
201
+ return 0;
202
+ }
203
+
204
+ // if pluralForm is function, use it to get plural form index
205
+ if (typeof plural === "function") {
206
+ return plural(n);
207
+ }
208
+
209
+ // if pluralForm is string and contains only "n", "0-9", " ", "!=?:%+-/*><&|()"
210
+ // characters, then we can "eval" it to calculate plural form
211
+ if (typeof plural === "string" && !plural.match(/[^n0-9 !=?:%+-/*><&|()]/i)) {
212
+ /* eslint-disable no-new-func */
213
+ const calcPlural = Function("n", `return ${plural}`);
214
+ /* eslint-enable no-new-func */
215
+ return +calcPlural(n);
216
+ }
217
+
218
+ return 0;
219
+ }
220
+
221
+ /**
222
+ * TODO: We need to add description here
223
+ * @param {string} catalog Catalog
224
+ * @param {string} message Message
225
+ * @returns {string} Message
226
+ */
227
+ function gettext(catalog, message) {
228
+ const messages = getTranslations(catalog);
229
+ return Object.prototype.hasOwnProperty.call(messages, message)
230
+ ? messages[message]
231
+ : message;
232
+ }
233
+
234
+ /**
235
+ * TODO: WE need to add description here
236
+ * @param {string} catalog Catalog
237
+ * @param {string} plurality Plurality
238
+ * @param {string} singular Singular
239
+ * @param {string} plural Plural
240
+ * @param {number} n n
241
+ * @returns {string} Message
242
+ */
243
+ function ngettext(catalog, plurality, singular, plural, n) {
244
+ const messages = getTranslations(catalog);
245
+ const pluralIndex = getPluralForm(plurality, n);
246
+ const defaultValue = n > 1 ? plural : singular;
247
+
248
+ return Object.prototype.hasOwnProperty.call(messages, singular) &&
249
+ Array.isArray(messages[singular]) &&
250
+ messages[singular].length > pluralIndex &&
251
+ pluralIndex >= 0
252
+ ? messages[singular][pluralIndex]
253
+ : defaultValue;
254
+ }
255
+
256
+ /**
257
+ * TODO: We need to add description here
258
+ * @param {string} catalog Catalog
259
+ * @param {string} message Message
260
+ * @param {string} context Context
261
+ * @returns {string} Message
262
+ */
263
+ function xgettext(catalog, message, context) {
264
+ const messages = getTranslations(catalog);
265
+ const key = context + DELIMITER + message;
266
+
267
+ return Object.prototype.hasOwnProperty.call(messages, key)
268
+ ? messages[key]
269
+ : message;
270
+ }
271
+
272
+ /**
273
+ * TODO: We need to add description here
274
+ * @param {string} catalog Catalog
275
+ * @param {string} plurality Plurality
276
+ * @param {string} singular Singular
277
+ * @param {string} plural Plural
278
+ * @param {number} n n
279
+ * @param {string} context Context
280
+ * @returns {string} Message
281
+ */
282
+ function nxgettext(catalog, plurality, singular, plural, n, context) {
283
+ const messages = getTranslations(catalog);
284
+ const pluralIndex = getPluralForm(plurality, n);
285
+ const defaultValue = n > 1 ? plural : singular;
286
+ const key = context + DELIMITER + singular;
287
+
288
+ return Object.prototype.hasOwnProperty.call(messages, key) &&
289
+ Array.isArray(messages[key]) &&
290
+ messages[key].length > pluralIndex &&
291
+ pluralIndex >= 0
292
+ ? messages[key][pluralIndex]
293
+ : defaultValue;
294
+ }
295
+
296
+ const allDomain = {
297
+ gettext,
298
+ ngettext,
299
+ xgettext,
300
+ nxgettext
301
+ };
302
+
303
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (allDomain);
304
304
 
305
305
 
306
306
  /***/ }),
@@ -320,41 +320,41 @@ __webpack_require__.r(__webpack_exports__);
320
320
  /* harmony import */ var hoist_non_react_statics__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! hoist-non-react-statics */ "hoist-non-react-statics");
321
321
  /* harmony import */ var hoist_non_react_statics__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(hoist_non_react_statics__WEBPACK_IMPORTED_MODULE_1__);
322
322
  /* harmony import */ var _TextDomain__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./TextDomain */ "./TextDomain.js");
323
-
324
-
325
-
326
-
327
- const withGettext = (translations = {}, pluralForm = 'n != 1', options = {}) => (WrappedComponent) => {
328
- const args = Object.assign({ withRef: false }, options);
329
-
330
- class WithGettext extends _TextDomain__WEBPACK_IMPORTED_MODULE_2__["default"] {
331
-
332
- getWrappedComponent() {
333
- return this.refs.wrappedComponent;
334
- }
335
-
336
- render() {
337
- const newprops = Object.assign({}, this.props);
338
- if (args.withRef) {
339
- newprops.ref = 'wrappedComponent';
340
- }
341
-
342
- return react__WEBPACK_IMPORTED_MODULE_0___default().createElement(WrappedComponent, newprops);
343
- }
344
-
345
- }
346
-
347
- WithGettext.defaultProps = {
348
- translations,
349
- plural: pluralForm,
350
- };
351
-
352
- WithGettext.displayName = `withGettext(${WrappedComponent.displayName || WrappedComponent.name || 'Component'})`;
353
-
354
- return hoist_non_react_statics__WEBPACK_IMPORTED_MODULE_1___default()(WithGettext, WrappedComponent);
355
- };
356
-
357
- /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (withGettext);
323
+
324
+
325
+
326
+
327
+ const withGettext = (translations = {}, pluralForm = 'n != 1', options = {}) => (WrappedComponent) => {
328
+ const args = Object.assign({ withRef: false }, options);
329
+
330
+ class WithGettext extends _TextDomain__WEBPACK_IMPORTED_MODULE_2__["default"] {
331
+
332
+ getWrappedComponent() {
333
+ return this.refs.wrappedComponent;
334
+ }
335
+
336
+ render() {
337
+ const newprops = Object.assign({}, this.props);
338
+ if (args.withRef) {
339
+ newprops.ref = 'wrappedComponent';
340
+ }
341
+
342
+ return react__WEBPACK_IMPORTED_MODULE_0___default().createElement(WrappedComponent, newprops);
343
+ }
344
+
345
+ }
346
+
347
+ WithGettext.defaultProps = {
348
+ translations,
349
+ plural: pluralForm,
350
+ };
351
+
352
+ WithGettext.displayName = `withGettext(${WrappedComponent.displayName || WrappedComponent.name || 'Component'})`;
353
+
354
+ return hoist_non_react_statics__WEBPACK_IMPORTED_MODULE_1___default()(WithGettext, WrappedComponent);
355
+ };
356
+
357
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (withGettext);
358
358
 
359
359
 
360
360
  /***/ }),
@@ -474,14 +474,14 @@ __webpack_require__.r(__webpack_exports__);
474
474
  /* harmony import */ var _TextDomain__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./TextDomain */ "./TextDomain.js");
475
475
  /* harmony import */ var _TextDomainContext__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./TextDomainContext */ "./TextDomainContext.js");
476
476
  /* harmony import */ var _buildTextDomain__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./buildTextDomain */ "./buildTextDomain.js");
477
-
478
-
479
-
480
-
481
-
482
-
483
-
484
- /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_withGettext__WEBPACK_IMPORTED_MODULE_0__["default"]);
477
+
478
+
479
+
480
+
481
+
482
+
483
+
484
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_withGettext__WEBPACK_IMPORTED_MODULE_0__["default"]);
485
485
 
486
486
  })();
487
487
 
@@ -1 +1 @@
1
- !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("React"),require("hoistNonReactStatic"),require("PropTypes")):"function"==typeof define&&define.amd?define(["React","hoistNonReactStatic","PropTypes"],e):"object"==typeof exports?exports.ReactGettext=e(require("React"),require("hoistNonReactStatic"),require("PropTypes")):t.ReactGettext=e(t.React,t.hoistNonReactStatic,t.PropTypes)}(self,((t,e,n)=>(()=>{"use strict";var r={552:t=>{t.exports=n},624:e=>{e.exports=t},42:t=>{t.exports=e}},o={};function s(t){var e=o[t];if(void 0!==e)return e.exports;var n=o[t]={exports:{}};return r[t](n,n.exports,s),n.exports}s.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return s.d(e,{a:e}),e},s.d=(t,e)=>{for(var n in e)s.o(e,n)&&!s.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},s.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),s.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var a={};return(()=>{s.r(a),s.d(a,{TextDomain:()=>y,TextDomainContext:()=>b,buildTextDomain:()=>g,default:()=>h});var t=s(624),e=s.n(t),n=s(42),r=s.n(n),o=s(552),i=s.n(o);function p(t){return"function"==typeof t?t():t}function c(t,e){return Number.isNaN(parseInt(e,10))?0:"function"==typeof t?t(e):"string"!=typeof t||t.match(/[^n0-9 !=?:%+-/*><&|()]/i)?0:+Function("n",`return ${t}`)(e)}function u(t,e){const n=p(t);return Object.prototype.hasOwnProperty.call(n,e)?n[e]:e}function l(t,e,n,r,o){const s=p(t),a=c(e,o),i=o>1?r:n;return Object.prototype.hasOwnProperty.call(s,n)&&Array.isArray(s[n])&&s[n].length>a&&a>=0?s[n][a]:i}function x(t,e,n){const r=p(t),o=n+""+e;return Object.prototype.hasOwnProperty.call(r,o)?r[o]:e}function f(t,e,n,r,o,s){const a=p(t),i=c(e,o),u=o>1?r:n,l=s+""+n;return Object.prototype.hasOwnProperty.call(a,l)&&Array.isArray(a[l])&&a[l].length>i&&i>=0?a[l][i]:u}class d extends t.Component{getChildContext(){const t=this;return{gettext:t.gettext.bind(t),xgettext:t.xgettext.bind(t),ngettext:t.ngettext.bind(t),nxgettext:t.nxgettext.bind(t)}}gettext(t){const{translations:e}=this.props;return u(e,t)}ngettext(t,e,n){const{translations:r,plural:o}=this.props;return l(r,o,t,e,n)}xgettext(t,e){const{translations:n}=this.props;return x(n,t,e)}nxgettext(t,e,n,r){const{translations:o,plural:s}=this.props;return f(o,s,t,e,n,r)}render(){const{children:t}=this.props;return t}}d.propTypes={translations:i().oneOfType([i().func,i().objectOf(i().oneOfType([i().string,i().arrayOf(i().string)]))]),plural:i().oneOfType([i().func,i().string]),children:i().oneOfType([i().node,i().arrayOf(i().node)])},d.defaultProps={translations:{},plural:"n != 1",children:[]},d.childContextTypes={gettext:i().func,ngettext:i().func,xgettext:i().func,nxgettext:i().func};const y=d,g=function(t={},e="n != 1"){return{gettext:u.bind(null,t),ngettext:l.bind(null,t,e),xgettext:x.bind(null,t),nxgettext:f.bind(null,t,e)}},b=e().createContext(g({},"n != 1")),h=(t={},n="n != 1",o={})=>s=>{const a=Object.assign({withRef:!1},o);class i extends y{getWrappedComponent(){return this.refs.wrappedComponent}render(){const t=Object.assign({},this.props);return a.withRef&&(t.ref="wrappedComponent"),e().createElement(s,t)}}return i.defaultProps={translations:t,plural:n},i.displayName=`withGettext(${s.displayName||s.name||"Component"})`,r()(i,s)}})(),a})()));
1
+ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("React"),require("hoistNonReactStatic"),require("PropTypes")):"function"==typeof define&&define.amd?define(["React","hoistNonReactStatic","PropTypes"],e):"object"==typeof exports?exports.ReactGettext=e(require("React"),require("hoistNonReactStatic"),require("PropTypes")):t.ReactGettext=e(t.React,t.hoistNonReactStatic,t.PropTypes)}(self,((t,e,n)=>(()=>{"use strict";var r={552:t=>{t.exports=n},624:e=>{e.exports=t},42:t=>{t.exports=e}},o={};function s(t){var e=o[t];if(void 0!==e)return e.exports;var n=o[t]={exports:{}};return r[t](n,n.exports,s),n.exports}s.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return s.d(e,{a:e}),e},s.d=(t,e)=>{for(var n in e)s.o(e,n)&&!s.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},s.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),s.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var a={};return(()=>{s.r(a),s.d(a,{Textdomain:()=>y,TextdomainContext:()=>b,buildTextdomain:()=>g,default:()=>h});var t=s(624),e=s.n(t),n=s(42),r=s.n(n),o=s(552),i=s.n(o);function p(t){return"function"==typeof t?t():t}function c(t,e){return Number.isNaN(parseInt(e,10))?0:"function"==typeof t?t(e):"string"!=typeof t||t.match(/[^n0-9 !=?:%+-/*><&|()]/i)?0:+Function("n",`return ${t}`)(e)}function u(t,e){const n=p(t);return Object.prototype.hasOwnProperty.call(n,e)?n[e]:e}function l(t,e,n,r,o){const s=p(t),a=c(e,o),i=o>1?r:n;return Object.prototype.hasOwnProperty.call(s,n)&&Array.isArray(s[n])&&s[n].length>a&&a>=0?s[n][a]:i}function x(t,e,n){const r=p(t),o=n+""+e;return Object.prototype.hasOwnProperty.call(r,o)?r[o]:e}function f(t,e,n,r,o,s){const a=p(t),i=c(e,o),u=o>1?r:n,l=s+""+n;return Object.prototype.hasOwnProperty.call(a,l)&&Array.isArray(a[l])&&a[l].length>i&&i>=0?a[l][i]:u}class d extends t.Component{getChildContext(){const t=this;return{gettext:t.gettext.bind(t),xgettext:t.xgettext.bind(t),ngettext:t.ngettext.bind(t),nxgettext:t.nxgettext.bind(t)}}gettext(t){const{translations:e}=this.props;return u(e,t)}ngettext(t,e,n){const{translations:r,plural:o}=this.props;return l(r,o,t,e,n)}xgettext(t,e){const{translations:n}=this.props;return x(n,t,e)}nxgettext(t,e,n,r){const{translations:o,plural:s}=this.props;return f(o,s,t,e,n,r)}render(){const{children:t}=this.props;return t}}d.propTypes={translations:i().oneOfType([i().func,i().objectOf(i().oneOfType([i().string,i().arrayOf(i().string)]))]),plural:i().oneOfType([i().func,i().string]),children:i().oneOfType([i().node,i().arrayOf(i().node)])},d.defaultProps={translations:{},plural:"n != 1",children:[]},d.childContextTypes={gettext:i().func,ngettext:i().func,xgettext:i().func,nxgettext:i().func};const y=d,g=function(t={},e="n != 1"){return{gettext:u.bind(null,t),ngettext:l.bind(null,t,e),xgettext:x.bind(null,t),nxgettext:f.bind(null,t,e)}},b=e().createContext(g({},"n != 1")),h=(t={},n="n != 1",o={})=>s=>{const a=Object.assign({withRef:!1},o);class i extends y{getWrappedComponent(){return this.refs.wrappedComponent}render(){const t=Object.assign({},this.props);return a.withRef&&(t.ref="wrappedComponent"),e().createElement(s,t)}}return i.defaultProps={translations:t,plural:n},i.displayName=`withGettext(${s.displayName||s.name||"Component"})`,r()(i,s)}})(),a})()));
@@ -5,11 +5,11 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
  var _gettext = require("./gettext");
8
- /**
9
- * TODO: We need to add description here
10
- * @param {object} translations JSON
11
- * @param {any} plural TODO: No idea obout type
12
- * @returns {object} JSON
8
+ /**
9
+ * TODO: We need to add description here
10
+ * @param {object} translations JSON
11
+ * @param {any} plural TODO: No idea obout type
12
+ * @returns {object} JSON
13
13
  */
14
14
  function buildTextDomain() {
15
15
  let translations = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};