Add coexistence checks to all enqueue methods to prevent loading both React and Grid.js assets simultaneously. Changes: - ReactAdmin.php: Only enqueue React assets when ?react=1 - Init.php: Skip Grid.js when React active on admin pages - Form.php, Coupon.php, Access.php: Restore classic assets when ?react=0 - Customer.php, Product.php, License.php: Add coexistence checks Now the toggle between Classic and React versions works correctly. Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
151 lines
5.3 KiB
JavaScript
151 lines
5.3 KiB
JavaScript
"use strict";
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
exports.subscribe = exports.setLocaleData = exports.resetLocaleData = exports.isRTL = exports.hasTranslation = exports.getLocaleData = exports.default = exports._x = exports._nx = exports._n = exports.__ = void 0;
|
|
var _createI18n = require("./create-i18n");
|
|
var _hooks = require("@wordpress/hooks");
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
|
|
/**
|
|
* WordPress dependencies
|
|
*/
|
|
|
|
const i18n = (0, _createI18n.createI18n)(undefined, undefined, _hooks.defaultHooks);
|
|
|
|
/**
|
|
* Default, singleton instance of `I18n`.
|
|
*/
|
|
var _default = exports.default = i18n;
|
|
/*
|
|
* Comments in this file are duplicated from ./i18n due to
|
|
* https://github.com/WordPress/gutenberg/pull/20318#issuecomment-590837722
|
|
*/
|
|
/**
|
|
* @typedef {import('./create-i18n').LocaleData} LocaleData
|
|
* @typedef {import('./create-i18n').SubscribeCallback} SubscribeCallback
|
|
* @typedef {import('./create-i18n').UnsubscribeCallback} UnsubscribeCallback
|
|
*/
|
|
/**
|
|
* Returns locale data by domain in a Jed-formatted JSON object shape.
|
|
*
|
|
* @see http://messageformat.github.io/Jed/
|
|
*
|
|
* @param {string} [domain] Domain for which to get the data.
|
|
* @return {LocaleData} Locale data.
|
|
*/
|
|
const getLocaleData = exports.getLocaleData = i18n.getLocaleData.bind(i18n);
|
|
|
|
/**
|
|
* Merges locale data into the Tannin instance by domain. Accepts data in a
|
|
* Jed-formatted JSON object shape.
|
|
*
|
|
* @see http://messageformat.github.io/Jed/
|
|
*
|
|
* @param {LocaleData} [data] Locale data configuration.
|
|
* @param {string} [domain] Domain for which configuration applies.
|
|
*/
|
|
const setLocaleData = exports.setLocaleData = i18n.setLocaleData.bind(i18n);
|
|
|
|
/**
|
|
* Resets all current Tannin instance locale data and sets the specified
|
|
* locale data for the domain. Accepts data in a Jed-formatted JSON object shape.
|
|
*
|
|
* @see http://messageformat.github.io/Jed/
|
|
*
|
|
* @param {LocaleData} [data] Locale data configuration.
|
|
* @param {string} [domain] Domain for which configuration applies.
|
|
*/
|
|
const resetLocaleData = exports.resetLocaleData = i18n.resetLocaleData.bind(i18n);
|
|
|
|
/**
|
|
* Subscribes to changes of locale data
|
|
*
|
|
* @param {SubscribeCallback} callback Subscription callback
|
|
* @return {UnsubscribeCallback} Unsubscribe callback
|
|
*/
|
|
const subscribe = exports.subscribe = i18n.subscribe.bind(i18n);
|
|
|
|
/**
|
|
* Retrieve the translation of text.
|
|
*
|
|
* @see https://developer.wordpress.org/reference/functions/__/
|
|
*
|
|
* @param {string} text Text to translate.
|
|
* @param {string} [domain] Domain to retrieve the translated text.
|
|
*
|
|
* @return {string} Translated text.
|
|
*/
|
|
const __ = exports.__ = i18n.__.bind(i18n);
|
|
|
|
/**
|
|
* Retrieve translated string with gettext context.
|
|
*
|
|
* @see https://developer.wordpress.org/reference/functions/_x/
|
|
*
|
|
* @param {string} text Text to translate.
|
|
* @param {string} context Context information for the translators.
|
|
* @param {string} [domain] Domain to retrieve the translated text.
|
|
*
|
|
* @return {string} Translated context string without pipe.
|
|
*/
|
|
const _x = exports._x = i18n._x.bind(i18n);
|
|
|
|
/**
|
|
* Translates and retrieves the singular or plural form based on the supplied
|
|
* number.
|
|
*
|
|
* @see https://developer.wordpress.org/reference/functions/_n/
|
|
*
|
|
* @param {string} single The text to be used if the number is singular.
|
|
* @param {string} plural The text to be used if the number is plural.
|
|
* @param {number} number The number to compare against to use either the
|
|
* singular or plural form.
|
|
* @param {string} [domain] Domain to retrieve the translated text.
|
|
*
|
|
* @return {string} The translated singular or plural form.
|
|
*/
|
|
const _n = exports._n = i18n._n.bind(i18n);
|
|
|
|
/**
|
|
* Translates and retrieves the singular or plural form based on the supplied
|
|
* number, with gettext context.
|
|
*
|
|
* @see https://developer.wordpress.org/reference/functions/_nx/
|
|
*
|
|
* @param {string} single The text to be used if the number is singular.
|
|
* @param {string} plural The text to be used if the number is plural.
|
|
* @param {number} number The number to compare against to use either the
|
|
* singular or plural form.
|
|
* @param {string} context Context information for the translators.
|
|
* @param {string} [domain] Domain to retrieve the translated text.
|
|
*
|
|
* @return {string} The translated singular or plural form.
|
|
*/
|
|
const _nx = exports._nx = i18n._nx.bind(i18n);
|
|
|
|
/**
|
|
* Check if current locale is RTL.
|
|
*
|
|
* **RTL (Right To Left)** is a locale property indicating that text is written from right to left.
|
|
* For example, the `he` locale (for Hebrew) specifies right-to-left. Arabic (ar) is another common
|
|
* language written RTL. The opposite of RTL, LTR (Left To Right) is used in other languages,
|
|
* including English (`en`, `en-US`, `en-GB`, etc.), Spanish (`es`), and French (`fr`).
|
|
*
|
|
* @return {boolean} Whether locale is RTL.
|
|
*/
|
|
const isRTL = exports.isRTL = i18n.isRTL.bind(i18n);
|
|
|
|
/**
|
|
* Check if there is a translation for a given string (in singular form).
|
|
*
|
|
* @param {string} single Singular form of the string to look up.
|
|
* @param {string} [context] Context information for the translators.
|
|
* @param {string} [domain] Domain to retrieve the translated text.
|
|
* @return {boolean} Whether the translation exists or not.
|
|
*/
|
|
const hasTranslation = exports.hasTranslation = i18n.hasTranslation.bind(i18n);
|
|
//# sourceMappingURL=default-i18n.js.map
|