1 this["wp"] = this["wp"] || {}; this["wp"]["i18n"] = |
1 /******/ (function() { // webpackBootstrap |
2 /******/ (function(modules) { // webpackBootstrap |
2 /******/ var __webpack_modules__ = ({ |
3 /******/ // The module cache |
3 |
4 /******/ var installedModules = {}; |
4 /***/ 9756: |
5 /******/ |
5 /***/ (function(module) { |
6 /******/ // The require function |
6 |
7 /******/ function __webpack_require__(moduleId) { |
7 /** |
8 /******/ |
8 * Memize options object. |
9 /******/ // Check if module is in cache |
9 * |
10 /******/ if(installedModules[moduleId]) { |
10 * @typedef MemizeOptions |
11 /******/ return installedModules[moduleId].exports; |
11 * |
12 /******/ } |
12 * @property {number} [maxSize] Maximum size of the cache. |
13 /******/ // Create a new module (and put it into the cache) |
13 */ |
14 /******/ var module = installedModules[moduleId] = { |
14 |
15 /******/ i: moduleId, |
15 /** |
16 /******/ l: false, |
16 * Internal cache entry. |
17 /******/ exports: {} |
17 * |
18 /******/ }; |
18 * @typedef MemizeCacheNode |
19 /******/ |
19 * |
20 /******/ // Execute the module function |
20 * @property {?MemizeCacheNode|undefined} [prev] Previous node. |
21 /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); |
21 * @property {?MemizeCacheNode|undefined} [next] Next node. |
22 /******/ |
22 * @property {Array<*>} args Function arguments for cache |
23 /******/ // Flag the module as loaded |
23 * entry. |
24 /******/ module.l = true; |
24 * @property {*} val Function result. |
25 /******/ |
25 */ |
26 /******/ // Return the exports of the module |
26 |
27 /******/ return module.exports; |
27 /** |
28 /******/ } |
28 * Properties of the enhanced function for controlling cache. |
29 /******/ |
29 * |
30 /******/ |
30 * @typedef MemizeMemoizedFunction |
31 /******/ // expose the modules object (__webpack_modules__) |
31 * |
32 /******/ __webpack_require__.m = modules; |
32 * @property {()=>void} clear Clear the cache. |
33 /******/ |
33 */ |
34 /******/ // expose the module cache |
34 |
35 /******/ __webpack_require__.c = installedModules; |
35 /** |
36 /******/ |
36 * Accepts a function to be memoized, and returns a new memoized function, with |
37 /******/ // define getter function for harmony exports |
37 * optional options. |
38 /******/ __webpack_require__.d = function(exports, name, getter) { |
38 * |
39 /******/ if(!__webpack_require__.o(exports, name)) { |
39 * @template {Function} F |
40 /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); |
40 * |
41 /******/ } |
41 * @param {F} fn Function to memoize. |
42 /******/ }; |
42 * @param {MemizeOptions} [options] Options object. |
43 /******/ |
43 * |
44 /******/ // define __esModule on exports |
44 * @return {F & MemizeMemoizedFunction} Memoized function. |
45 /******/ __webpack_require__.r = function(exports) { |
45 */ |
46 /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { |
46 function memize( fn, options ) { |
47 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); |
47 var size = 0; |
48 /******/ } |
48 |
49 /******/ Object.defineProperty(exports, '__esModule', { value: true }); |
49 /** @type {?MemizeCacheNode|undefined} */ |
50 /******/ }; |
50 var head; |
51 /******/ |
51 |
52 /******/ // create a fake namespace object |
52 /** @type {?MemizeCacheNode|undefined} */ |
53 /******/ // mode & 1: value is a module id, require it |
53 var tail; |
54 /******/ // mode & 2: merge all properties of value into the ns |
54 |
55 /******/ // mode & 4: return value when already ns object |
55 options = options || {}; |
56 /******/ // mode & 8|1: behave like require |
56 |
57 /******/ __webpack_require__.t = function(value, mode) { |
57 function memoized( /* ...args */ ) { |
58 /******/ if(mode & 1) value = __webpack_require__(value); |
58 var node = head, |
59 /******/ if(mode & 8) return value; |
59 len = arguments.length, |
60 /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; |
60 args, i; |
61 /******/ var ns = Object.create(null); |
61 |
62 /******/ __webpack_require__.r(ns); |
62 searchCache: while ( node ) { |
63 /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); |
63 // Perform a shallow equality test to confirm that whether the node |
64 /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); |
64 // under test is a candidate for the arguments passed. Two arrays |
65 /******/ return ns; |
65 // are shallowly equal if their length matches and each entry is |
66 /******/ }; |
66 // strictly equal between the two sets. Avoid abstracting to a |
67 /******/ |
67 // function which could incur an arguments leaking deoptimization. |
68 /******/ // getDefaultExport function for compatibility with non-harmony modules |
68 |
69 /******/ __webpack_require__.n = function(module) { |
69 // Check whether node arguments match arguments length |
70 /******/ var getter = module && module.__esModule ? |
70 if ( node.args.length !== arguments.length ) { |
71 /******/ function getDefault() { return module['default']; } : |
71 node = node.next; |
72 /******/ function getModuleExports() { return module; }; |
72 continue; |
73 /******/ __webpack_require__.d(getter, 'a', getter); |
73 } |
74 /******/ return getter; |
74 |
75 /******/ }; |
75 // Check whether node arguments match arguments values |
76 /******/ |
76 for ( i = 0; i < len; i++ ) { |
77 /******/ // Object.prototype.hasOwnProperty.call |
77 if ( node.args[ i ] !== arguments[ i ] ) { |
78 /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; |
78 node = node.next; |
79 /******/ |
79 continue searchCache; |
80 /******/ // __webpack_public_path__ |
80 } |
81 /******/ __webpack_require__.p = ""; |
81 } |
82 /******/ |
82 |
83 /******/ |
83 // At this point we can assume we've found a match |
84 /******/ // Load entry module and return exports |
84 |
85 /******/ return __webpack_require__(__webpack_require__.s = "Vhyj"); |
85 // Surface matched node to head if not already |
86 /******/ }) |
86 if ( node !== head ) { |
87 /************************************************************************/ |
87 // As tail, shift to previous. Must only shift if not also |
88 /******/ ({ |
88 // head, since if both head and tail, there is no previous. |
89 |
89 if ( node === tail ) { |
90 /***/ "4Z/T": |
90 tail = node.prev; |
|
91 } |
|
92 |
|
93 // Adjust siblings to point to each other. If node was tail, |
|
94 // this also handles new tail's empty `next` assignment. |
|
95 /** @type {MemizeCacheNode} */ ( node.prev ).next = node.next; |
|
96 if ( node.next ) { |
|
97 node.next.prev = node.prev; |
|
98 } |
|
99 |
|
100 node.next = head; |
|
101 node.prev = null; |
|
102 /** @type {MemizeCacheNode} */ ( head ).prev = node; |
|
103 head = node; |
|
104 } |
|
105 |
|
106 // Return immediately |
|
107 return node.val; |
|
108 } |
|
109 |
|
110 // No cached value found. Continue to insertion phase: |
|
111 |
|
112 // Create a copy of arguments (avoid leaking deoptimization) |
|
113 args = new Array( len ); |
|
114 for ( i = 0; i < len; i++ ) { |
|
115 args[ i ] = arguments[ i ]; |
|
116 } |
|
117 |
|
118 node = { |
|
119 args: args, |
|
120 |
|
121 // Generate the result from original function |
|
122 val: fn.apply( null, args ), |
|
123 }; |
|
124 |
|
125 // Don't need to check whether node is already head, since it would |
|
126 // have been returned above already if it was |
|
127 |
|
128 // Shift existing head down list |
|
129 if ( head ) { |
|
130 head.prev = node; |
|
131 node.next = head; |
|
132 } else { |
|
133 // If no head, follows that there's no tail (at initial or reset) |
|
134 tail = node; |
|
135 } |
|
136 |
|
137 // Trim tail if we're reached max size and are pending cache insertion |
|
138 if ( size === /** @type {MemizeOptions} */ ( options ).maxSize ) { |
|
139 tail = /** @type {MemizeCacheNode} */ ( tail ).prev; |
|
140 /** @type {MemizeCacheNode} */ ( tail ).next = null; |
|
141 } else { |
|
142 size++; |
|
143 } |
|
144 |
|
145 head = node; |
|
146 |
|
147 return node.val; |
|
148 } |
|
149 |
|
150 memoized.clear = function() { |
|
151 head = null; |
|
152 tail = null; |
|
153 size = 0; |
|
154 }; |
|
155 |
|
156 if ( false ) {} |
|
157 |
|
158 // Ignore reason: There's not a clear solution to create an intersection of |
|
159 // the function with additional properties, where the goal is to retain the |
|
160 // function signature of the incoming argument and add control properties |
|
161 // on the return value. |
|
162 |
|
163 // @ts-ignore |
|
164 return memoized; |
|
165 } |
|
166 |
|
167 module.exports = memize; |
|
168 |
|
169 |
|
170 /***/ }), |
|
171 |
|
172 /***/ 124: |
91 /***/ (function(module, exports, __webpack_require__) { |
173 /***/ (function(module, exports, __webpack_require__) { |
92 |
174 |
93 var __WEBPACK_AMD_DEFINE_RESULT__;/* global window, exports, define */ |
175 var __WEBPACK_AMD_DEFINE_RESULT__;/* global window, exports, define */ |
94 |
176 |
95 !function() { |
177 !function() { |
315 return { |
397 return { |
316 'sprintf': sprintf, |
398 'sprintf': sprintf, |
317 'vsprintf': vsprintf |
399 'vsprintf': vsprintf |
318 } |
400 } |
319 }).call(exports, __webpack_require__, exports, module), |
401 }).call(exports, __webpack_require__, exports, module), |
320 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) |
402 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) |
321 } |
403 } |
322 } |
404 } |
323 /* eslint-enable quote-props */ |
405 /* eslint-enable quote-props */ |
324 }(); // eslint-disable-line |
406 }(); // eslint-disable-line |
325 |
407 |
326 |
408 |
327 /***/ }), |
409 /***/ }) |
328 |
410 |
329 /***/ "4eJC": |
411 /******/ }); |
330 /***/ (function(module, exports, __webpack_require__) { |
412 /************************************************************************/ |
331 |
413 /******/ // The module cache |
332 /** |
414 /******/ var __webpack_module_cache__ = {}; |
333 * Memize options object. |
415 /******/ |
334 * |
416 /******/ // The require function |
335 * @typedef MemizeOptions |
417 /******/ function __webpack_require__(moduleId) { |
336 * |
418 /******/ // Check if module is in cache |
337 * @property {number} [maxSize] Maximum size of the cache. |
419 /******/ var cachedModule = __webpack_module_cache__[moduleId]; |
338 */ |
420 /******/ if (cachedModule !== undefined) { |
339 |
421 /******/ return cachedModule.exports; |
340 /** |
422 /******/ } |
341 * Internal cache entry. |
423 /******/ // Create a new module (and put it into the cache) |
342 * |
424 /******/ var module = __webpack_module_cache__[moduleId] = { |
343 * @typedef MemizeCacheNode |
425 /******/ // no module.id needed |
344 * |
426 /******/ // no module.loaded needed |
345 * @property {?MemizeCacheNode|undefined} [prev] Previous node. |
427 /******/ exports: {} |
346 * @property {?MemizeCacheNode|undefined} [next] Next node. |
428 /******/ }; |
347 * @property {Array<*>} args Function arguments for cache |
429 /******/ |
348 * entry. |
430 /******/ // Execute the module function |
349 * @property {*} val Function result. |
431 /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); |
350 */ |
432 /******/ |
351 |
433 /******/ // Return the exports of the module |
352 /** |
434 /******/ return module.exports; |
353 * Properties of the enhanced function for controlling cache. |
435 /******/ } |
354 * |
436 /******/ |
355 * @typedef MemizeMemoizedFunction |
437 /************************************************************************/ |
356 * |
438 /******/ /* webpack/runtime/compat get default export */ |
357 * @property {()=>void} clear Clear the cache. |
439 /******/ !function() { |
358 */ |
440 /******/ // getDefaultExport function for compatibility with non-harmony modules |
359 |
441 /******/ __webpack_require__.n = function(module) { |
360 /** |
442 /******/ var getter = module && module.__esModule ? |
361 * Accepts a function to be memoized, and returns a new memoized function, with |
443 /******/ function() { return module['default']; } : |
362 * optional options. |
444 /******/ function() { return module; }; |
363 * |
445 /******/ __webpack_require__.d(getter, { a: getter }); |
364 * @template {Function} F |
446 /******/ return getter; |
365 * |
447 /******/ }; |
366 * @param {F} fn Function to memoize. |
448 /******/ }(); |
367 * @param {MemizeOptions} [options] Options object. |
449 /******/ |
368 * |
450 /******/ /* webpack/runtime/define property getters */ |
369 * @return {F & MemizeMemoizedFunction} Memoized function. |
451 /******/ !function() { |
370 */ |
452 /******/ // define getter functions for harmony exports |
371 function memize( fn, options ) { |
453 /******/ __webpack_require__.d = function(exports, definition) { |
372 var size = 0; |
454 /******/ for(var key in definition) { |
373 |
455 /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { |
374 /** @type {?MemizeCacheNode|undefined} */ |
456 /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); |
375 var head; |
457 /******/ } |
376 |
458 /******/ } |
377 /** @type {?MemizeCacheNode|undefined} */ |
459 /******/ }; |
378 var tail; |
460 /******/ }(); |
379 |
461 /******/ |
380 options = options || {}; |
462 /******/ /* webpack/runtime/hasOwnProperty shorthand */ |
381 |
463 /******/ !function() { |
382 function memoized( /* ...args */ ) { |
464 /******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } |
383 var node = head, |
465 /******/ }(); |
384 len = arguments.length, |
466 /******/ |
385 args, i; |
467 /******/ /* webpack/runtime/make namespace object */ |
386 |
468 /******/ !function() { |
387 searchCache: while ( node ) { |
469 /******/ // define __esModule on exports |
388 // Perform a shallow equality test to confirm that whether the node |
470 /******/ __webpack_require__.r = function(exports) { |
389 // under test is a candidate for the arguments passed. Two arrays |
471 /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { |
390 // are shallowly equal if their length matches and each entry is |
472 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); |
391 // strictly equal between the two sets. Avoid abstracting to a |
473 /******/ } |
392 // function which could incur an arguments leaking deoptimization. |
474 /******/ Object.defineProperty(exports, '__esModule', { value: true }); |
393 |
475 /******/ }; |
394 // Check whether node arguments match arguments length |
476 /******/ }(); |
395 if ( node.args.length !== arguments.length ) { |
477 /******/ |
396 node = node.next; |
478 /************************************************************************/ |
397 continue; |
479 var __webpack_exports__ = {}; |
398 } |
480 // This entry need to be wrapped in an IIFE because it need to be in strict mode. |
399 |
481 !function() { |
400 // Check whether node arguments match arguments values |
|
401 for ( i = 0; i < len; i++ ) { |
|
402 if ( node.args[ i ] !== arguments[ i ] ) { |
|
403 node = node.next; |
|
404 continue searchCache; |
|
405 } |
|
406 } |
|
407 |
|
408 // At this point we can assume we've found a match |
|
409 |
|
410 // Surface matched node to head if not already |
|
411 if ( node !== head ) { |
|
412 // As tail, shift to previous. Must only shift if not also |
|
413 // head, since if both head and tail, there is no previous. |
|
414 if ( node === tail ) { |
|
415 tail = node.prev; |
|
416 } |
|
417 |
|
418 // Adjust siblings to point to each other. If node was tail, |
|
419 // this also handles new tail's empty `next` assignment. |
|
420 /** @type {MemizeCacheNode} */ ( node.prev ).next = node.next; |
|
421 if ( node.next ) { |
|
422 node.next.prev = node.prev; |
|
423 } |
|
424 |
|
425 node.next = head; |
|
426 node.prev = null; |
|
427 /** @type {MemizeCacheNode} */ ( head ).prev = node; |
|
428 head = node; |
|
429 } |
|
430 |
|
431 // Return immediately |
|
432 return node.val; |
|
433 } |
|
434 |
|
435 // No cached value found. Continue to insertion phase: |
|
436 |
|
437 // Create a copy of arguments (avoid leaking deoptimization) |
|
438 args = new Array( len ); |
|
439 for ( i = 0; i < len; i++ ) { |
|
440 args[ i ] = arguments[ i ]; |
|
441 } |
|
442 |
|
443 node = { |
|
444 args: args, |
|
445 |
|
446 // Generate the result from original function |
|
447 val: fn.apply( null, args ), |
|
448 }; |
|
449 |
|
450 // Don't need to check whether node is already head, since it would |
|
451 // have been returned above already if it was |
|
452 |
|
453 // Shift existing head down list |
|
454 if ( head ) { |
|
455 head.prev = node; |
|
456 node.next = head; |
|
457 } else { |
|
458 // If no head, follows that there's no tail (at initial or reset) |
|
459 tail = node; |
|
460 } |
|
461 |
|
462 // Trim tail if we're reached max size and are pending cache insertion |
|
463 if ( size === /** @type {MemizeOptions} */ ( options ).maxSize ) { |
|
464 tail = /** @type {MemizeCacheNode} */ ( tail ).prev; |
|
465 /** @type {MemizeCacheNode} */ ( tail ).next = null; |
|
466 } else { |
|
467 size++; |
|
468 } |
|
469 |
|
470 head = node; |
|
471 |
|
472 return node.val; |
|
473 } |
|
474 |
|
475 memoized.clear = function() { |
|
476 head = null; |
|
477 tail = null; |
|
478 size = 0; |
|
479 }; |
|
480 |
|
481 if ( false ) {} |
|
482 |
|
483 // Ignore reason: There's not a clear solution to create an intersection of |
|
484 // the function with additional properties, where the goal is to retain the |
|
485 // function signature of the incoming argument and add control properties |
|
486 // on the return value. |
|
487 |
|
488 // @ts-ignore |
|
489 return memoized; |
|
490 } |
|
491 |
|
492 module.exports = memize; |
|
493 |
|
494 |
|
495 /***/ }), |
|
496 |
|
497 /***/ "Vhyj": |
|
498 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
499 |
|
500 "use strict"; |
482 "use strict"; |
501 // ESM COMPAT FLAG |
483 // ESM COMPAT FLAG |
502 __webpack_require__.r(__webpack_exports__); |
484 __webpack_require__.r(__webpack_exports__); |
503 |
485 |
504 // EXPORTS |
486 // EXPORTS |
505 __webpack_require__.d(__webpack_exports__, "sprintf", function() { return /* reexport */ sprintf_sprintf; }); |
487 __webpack_require__.d(__webpack_exports__, { |
506 __webpack_require__.d(__webpack_exports__, "createI18n", function() { return /* reexport */ createI18n; }); |
488 "__": function() { return /* reexport */ __; }, |
507 __webpack_require__.d(__webpack_exports__, "defaultI18n", function() { return /* reexport */ default_i18n; }); |
489 "_n": function() { return /* reexport */ _n; }, |
508 __webpack_require__.d(__webpack_exports__, "setLocaleData", function() { return /* reexport */ default_i18n_setLocaleData; }); |
490 "_nx": function() { return /* reexport */ _nx; }, |
509 __webpack_require__.d(__webpack_exports__, "resetLocaleData", function() { return /* reexport */ default_i18n_resetLocaleData; }); |
491 "_x": function() { return /* reexport */ _x; }, |
510 __webpack_require__.d(__webpack_exports__, "getLocaleData", function() { return /* reexport */ default_i18n_getLocaleData; }); |
492 "createI18n": function() { return /* reexport */ createI18n; }, |
511 __webpack_require__.d(__webpack_exports__, "subscribe", function() { return /* reexport */ default_i18n_subscribe; }); |
493 "defaultI18n": function() { return /* reexport */ default_i18n; }, |
512 __webpack_require__.d(__webpack_exports__, "__", function() { return /* reexport */ default_i18n_; }); |
494 "getLocaleData": function() { return /* reexport */ getLocaleData; }, |
513 __webpack_require__.d(__webpack_exports__, "_x", function() { return /* reexport */ default_i18n_x; }); |
495 "hasTranslation": function() { return /* reexport */ hasTranslation; }, |
514 __webpack_require__.d(__webpack_exports__, "_n", function() { return /* reexport */ default_i18n_n; }); |
496 "isRTL": function() { return /* reexport */ isRTL; }, |
515 __webpack_require__.d(__webpack_exports__, "_nx", function() { return /* reexport */ default_i18n_nx; }); |
497 "resetLocaleData": function() { return /* reexport */ resetLocaleData; }, |
516 __webpack_require__.d(__webpack_exports__, "isRTL", function() { return /* reexport */ default_i18n_isRTL; }); |
498 "setLocaleData": function() { return /* reexport */ setLocaleData; }, |
517 __webpack_require__.d(__webpack_exports__, "hasTranslation", function() { return /* reexport */ default_i18n_hasTranslation; }); |
499 "sprintf": function() { return /* reexport */ sprintf_sprintf; }, |
|
500 "subscribe": function() { return /* reexport */ subscribe; } |
|
501 }); |
518 |
502 |
519 // EXTERNAL MODULE: ./node_modules/memize/index.js |
503 // EXTERNAL MODULE: ./node_modules/memize/index.js |
520 var memize = __webpack_require__("4eJC"); |
504 var memize = __webpack_require__(9756); |
521 var memize_default = /*#__PURE__*/__webpack_require__.n(memize); |
505 var memize_default = /*#__PURE__*/__webpack_require__.n(memize); |
522 |
|
523 // EXTERNAL MODULE: ./node_modules/sprintf-js/src/sprintf.js |
506 // EXTERNAL MODULE: ./node_modules/sprintf-js/src/sprintf.js |
524 var sprintf = __webpack_require__("4Z/T"); |
507 var sprintf = __webpack_require__(124); |
525 var sprintf_default = /*#__PURE__*/__webpack_require__.n(sprintf); |
508 var sprintf_default = /*#__PURE__*/__webpack_require__.n(sprintf); |
526 |
509 ;// CONCATENATED MODULE: ./node_modules/@wordpress/i18n/build-module/sprintf.js |
527 // CONCATENATED MODULE: ./node_modules/@wordpress/i18n/build-module/sprintf.js |
|
528 /** |
510 /** |
529 * External dependencies |
511 * External dependencies |
530 */ |
512 */ |
531 |
513 |
532 |
514 |
1193 |
1193 |
1194 /** |
1194 /** |
1195 * An i18n instance |
1195 * An i18n instance |
1196 * |
1196 * |
1197 * @typedef I18n |
1197 * @typedef I18n |
1198 * @property {GetLocaleData} getLocaleData Returns locale data by domain in a Jed-formatted JSON object shape. |
1198 * @property {GetLocaleData} getLocaleData Returns locale data by domain in a Jed-formatted JSON object shape. |
1199 * @property {SetLocaleData} setLocaleData Merges locale data into the Tannin instance by domain. Accepts data in a |
1199 * @property {SetLocaleData} setLocaleData Merges locale data into the Tannin instance by domain. Note that this |
|
1200 * function will overwrite the domain configuration. Accepts data in a |
|
1201 * Jed-formatted JSON object shape. |
|
1202 * @property {AddLocaleData} addLocaleData Merges locale data into the Tannin instance by domain. Note that this |
|
1203 * function will also merge the domain configuration. Accepts data in a |
1200 * Jed-formatted JSON object shape. |
1204 * Jed-formatted JSON object shape. |
1201 * @property {ResetLocaleData} resetLocaleData Resets all current Tannin instance locale data and sets the specified |
1205 * @property {ResetLocaleData} resetLocaleData Resets all current Tannin instance locale data and sets the specified |
1202 * locale data for the domain. Accepts data in a Jed-formatted JSON object shape. |
1206 * locale data for the domain. Accepts data in a Jed-formatted JSON object shape. |
1203 * @property {Subscribe} subscribe Subscribes to changes of Tannin locale data. |
1207 * @property {Subscribe} subscribe Subscribes to changes of Tannin locale data. |
1204 * @property {__} __ Retrieve the translation of text. |
1208 * @property {__} __ Retrieve the translation of text. |
1205 * @property {_x} _x Retrieve translated string with gettext context. |
1209 * @property {_x} _x Retrieve translated string with gettext context. |
1206 * @property {_n} _n Translates and retrieves the singular or plural form based on the supplied |
1210 * @property {_n} _n Translates and retrieves the singular or plural form based on the supplied |
1207 * number. |
1211 * number. |
1208 * @property {_nx} _nx Translates and retrieves the singular or plural form based on the supplied |
1212 * @property {_nx} _nx Translates and retrieves the singular or plural form based on the supplied |
1209 * number, with gettext context. |
1213 * number, with gettext context. |
1210 * @property {IsRtl} isRTL Check if current locale is RTL. |
1214 * @property {IsRtl} isRTL Check if current locale is RTL. |
1211 * @property {HasTranslation} hasTranslation Check if there is a translation for a given string. |
1215 * @property {HasTranslation} hasTranslation Check if there is a translation for a given string. |
1212 */ |
1216 */ |
1213 |
1217 |
1214 /** |
1218 /** |
1215 * Create an i18n instance |
1219 * Create an i18n instance |
1216 * |
1220 * |
1217 * @param {LocaleData} [initialData] Locale data configuration. |
1221 * @param {LocaleData} [initialData] Locale data configuration. |
1218 * @param {string} [initialDomain] Domain for which configuration applies. |
1222 * @param {string} [initialDomain] Domain for which configuration applies. |
1219 * @param {Hooks} [hooks] Hooks implementation. |
1223 * @param {Hooks} [hooks] Hooks implementation. |
1220 * @return {I18n} I18n instance |
1224 * |
|
1225 * @return {I18n} I18n instance. |
1221 */ |
1226 */ |
1222 |
1227 |
1223 const createI18n = (initialData, initialDomain, hooks) => { |
1228 const createI18n = (initialData, initialDomain, hooks) => { |
1224 /** |
1229 /** |
1225 * The underlying instance of Tannin to which exported functions interface. |
1230 * The underlying instance of Tannin to which exported functions interface. |
1245 return () => listeners.delete(callback); |
1250 return () => listeners.delete(callback); |
1246 }; |
1251 }; |
1247 /** @type {GetLocaleData} */ |
1252 /** @type {GetLocaleData} */ |
1248 |
1253 |
1249 |
1254 |
1250 const getLocaleData = (domain = 'default') => tannin.data[domain]; |
1255 const getLocaleData = function () { |
|
1256 let domain = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'default'; |
|
1257 return tannin.data[domain]; |
|
1258 }; |
1251 /** |
1259 /** |
1252 * @param {LocaleData} [data] |
1260 * @param {LocaleData} [data] |
1253 * @param {string} [domain] |
1261 * @param {string} [domain] |
1254 */ |
1262 */ |
1255 |
1263 |
1256 |
1264 |
1257 const doSetLocaleData = (data, domain = 'default') => { |
1265 const doSetLocaleData = function (data) { |
1258 tannin.data[domain] = { ...DEFAULT_LOCALE_DATA, |
1266 var _tannin$data$domain; |
1259 ...tannin.data[domain], |
1267 |
|
1268 let domain = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'default'; |
|
1269 tannin.data[domain] = { ...tannin.data[domain], |
1260 ...data |
1270 ...data |
1261 }; // Populate default domain configuration (supported locale date which omits |
1271 }; // Populate default domain configuration (supported locale date which omits |
1262 // a plural forms expression). |
1272 // a plural forms expression). |
1263 |
1273 |
1264 tannin.data[domain][''] = { ...DEFAULT_LOCALE_DATA[''], |
1274 tannin.data[domain][''] = { ...DEFAULT_LOCALE_DATA[''], |
1265 ...tannin.data[domain][''] |
1275 ...((_tannin$data$domain = tannin.data[domain]) === null || _tannin$data$domain === void 0 ? void 0 : _tannin$data$domain['']) |
1266 }; |
1276 }; // Clean up cached plural forms functions cache as it might be updated. |
|
1277 |
|
1278 delete tannin.pluralForms[domain]; |
1267 }; |
1279 }; |
1268 /** @type {SetLocaleData} */ |
1280 /** @type {SetLocaleData} */ |
1269 |
1281 |
1270 |
1282 |
1271 const setLocaleData = (data, domain) => { |
1283 const setLocaleData = (data, domain) => { |
1272 doSetLocaleData(data, domain); |
1284 doSetLocaleData(data, domain); |
|
1285 notifyListeners(); |
|
1286 }; |
|
1287 /** @type {AddLocaleData} */ |
|
1288 |
|
1289 |
|
1290 const addLocaleData = function (data) { |
|
1291 var _tannin$data$domain2; |
|
1292 |
|
1293 let domain = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'default'; |
|
1294 tannin.data[domain] = { ...tannin.data[domain], |
|
1295 ...data, |
|
1296 // Populate default domain configuration (supported locale date which omits |
|
1297 // a plural forms expression). |
|
1298 '': { ...DEFAULT_LOCALE_DATA[''], |
|
1299 ...((_tannin$data$domain2 = tannin.data[domain]) === null || _tannin$data$domain2 === void 0 ? void 0 : _tannin$data$domain2['']), |
|
1300 ...(data === null || data === void 0 ? void 0 : data['']) |
|
1301 } |
|
1302 }; // Clean up cached plural forms functions cache as it might be updated. |
|
1303 |
|
1304 delete tannin.pluralForms[domain]; |
1273 notifyListeners(); |
1305 notifyListeners(); |
1274 }; |
1306 }; |
1275 /** @type {ResetLocaleData} */ |
1307 /** @type {ResetLocaleData} */ |
1276 |
1308 |
1277 |
1309 |
1545 * |
1586 * |
1546 * @param {string} [domain] Domain for which to get the data. |
1587 * @param {string} [domain] Domain for which to get the data. |
1547 * @return {LocaleData} Locale data. |
1588 * @return {LocaleData} Locale data. |
1548 */ |
1589 */ |
1549 |
1590 |
1550 const default_i18n_getLocaleData = i18n.getLocaleData.bind(i18n); |
1591 const getLocaleData = i18n.getLocaleData.bind(i18n); |
1551 /** |
1592 /** |
1552 * Merges locale data into the Tannin instance by domain. Accepts data in a |
1593 * Merges locale data into the Tannin instance by domain. Accepts data in a |
1553 * Jed-formatted JSON object shape. |
1594 * Jed-formatted JSON object shape. |
1554 * |
1595 * |
1555 * @see http://messageformat.github.io/Jed/ |
1596 * @see http://messageformat.github.io/Jed/ |
1556 * |
1597 * |
1557 * @param {LocaleData} [data] Locale data configuration. |
1598 * @param {LocaleData} [data] Locale data configuration. |
1558 * @param {string} [domain] Domain for which configuration applies. |
1599 * @param {string} [domain] Domain for which configuration applies. |
1559 */ |
1600 */ |
1560 |
1601 |
1561 const default_i18n_setLocaleData = i18n.setLocaleData.bind(i18n); |
1602 const setLocaleData = i18n.setLocaleData.bind(i18n); |
1562 /** |
1603 /** |
1563 * Resets all current Tannin instance locale data and sets the specified |
1604 * Resets all current Tannin instance locale data and sets the specified |
1564 * locale data for the domain. Accepts data in a Jed-formatted JSON object shape. |
1605 * locale data for the domain. Accepts data in a Jed-formatted JSON object shape. |
1565 * |
1606 * |
1566 * @see http://messageformat.github.io/Jed/ |
1607 * @see http://messageformat.github.io/Jed/ |
1567 * |
1608 * |
1568 * @param {LocaleData} [data] Locale data configuration. |
1609 * @param {LocaleData} [data] Locale data configuration. |
1569 * @param {string} [domain] Domain for which configuration applies. |
1610 * @param {string} [domain] Domain for which configuration applies. |
1570 */ |
1611 */ |
1571 |
1612 |
1572 const default_i18n_resetLocaleData = i18n.resetLocaleData.bind(i18n); |
1613 const resetLocaleData = i18n.resetLocaleData.bind(i18n); |
1573 /** |
1614 /** |
1574 * Subscribes to changes of locale data |
1615 * Subscribes to changes of locale data |
1575 * |
1616 * |
1576 * @param {SubscribeCallback} callback Subscription callback |
1617 * @param {SubscribeCallback} callback Subscription callback |
1577 * @return {UnsubscribeCallback} Unsubscribe callback |
1618 * @return {UnsubscribeCallback} Unsubscribe callback |
1578 */ |
1619 */ |
1579 |
1620 |
1580 const default_i18n_subscribe = i18n.subscribe.bind(i18n); |
1621 const subscribe = i18n.subscribe.bind(i18n); |
1581 /** |
1622 /** |
1582 * Retrieve the translation of text. |
1623 * Retrieve the translation of text. |
1583 * |
1624 * |
1584 * @see https://developer.wordpress.org/reference/functions/__/ |
1625 * @see https://developer.wordpress.org/reference/functions/__/ |
1585 * |
1626 * |