@wordpress/i18n 6.0.0 → 6.0.1-next.46f643fa0.0
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.
- package/README.md +20 -19
- package/build/create-i18n.js +60 -205
- package/build/create-i18n.js.map +1 -1
- package/build/default-i18n.js +31 -34
- package/build/default-i18n.js.map +1 -1
- package/build/index.js.map +1 -1
- package/build/sprintf.js +3 -4
- package/build/sprintf.js.map +1 -1
- package/build/types.js.map +1 -1
- package/build-module/create-i18n.js +60 -205
- package/build-module/create-i18n.js.map +1 -1
- package/build-module/default-i18n.js +31 -35
- package/build-module/default-i18n.js.map +1 -1
- package/build-module/index.js.map +1 -1
- package/build-module/sprintf.js +3 -4
- package/build-module/sprintf.js.map +1 -1
- package/build-module/types.js.map +1 -1
- package/build-types/create-i18n.d.ts +11 -115
- package/build-types/create-i18n.d.ts.map +1 -1
- package/build-types/default-i18n.d.ts +45 -47
- package/build-types/default-i18n.d.ts.map +1 -1
- package/build-types/index.d.ts +4 -3
- package/build-types/index.d.ts.map +1 -1
- package/build-types/sprintf.d.ts +1 -4
- package/build-types/sprintf.d.ts.map +1 -1
- package/build-types/types.d.ts +101 -0
- package/build-types/types.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/create-i18n.ts +405 -0
- package/src/{default-i18n.js → default-i18n.ts} +37 -35
- package/src/index.ts +16 -0
- package/src/sprintf.ts +4 -10
- package/src/test/{create-i18n.js → create-i18n.ts} +63 -30
- package/src/test/{sprintf.js → sprintf.ts} +5 -1
- package/src/test/{subscribe-i18n.js → subscribe-i18n.ts} +3 -3
- package/src/types.ts +155 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/src/create-i18n.js +0 -514
- /package/src/test/{default-i18n.js → default-i18n.ts} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Tannin","DEFAULT_LOCALE_DATA","plural_forms","n","I18N_HOOK_REGEXP","createI18n","initialData","initialDomain","hooks","tannin","listeners","Set","notifyListeners","forEach","listener","subscribe","callback","add","delete","getLocaleData","domain","data","doSetLocaleData","pluralForms","setLocaleData","addLocaleData","resetLocaleData","dcnpgettext","context","single","plural","number","undefined","getFilterDomain","__","text","translation","applyFilters","_x","_n","_nx","isRTL","hasTranslation","key","result","onHookAddedOrRemoved","hookName","test","addAction"],"sources":["@wordpress/i18n/src/create-i18n.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport Tannin from 'tannin';\n\n/**\n * @typedef {Record<string,any>} LocaleData\n */\n\n/**\n * Default locale data to use for Tannin domain when not otherwise provided.\n * Assumes an English plural forms expression.\n *\n * @type {LocaleData}\n */\nconst DEFAULT_LOCALE_DATA = {\n\t'': {\n\t\t/** @param {number} n */\n\t\tplural_forms( n ) {\n\t\t\treturn n === 1 ? 0 : 1;\n\t\t},\n\t},\n};\n\n/*\n * Regular expression that matches i18n hooks like `i18n.gettext`, `i18n.ngettext`,\n * `i18n.gettext_domain` or `i18n.ngettext_with_context` or `i18n.has_translation`.\n */\nconst I18N_HOOK_REGEXP = /^i18n\\.(n?gettext|has_translation)(_|$)/;\n\n/**\n * @typedef {(domain?: string) => LocaleData} GetLocaleData\n *\n * Returns locale data by domain in a\n * Jed-formatted JSON object shape.\n *\n * @see http://messageformat.github.io/Jed/\n */\n/**\n * @typedef {(data?: LocaleData, domain?: string) => void} SetLocaleData\n *\n * Merges locale data into the Tannin instance by domain. Note that this\n * function will overwrite the domain configuration. Accepts data in a\n * Jed-formatted JSON object shape.\n *\n * @see http://messageformat.github.io/Jed/\n */\n/**\n * @typedef {(data?: LocaleData, domain?: string) => void} AddLocaleData\n *\n * Merges locale data into the Tannin instance by domain. Note that this\n * function will also merge the domain configuration. Accepts data in a\n * Jed-formatted JSON object shape.\n *\n * @see http://messageformat.github.io/Jed/\n */\n/**\n * @typedef {(data?: LocaleData, domain?: string) => void} ResetLocaleData\n *\n * Resets all current Tannin instance locale data and sets the specified\n * locale data for the domain. Accepts data in a Jed-formatted JSON object shape.\n *\n * @see http://messageformat.github.io/Jed/\n */\n/** @typedef {() => void} SubscribeCallback */\n/** @typedef {() => void} UnsubscribeCallback */\n/**\n * @typedef {(callback: SubscribeCallback) => UnsubscribeCallback} Subscribe\n *\n * Subscribes to changes of locale data\n */\n/**\n * @typedef {(domain?: string) => string} GetFilterDomain\n * Retrieve the domain to use when calling domain-specific filters.\n */\n/**\n * @typedef {<Text extends string>(text: Text, domain?: string) => import('./types').TranslatableText< Text >} __\n *\n * Retrieve the translation of text.\n *\n * @see https://developer.wordpress.org/reference/functions/__/\n */\n/**\n * @typedef {<Text extends string>(text: Text, context: string, domain?: string) => import('./types').TranslatableText< Text >} _x\n *\n * Retrieve translated string with gettext context.\n *\n * @see https://developer.wordpress.org/reference/functions/_x/\n */\n/**\n * @typedef {<Single extends string, Plural extends string>(single: Single, plural: Plural, number: number, domain?: string) => import('./types').TranslatableText< Single | Plural >} _n\n *\n * Translates and retrieves the singular or plural form based on the supplied\n * number.\n *\n * @see https://developer.wordpress.org/reference/functions/_n/\n */\n/**\n * @typedef {<Single extends string, Plural extends string>(single: Single, plural: Plural, number: number, context: string, domain?: string) => import('./types').TranslatableText< Single | Plural >} _nx\n *\n * Translates and retrieves the singular or plural form based on the supplied\n * number, with gettext context.\n *\n * @see https://developer.wordpress.org/reference/functions/_nx/\n */\n/**\n * @typedef {() => boolean} IsRtl\n *\n * Check if current locale is RTL.\n *\n * **RTL (Right To Left)** is a locale property indicating that text is written from right to left.\n * For example, the `he` locale (for Hebrew) specifies right-to-left. Arabic (ar) is another common\n * language written RTL. The opposite of RTL, LTR (Left To Right) is used in other languages,\n * including English (`en`, `en-US`, `en-GB`, etc.), Spanish (`es`), and French (`fr`).\n */\n/**\n * @typedef {(single: string, context?: string, domain?: string) => boolean} HasTranslation\n *\n * Check if there is a translation for a given string in singular form.\n */\n/** @typedef {import('@wordpress/hooks').Hooks} Hooks */\n\n/**\n * An i18n instance\n *\n * @typedef I18n\n * @property {GetLocaleData} getLocaleData Returns locale data by domain in a Jed-formatted JSON object shape.\n * @property {SetLocaleData} setLocaleData Merges locale data into the Tannin instance by domain. Note that this\n * function will overwrite the domain configuration. Accepts data in a\n * Jed-formatted JSON object shape.\n * @property {AddLocaleData} addLocaleData Merges locale data into the Tannin instance by domain. Note that this\n * function will also merge the domain configuration. Accepts data in a\n * Jed-formatted JSON object shape.\n * @property {ResetLocaleData} resetLocaleData Resets all current Tannin instance locale data and sets the specified\n * locale data for the domain. Accepts data in a Jed-formatted JSON object shape.\n * @property {Subscribe} subscribe Subscribes to changes of Tannin locale data.\n * @property {__} __ Retrieve the translation of text.\n * @property {_x} _x Retrieve translated string with gettext context.\n * @property {_n} _n Translates and retrieves the singular or plural form based on the supplied\n * number.\n * @property {_nx} _nx Translates and retrieves the singular or plural form based on the supplied\n * number, with gettext context.\n * @property {IsRtl} isRTL Check if current locale is RTL.\n * @property {HasTranslation} hasTranslation Check if there is a translation for a given string.\n */\n\n/**\n * Create an i18n instance\n *\n * @param {LocaleData} [initialData] Locale data configuration.\n * @param {string} [initialDomain] Domain for which configuration applies.\n * @param {Hooks} [hooks] Hooks implementation.\n *\n * @return {I18n} I18n instance.\n */\nexport const createI18n = ( initialData, initialDomain, hooks ) => {\n\t/**\n\t * The underlying instance of Tannin to which exported functions interface.\n\t *\n\t * @type {Tannin}\n\t */\n\tconst tannin = new Tannin( {} );\n\n\tconst listeners = new Set();\n\n\tconst notifyListeners = () => {\n\t\tlisteners.forEach( ( listener ) => listener() );\n\t};\n\n\t/**\n\t * Subscribe to changes of locale data.\n\t *\n\t * @param {SubscribeCallback} callback Subscription callback.\n\t * @return {UnsubscribeCallback} Unsubscribe callback.\n\t */\n\tconst subscribe = ( callback ) => {\n\t\tlisteners.add( callback );\n\t\treturn () => listeners.delete( callback );\n\t};\n\n\t/** @type {GetLocaleData} */\n\tconst getLocaleData = ( domain = 'default' ) => tannin.data[ domain ];\n\n\t/**\n\t * @param {LocaleData} [data]\n\t * @param {string} [domain]\n\t */\n\tconst doSetLocaleData = ( data, domain = 'default' ) => {\n\t\ttannin.data[ domain ] = {\n\t\t\t...tannin.data[ domain ],\n\t\t\t...data,\n\t\t};\n\n\t\t// Populate default domain configuration (supported locale date which omits\n\t\t// a plural forms expression).\n\t\ttannin.data[ domain ][ '' ] = {\n\t\t\t...DEFAULT_LOCALE_DATA[ '' ],\n\t\t\t...tannin.data[ domain ]?.[ '' ],\n\t\t};\n\n\t\t// Clean up cached plural forms functions cache as it might be updated.\n\t\tdelete tannin.pluralForms[ domain ];\n\t};\n\n\t/** @type {SetLocaleData} */\n\tconst setLocaleData = ( data, domain ) => {\n\t\tdoSetLocaleData( data, domain );\n\t\tnotifyListeners();\n\t};\n\n\t/** @type {AddLocaleData} */\n\tconst addLocaleData = ( data, domain = 'default' ) => {\n\t\ttannin.data[ domain ] = {\n\t\t\t...tannin.data[ domain ],\n\t\t\t...data,\n\t\t\t// Populate default domain configuration (supported locale date which omits\n\t\t\t// a plural forms expression).\n\t\t\t'': {\n\t\t\t\t...DEFAULT_LOCALE_DATA[ '' ],\n\t\t\t\t...tannin.data[ domain ]?.[ '' ],\n\t\t\t\t...data?.[ '' ],\n\t\t\t},\n\t\t};\n\n\t\t// Clean up cached plural forms functions cache as it might be updated.\n\t\tdelete tannin.pluralForms[ domain ];\n\n\t\tnotifyListeners();\n\t};\n\n\t/** @type {ResetLocaleData} */\n\tconst resetLocaleData = ( data, domain ) => {\n\t\t// Reset all current Tannin locale data.\n\t\ttannin.data = {};\n\n\t\t// Reset cached plural forms functions cache.\n\t\ttannin.pluralForms = {};\n\n\t\tsetLocaleData( data, domain );\n\t};\n\n\t/**\n\t * Wrapper for Tannin's `dcnpgettext`. Populates default locale data if not\n\t * otherwise previously assigned.\n\t *\n\t * @param {string|undefined} domain Domain to retrieve the translated text.\n\t * @param {string|undefined} context Context information for the translators.\n\t * @param {string} single Text to translate if non-plural. Used as\n\t * fallback return value on a caught error.\n\t * @param {string} [plural] The text to be used if the number is\n\t * plural.\n\t * @param {number} [number] The number to compare against to use\n\t * either the singular or plural form.\n\t *\n\t * @return {string} The translated string.\n\t */\n\tconst dcnpgettext = (\n\t\tdomain = 'default',\n\t\tcontext,\n\t\tsingle,\n\t\tplural,\n\t\tnumber\n\t) => {\n\t\tif ( ! tannin.data[ domain ] ) {\n\t\t\t// Use `doSetLocaleData` to set silently, without notifying listeners.\n\t\t\tdoSetLocaleData( undefined, domain );\n\t\t}\n\n\t\treturn tannin.dcnpgettext( domain, context, single, plural, number );\n\t};\n\n\t/** @type {GetFilterDomain} */\n\tconst getFilterDomain = ( domain = 'default' ) => domain;\n\n\t/** @type {__} */\n\tconst __ = ( text, domain ) => {\n\t\tlet translation = dcnpgettext( domain, undefined, text );\n\t\tif ( ! hooks ) {\n\t\t\treturn /** @type {import('./types').TranslatableText<typeof text>} */ (\n\t\t\t\ttranslation\n\t\t\t);\n\t\t}\n\n\t\t/**\n\t\t * Filters text with its translation.\n\t\t *\n\t\t * @param {string} translation Translated text.\n\t\t * @param {string} text Text to translate.\n\t\t * @param {string} domain Text domain. Unique identifier for retrieving translated strings.\n\t\t */\n\t\ttranslation = /** @type {string} */ (\n\t\t\t/** @type {*} */ hooks.applyFilters(\n\t\t\t\t'i18n.gettext',\n\t\t\t\ttranslation,\n\t\t\t\ttext,\n\t\t\t\tdomain\n\t\t\t)\n\t\t);\n\t\treturn /** @type {import('./types').TranslatableText<typeof text>} */ (\n\t\t\t/** @type {*} */ hooks.applyFilters(\n\t\t\t\t'i18n.gettext_' + getFilterDomain( domain ),\n\t\t\t\ttranslation,\n\t\t\t\ttext,\n\t\t\t\tdomain\n\t\t\t)\n\t\t);\n\t};\n\n\t/** @type {_x} */\n\tconst _x = ( text, context, domain ) => {\n\t\tlet translation = dcnpgettext( domain, context, text );\n\t\tif ( ! hooks ) {\n\t\t\treturn /** @type {import('./types').TranslatableText<typeof text>} */ (\n\t\t\t\ttranslation\n\t\t\t);\n\t\t}\n\n\t\t/**\n\t\t * Filters text with its translation based on context information.\n\t\t *\n\t\t * @param {string} translation Translated text.\n\t\t * @param {string} text Text to translate.\n\t\t * @param {string} context Context information for the translators.\n\t\t * @param {string} domain Text domain. Unique identifier for retrieving translated strings.\n\t\t */\n\t\ttranslation = /** @type {string} */ (\n\t\t\t/** @type {*} */ hooks.applyFilters(\n\t\t\t\t'i18n.gettext_with_context',\n\t\t\t\ttranslation,\n\t\t\t\ttext,\n\t\t\t\tcontext,\n\t\t\t\tdomain\n\t\t\t)\n\t\t);\n\t\treturn /** @type {import('./types').TranslatableText<typeof text>} */ (\n\t\t\t/** @type {*} */ hooks.applyFilters(\n\t\t\t\t'i18n.gettext_with_context_' + getFilterDomain( domain ),\n\t\t\t\ttranslation,\n\t\t\t\ttext,\n\t\t\t\tcontext,\n\t\t\t\tdomain\n\t\t\t)\n\t\t);\n\t};\n\n\t/** @type {_n} */\n\tconst _n = ( single, plural, number, domain ) => {\n\t\tlet translation = dcnpgettext(\n\t\t\tdomain,\n\t\t\tundefined,\n\t\t\tsingle,\n\t\t\tplural,\n\t\t\tnumber\n\t\t);\n\t\tif ( ! hooks ) {\n\t\t\treturn /** @type {import('./types').TranslatableText<typeof single | typeof plural>} */ (\n\t\t\t\ttranslation\n\t\t\t);\n\t\t}\n\n\t\t/**\n\t\t * Filters the singular or plural form of a string.\n\t\t *\n\t\t * @param {string} translation Translated text.\n\t\t * @param {string} single The text to be used if the number is singular.\n\t\t * @param {string} plural The text to be used if the number is plural.\n\t\t * @param {string} number The number to compare against to use either the singular or plural form.\n\t\t * @param {string} domain Text domain. Unique identifier for retrieving translated strings.\n\t\t */\n\t\ttranslation = /** @type {string} */ (\n\t\t\t/** @type {*} */ hooks.applyFilters(\n\t\t\t\t'i18n.ngettext',\n\t\t\t\ttranslation,\n\t\t\t\tsingle,\n\t\t\t\tplural,\n\t\t\t\tnumber,\n\t\t\t\tdomain\n\t\t\t)\n\t\t);\n\t\treturn /** @type {import('./types').TranslatableText<typeof single | typeof plural>} */ (\n\t\t\t/** @type {*} */ hooks.applyFilters(\n\t\t\t\t'i18n.ngettext_' + getFilterDomain( domain ),\n\t\t\t\ttranslation,\n\t\t\t\tsingle,\n\t\t\t\tplural,\n\t\t\t\tnumber,\n\t\t\t\tdomain\n\t\t\t)\n\t\t);\n\t};\n\n\t/** @type {_nx} */\n\tconst _nx = ( single, plural, number, context, domain ) => {\n\t\tlet translation = dcnpgettext(\n\t\t\tdomain,\n\t\t\tcontext,\n\t\t\tsingle,\n\t\t\tplural,\n\t\t\tnumber\n\t\t);\n\t\tif ( ! hooks ) {\n\t\t\treturn /** @type {import('./types').TranslatableText<typeof single | typeof plural>} */ (\n\t\t\t\ttranslation\n\t\t\t);\n\t\t}\n\n\t\t/**\n\t\t * Filters the singular or plural form of a string with gettext context.\n\t\t *\n\t\t * @param {string} translation Translated text.\n\t\t * @param {string} single The text to be used if the number is singular.\n\t\t * @param {string} plural The text to be used if the number is plural.\n\t\t * @param {string} number The number to compare against to use either the singular or plural form.\n\t\t * @param {string} context Context information for the translators.\n\t\t * @param {string} domain Text domain. Unique identifier for retrieving translated strings.\n\t\t */\n\t\ttranslation = /** @type {string} */ (\n\t\t\t/** @type {*} */ hooks.applyFilters(\n\t\t\t\t'i18n.ngettext_with_context',\n\t\t\t\ttranslation,\n\t\t\t\tsingle,\n\t\t\t\tplural,\n\t\t\t\tnumber,\n\t\t\t\tcontext,\n\t\t\t\tdomain\n\t\t\t)\n\t\t);\n\n\t\treturn /** @type {import('./types').TranslatableText<typeof single | typeof plural>} */ (\n\t\t\t/** @type {*} */ hooks.applyFilters(\n\t\t\t\t'i18n.ngettext_with_context_' + getFilterDomain( domain ),\n\t\t\t\ttranslation,\n\t\t\t\tsingle,\n\t\t\t\tplural,\n\t\t\t\tnumber,\n\t\t\t\tcontext,\n\t\t\t\tdomain\n\t\t\t)\n\t\t);\n\t};\n\n\t/** @type {IsRtl} */\n\tconst isRTL = () => {\n\t\treturn 'rtl' === _x( 'ltr', 'text direction' );\n\t};\n\n\t/** @type {HasTranslation} */\n\tconst hasTranslation = ( single, context, domain ) => {\n\t\tconst key = context ? context + '\\u0004' + single : single;\n\t\tlet result = !! tannin.data?.[ domain ?? 'default' ]?.[ key ];\n\t\tif ( hooks ) {\n\t\t\t/**\n\t\t\t * Filters the presence of a translation in the locale data.\n\t\t\t *\n\t\t\t * @param {boolean} hasTranslation Whether the translation is present or not..\n\t\t\t * @param {string} single The singular form of the translated text (used as key in locale data)\n\t\t\t * @param {string} context Context information for the translators.\n\t\t\t * @param {string} domain Text domain. Unique identifier for retrieving translated strings.\n\t\t\t */\n\t\t\tresult = /** @type { boolean } */ (\n\t\t\t\t/** @type {*} */ hooks.applyFilters(\n\t\t\t\t\t'i18n.has_translation',\n\t\t\t\t\tresult,\n\t\t\t\t\tsingle,\n\t\t\t\t\tcontext,\n\t\t\t\t\tdomain\n\t\t\t\t)\n\t\t\t);\n\n\t\t\tresult = /** @type { boolean } */ (\n\t\t\t\t/** @type {*} */ hooks.applyFilters(\n\t\t\t\t\t'i18n.has_translation_' + getFilterDomain( domain ),\n\t\t\t\t\tresult,\n\t\t\t\t\tsingle,\n\t\t\t\t\tcontext,\n\t\t\t\t\tdomain\n\t\t\t\t)\n\t\t\t);\n\t\t}\n\t\treturn result;\n\t};\n\n\tif ( initialData ) {\n\t\tsetLocaleData( initialData, initialDomain );\n\t}\n\n\tif ( hooks ) {\n\t\t/**\n\t\t * @param {string} hookName\n\t\t */\n\t\tconst onHookAddedOrRemoved = ( hookName ) => {\n\t\t\tif ( I18N_HOOK_REGEXP.test( hookName ) ) {\n\t\t\t\tnotifyListeners();\n\t\t\t}\n\t\t};\n\n\t\thooks.addAction( 'hookAdded', 'core/i18n', onHookAddedOrRemoved );\n\t\thooks.addAction( 'hookRemoved', 'core/i18n', onHookAddedOrRemoved );\n\t}\n\n\treturn {\n\t\tgetLocaleData,\n\t\tsetLocaleData,\n\t\taddLocaleData,\n\t\tresetLocaleData,\n\t\tsubscribe,\n\t\t__,\n\t\t_x,\n\t\t_n,\n\t\t_nx,\n\t\tisRTL,\n\t\thasTranslation,\n\t};\n};\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,MAAM,MAAM,QAAQ;;AAE3B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,mBAAmB,GAAG;EAC3B,EAAE,EAAE;IACH;IACAC,YAAYA,CAAEC,CAAC,EAAG;MACjB,OAAOA,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC;IACvB;EACD;AACD,CAAC;;AAED;AACA;AACA;AACA;AACA,MAAMC,gBAAgB,GAAG,yCAAyC;;AAElE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,UAAU,GAAGA,CAAEC,WAAW,EAAEC,aAAa,EAAEC,KAAK,KAAM;EAClE;AACD;AACA;AACA;AACA;EACC,MAAMC,MAAM,GAAG,IAAIT,MAAM,CAAE,CAAC,CAAE,CAAC;EAE/B,MAAMU,SAAS,GAAG,IAAIC,GAAG,CAAC,CAAC;EAE3B,MAAMC,eAAe,GAAGA,CAAA,KAAM;IAC7BF,SAAS,CAACG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AACA;AACA;AACA;AACA;MACGoC,MAAM,GAAG;MACR,gBAAiBpC,KAAK,CAAC6B,YAAY,CAClC,sBAAsB,EACtBO,MAAM,EACNf,MAAM,EACND,OAAO,EACPR,MACD,CACA;MAEDwB,MAAM,GAAG;MACR,gBAAiBpC,KAAK,CAAC6B,YAAY,CAClC,uBAAuB,GAAGJ,eAAe,CAAEb,MAAO,CAAC,EACnDwB,MAAM,EACNf,MAAM,EACND,OAAO,EACPR,MACD,CACA;IACF;IACA,OAAOwB,MAAM;EACd,CAAC;EAED,IAAKtC,WAAW,EAAG;IAClBkB,aAAa,CAAElB,WAAW,EAAEC,aAAc,CAAC;EAC5C;EAEA,IAAKC,KAAK,EAAG;IACZ;AACF;AACA;IACE,MAAMqC,oBAAoB,GAAKC,QAAQ,IAAM;MAC5C,IAAK1C,gBAAgB,CAAC2C,IAAI,CAAED,QAAS,CAAC,EAAG;QACxClC,eAAe,CAAC,CAAC;MAClB;IACD,CAAC;IAEDJ,KAAK,CAACwC,SAAS,CAAE,WAAW,EAAE,WAAW,EAAEH,oBAAqB,CAAC;IACjErC,KAAK,CAACwC,SAAS,CAAE,aAAa,EAAE,WAAW,EAAEH,oBAAqB,CAAC;EACpE;EAEA,OAAO;IACN1B,aAAa;IACbK,aAAa;IACbC,aAAa;IACbC,eAAe;IACfX,SAAS;IACTmB,EAAE;IACFI,EAAE;IACFC,EAAE;IACFC,GAAG;IACHC,KAAK;IACLC;EACD,CAAC;AACF,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["Tannin","DEFAULT_LOCALE_DATA","plural_forms","n","I18N_HOOK_REGEXP","createI18n","initialData","initialDomain","hooks","tannin","listeners","Set","notifyListeners","forEach","listener","subscribe","callback","add","delete","getLocaleData","domain","data","doSetLocaleData","pluralForms","setLocaleData","addLocaleData","resetLocaleData","dcnpgettext","context","single","plural","number","undefined","getFilterDomain","__","text","translation","applyFilters","_x","_n","_nx","isRTL","hasTranslation","key","result","onHookAddedOrRemoved","hookName","test","addAction"],"sources":["@wordpress/i18n/src/create-i18n.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { TanninLocaleDomain } from 'tannin';\nimport Tannin from 'tannin';\n/**\n * Internal dependencies\n */\nimport type {\n\tgetFilterDomain,\n\tI18n,\n\tLocaleData,\n\tSubscribeCallback,\n\tTranslatableText,\n\tUnsubscribeCallback,\n} from './types';\n/**\n * WordPress dependencies\n */\nimport type { Hooks } from '@wordpress/hooks';\n/**\n * Default locale data to use for Tannin domain when not otherwise provided.\n * Assumes an English plural forms expression.\n */\nconst DEFAULT_LOCALE_DATA: LocaleData = {\n\t'': {\n\t\tplural_forms( n: number ) {\n\t\t\treturn n === 1 ? 0 : 1;\n\t\t},\n\t},\n};\n\n/*\n * Regular expression that matches i18n hooks like `i18n.gettext`, `i18n.ngettext`,\n * `i18n.gettext_domain` or `i18n.ngettext_with_context` or `i18n.has_translation`.\n */\nconst I18N_HOOK_REGEXP = /^i18n\\.(n?gettext|has_translation)(_|$)/;\n\n/**\n * Create an i18n instance\n *\n * @param [initialData] Locale data configuration.\n * @param [initialDomain] Domain for which configuration applies.\n * @param [hooks] Hooks implementation.\n *\n * @return I18n instance.\n */\nexport const createI18n = < TextDomain extends string >(\n\tinitialData?: LocaleData< TextDomain >,\n\tinitialDomain?: TextDomain,\n\thooks?: Hooks\n): I18n< TextDomain > => {\n\t/**\n\t * The underlying instance of Tannin to which exported functions interface.\n\t */\n\tconst tannin = new Tannin( {} );\n\n\tconst listeners = new Set< () => void >();\n\n\tconst notifyListeners = () => {\n\t\tlisteners.forEach( ( listener ) => listener() );\n\t};\n\n\t/**\n\t * Subscribe to changes of locale data.\n\t *\n\t * @param callback Subscription callback.\n\t * @return Unsubscribe callback.\n\t */\n\tconst subscribe = ( callback: SubscribeCallback ): UnsubscribeCallback => {\n\t\tlisteners.add( callback );\n\t\treturn () => listeners.delete( callback );\n\t};\n\n\tconst getLocaleData: I18n< TextDomain >[ 'getLocaleData' ] = (\n\t\tdomain = 'default' as TextDomain\n\t) => tannin.data[ domain ] as LocaleData< TextDomain >;\n\n\t/**\n\t * @param [data]\n\t * @param [domain]\n\t */\n\tconst doSetLocaleData = (\n\t\tdata?: LocaleData,\n\t\tdomain: TextDomain = 'default' as TextDomain\n\t) => {\n\t\ttannin.data[ domain ] = {\n\t\t\t...tannin.data[ domain ],\n\t\t\t...data,\n\t\t} as TanninLocaleDomain;\n\n\t\t// Populate default domain configuration (supported locale date which omits\n\t\t// a plural forms expression).\n\t\ttannin.data[ domain ][ '' ] = {\n\t\t\t...DEFAULT_LOCALE_DATA[ '' ],\n\t\t\t...tannin.data[ domain ]?.[ '' ],\n\t\t};\n\n\t\t// Clean up cached plural forms functions cache as it might be updated.\n\t\tdelete tannin.pluralForms[ domain ];\n\t};\n\n\tconst setLocaleData: I18n< TextDomain >[ 'setLocaleData' ] = (\n\t\tdata,\n\t\tdomain\n\t) => {\n\t\tdoSetLocaleData( data, domain );\n\t\tnotifyListeners();\n\t};\n\n\tconst addLocaleData: I18n< TextDomain >[ 'addLocaleData' ] = (\n\t\tdata,\n\t\tdomain = 'default' as TextDomain\n\t) => {\n\t\ttannin.data[ domain ] = {\n\t\t\t...tannin.data[ domain ],\n\t\t\t...data,\n\t\t\t// Populate default domain configuration (supported locale date which omits\n\t\t\t// a plural forms expression).\n\t\t\t'': {\n\t\t\t\t...DEFAULT_LOCALE_DATA[ '' ],\n\t\t\t\t...tannin.data[ domain ]?.[ '' ],\n\t\t\t\t...data?.[ '' ],\n\t\t\t},\n\t\t} as TanninLocaleDomain;\n\n\t\t// Clean up cached plural forms functions cache as it might be updated.\n\t\tdelete tannin.pluralForms[ domain ];\n\n\t\tnotifyListeners();\n\t};\n\n\tconst resetLocaleData: I18n< TextDomain >[ 'resetLocaleData' ] = (\n\t\tdata,\n\t\tdomain\n\t) => {\n\t\t// Reset all current Tannin locale data.\n\t\ttannin.data = {};\n\n\t\t// Reset cached plural forms functions cache.\n\t\ttannin.pluralForms = {};\n\n\t\tsetLocaleData( data, domain );\n\t};\n\n\t/**\n\t * Wrapper for Tannin's `dcnpgettext`. Populates default locale data if not\n\t * otherwise previously assigned.\n\t *\n\t * @param domain Domain to retrieve the translated text.\n\t * @param context Context information for the translators.\n\t * @param single Text to translate if non-plural. Used as\n\t * fallback return value on a caught error.\n\t * @param [plural] The text to be used if the number is\n\t * plural.\n\t * @param [number] The number to compare against to use\n\t * either the singular or plural form.\n\t *\n\t * @return The translated string.\n\t */\n\tconst dcnpgettext = (\n\t\tdomain = 'default' as TextDomain,\n\t\tcontext: string | void,\n\t\tsingle: string,\n\t\tplural?: string,\n\t\tnumber?: number\n\t): string => {\n\t\tif ( ! tannin.data[ domain ] ) {\n\t\t\t// Use `doSetLocaleData` to set silently, without notifying listeners.\n\t\t\tdoSetLocaleData( undefined, domain );\n\t\t}\n\n\t\treturn tannin.dcnpgettext( domain, context, single, plural, number );\n\t};\n\n\tconst getFilterDomain: getFilterDomain = ( domain ) => domain || 'default';\n\n\tconst __: I18n< TextDomain >[ '__' ] = ( text, domain ) => {\n\t\tlet translation = dcnpgettext( domain, undefined, text );\n\t\tif ( ! hooks ) {\n\t\t\treturn translation as TranslatableText< typeof text >;\n\t\t}\n\n\t\t/**\n\t\t * Filters text with its translation.\n\t\t *\n\t\t * @param translation Translated text.\n\t\t * @param text Text to translate.\n\t\t * @param domain Text domain. Unique identifier for retrieving translated strings.\n\t\t */\n\t\ttranslation = hooks.applyFilters(\n\t\t\t'i18n.gettext',\n\t\t\ttranslation,\n\t\t\ttext,\n\t\t\tdomain\n\t\t) as TranslatableText< typeof text >;\n\n\t\treturn hooks.applyFilters(\n\t\t\t'i18n.gettext_' + getFilterDomain( domain ),\n\t\t\ttranslation,\n\t\t\ttext,\n\t\t\tdomain\n\t\t) as TranslatableText< typeof text >;\n\t};\n\n\tconst _x: I18n< TextDomain >[ '_x' ] = ( text, context, domain ) => {\n\t\tlet translation = dcnpgettext( domain, context, text );\n\t\tif ( ! hooks ) {\n\t\t\treturn translation as TranslatableText< typeof text >;\n\t\t}\n\n\t\t/**\n\t\t * Filters text with its translation based on context information.\n\t\t *\n\t\t * @param translation Translated text.\n\t\t * @param text Text to translate.\n\t\t * @param context Context information for the translators.\n\t\t * @param domain Text domain. Unique identifier for retrieving translated strings.\n\t\t */\n\t\ttranslation = hooks.applyFilters(\n\t\t\t'i18n.gettext_with_context',\n\t\t\ttranslation,\n\t\t\ttext,\n\t\t\tcontext,\n\t\t\tdomain\n\t\t) as TranslatableText< typeof text >;\n\n\t\treturn hooks.applyFilters(\n\t\t\t'i18n.gettext_with_context_' + getFilterDomain( domain ),\n\t\t\ttranslation,\n\t\t\ttext,\n\t\t\tcontext,\n\t\t\tdomain\n\t\t) as TranslatableText< typeof text >;\n\t};\n\n\tconst _n: I18n< TextDomain >[ '_n' ] = (\n\t\tsingle,\n\t\tplural,\n\t\tnumber,\n\t\tdomain\n\t) => {\n\t\tlet translation = dcnpgettext(\n\t\t\tdomain,\n\t\t\tundefined,\n\t\t\tsingle,\n\t\t\tplural,\n\t\t\tnumber\n\t\t);\n\t\tif ( ! hooks ) {\n\t\t\treturn translation as TranslatableText<\n\t\t\t\ttypeof single | typeof plural\n\t\t\t>;\n\t\t}\n\n\t\t/**\n\t\t * Filters the singular or plural form of a string.\n\t\t *\n\t\t * @param translation Translated text.\n\t\t * @param single The text to be used if the number is singular.\n\t\t * @param plural The text to be used if the number is plural.\n\t\t * @param number The number to compare against to use either the singular or plural form.\n\t\t * @param domain Text domain. Unique identifier for retrieving translated strings.\n\t\t */\n\t\ttranslation = hooks.applyFilters(\n\t\t\t'i18n.ngettext',\n\t\t\ttranslation,\n\t\t\tsingle,\n\t\t\tplural,\n\t\t\tnumber,\n\t\t\tdomain\n\t\t) as TranslatableText< typeof single | typeof plural >;\n\n\t\treturn hooks.applyFilters(\n\t\t\t'i18n.ngettext_' + getFilterDomain( domain ),\n\t\t\ttranslation,\n\t\t\tsingle,\n\t\t\tplural,\n\t\t\tnumber,\n\t\t\tdomain\n\t\t) as TranslatableText< typeof single | typeof plural >;\n\t};\n\n\tconst _nx: I18n< TextDomain >[ '_nx' ] = (\n\t\tsingle,\n\t\tplural,\n\t\tnumber,\n\t\tcontext,\n\t\tdomain\n\t) => {\n\t\tlet translation = dcnpgettext(\n\t\t\tdomain,\n\t\t\tcontext,\n\t\t\tsingle,\n\t\t\tplural,\n\t\t\tnumber\n\t\t);\n\t\tif ( ! hooks ) {\n\t\t\treturn translation as TranslatableText<\n\t\t\t\ttypeof single | typeof plural\n\t\t\t>;\n\t\t}\n\n\t\t/**\n\t\t * Filters the singular or plural form of a string with gettext context.\n\t\t *\n\t\t * @param translation Translated text.\n\t\t * @param single The text to be used if the number is singular.\n\t\t * @param plural The text to be used if the number is plural.\n\t\t * @param number The number to compare against to use either the singular or plural form.\n\t\t * @param context Context information for the translators.\n\t\t * @param domain Text domain. Unique identifier for retrieving translated strings.\n\t\t */\n\t\ttranslation = hooks.applyFilters(\n\t\t\t'i18n.ngettext_with_context',\n\t\t\ttranslation,\n\t\t\tsingle,\n\t\t\tplural,\n\t\t\tnumber,\n\t\t\tcontext,\n\t\t\tdomain\n\t\t) as TranslatableText< typeof single | typeof plural >;\n\n\t\treturn hooks.applyFilters(\n\t\t\t'i18n.ngettext_with_context_' + getFilterDomain( domain ),\n\t\t\ttranslation,\n\t\t\tsingle,\n\t\t\tplural,\n\t\t\tnumber,\n\t\t\tcontext,\n\t\t\tdomain\n\t\t) as TranslatableText< typeof single | typeof plural >;\n\t};\n\n\tconst isRTL: I18n< TextDomain >[ 'isRTL' ] = () => {\n\t\treturn 'rtl' === _x( 'ltr', 'text direction' );\n\t};\n\n\tconst hasTranslation: I18n< TextDomain >[ 'hasTranslation' ] = (\n\t\tsingle,\n\t\tcontext,\n\t\tdomain\n\t) => {\n\t\tconst key = context ? context + '\\u0004' + single : single;\n\t\tlet result = !! tannin.data?.[ domain ?? 'default' ]?.[ key ];\n\t\tif ( hooks ) {\n\t\t\t/**\n\t\t\t * Filters the presence of a translation in the locale data.\n\t\t\t *\n\t\t\t * @param hasTranslation Whether the translation is present or not..\n\t\t\t * @param single The singular form of the translated text (used as key in locale data)\n\t\t\t * @param context Context information for the translators.\n\t\t\t * @param domain Text domain. Unique identifier for retrieving translated strings.\n\t\t\t */\n\t\t\tresult = hooks.applyFilters(\n\t\t\t\t'i18n.has_translation',\n\t\t\t\tresult,\n\t\t\t\tsingle,\n\t\t\t\tcontext,\n\t\t\t\tdomain\n\t\t\t) as boolean;\n\n\t\t\tresult = hooks.applyFilters(\n\t\t\t\t'i18n.has_translation_' + getFilterDomain( domain ),\n\t\t\t\tresult,\n\t\t\t\tsingle,\n\t\t\t\tcontext,\n\t\t\t\tdomain\n\t\t\t) as boolean;\n\t\t}\n\t\treturn result;\n\t};\n\n\tif ( initialData ) {\n\t\tsetLocaleData( initialData, initialDomain );\n\t}\n\n\tif ( hooks ) {\n\t\t/**\n\t\t * @param hookName\n\t\t */\n\t\tconst onHookAddedOrRemoved = ( hookName: string ) => {\n\t\t\tif ( I18N_HOOK_REGEXP.test( hookName ) ) {\n\t\t\t\tnotifyListeners();\n\t\t\t}\n\t\t};\n\n\t\thooks.addAction( 'hookAdded', 'core/i18n', onHookAddedOrRemoved );\n\t\thooks.addAction( 'hookRemoved', 'core/i18n', onHookAddedOrRemoved );\n\t}\n\n\treturn {\n\t\tgetLocaleData,\n\t\tsetLocaleData,\n\t\taddLocaleData,\n\t\tresetLocaleData,\n\t\tsubscribe,\n\t\t__,\n\t\t_x,\n\t\t_n,\n\t\t_nx,\n\t\tisRTL,\n\t\thasTranslation,\n\t};\n};\n"],"mappings":"AAAA;AACA;AACA;;AAEA,OAAOA,MAAM,MAAM,QAAQ;AAC3B;AACA;AACA;;AASA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,MAAMC,mBAA+B,GAAG;EACvC,EAAE,EAAE;IACHC,YAAYA,CAAEC,CAAS,EAAG;MACzB,OAAOA,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC;IACvB;E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AAG,QAAQ,GAAGC,MAAM,GAAGA,MAAM;IAC1D,IAAIe,MAAM,GAAG,CAAC,CAAEnC,MAAM,CAACY,IAAI,GAAID,MAAM,aAANA,MAAM,cAANA,MAAM,GAAI,SAAS,CAAE,GAAIuB,GAAG,CAAE;IAC7D,IAAKnC,KAAK,EAAG;MACZ;AACH;AACA;AACA;AACA;AACA;AACA;AACA;MACGoC,MAAM,GAAGpC,KAAK,CAAC6B,YAAY,CAC1B,sBAAsB,EACtBO,MAAM,EACNf,MAAM,EACND,OAAO,EACPR,MACD,CAAY;MAEZwB,MAAM,GAAGpC,KAAK,CAAC6B,YAAY,CAC1B,uBAAuB,GAAGJ,eAAe,CAAEb,MAAO,CAAC,EACnDwB,MAAM,EACNf,MAAM,EACND,OAAO,EACPR,MACD,CAAY;IACb;IACA,OAAOwB,MAAM;EACd,CAAC;EAED,IAAKtC,WAAW,EAAG;IAClBkB,aAAa,CAAElB,WAAW,EAAEC,aAAc,CAAC;EAC5C;EAEA,IAAKC,KAAK,EAAG;IACZ;AACF;AACA;IACE,MAAMqC,oBAAoB,GAAKC,QAAgB,IAAM;MACpD,IAAK1C,gBAAgB,CAAC2C,IAAI,CAAED,QAAS,CAAC,EAAG;QACxClC,eAAe,CAAC,CAAC;MAClB;IACD,CAAC;IAEDJ,KAAK,CAACwC,SAAS,CAAE,WAAW,EAAE,WAAW,EAAEH,oBAAqB,CAAC;IACjErC,KAAK,CAACwC,SAAS,CAAE,aAAa,EAAE,WAAW,EAAEH,oBAAqB,CAAC;EACpE;EAEA,OAAO;IACN1B,aAAa;IACbK,aAAa;IACbC,aAAa;IACbC,eAAe;IACfX,SAAS;IACTmB,EAAE;IACFI,EAAE;IACFC,EAAE;IACFC,GAAG;IACHC,KAAK;IACLC;EACD,CAAC;AACF,CAAC","ignoreList":[]}
|
|
@@ -19,19 +19,13 @@ export default i18n;
|
|
|
19
19
|
* https://github.com/WordPress/gutenberg/pull/20318#issuecomment-590837722
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
|
-
/**
|
|
23
|
-
* @typedef {import('./create-i18n').LocaleData} LocaleData
|
|
24
|
-
* @typedef {import('./create-i18n').SubscribeCallback} SubscribeCallback
|
|
25
|
-
* @typedef {import('./create-i18n').UnsubscribeCallback} UnsubscribeCallback
|
|
26
|
-
*/
|
|
27
|
-
|
|
28
22
|
/**
|
|
29
23
|
* Returns locale data by domain in a Jed-formatted JSON object shape.
|
|
30
24
|
*
|
|
31
25
|
* @see http://messageformat.github.io/Jed/
|
|
32
26
|
*
|
|
33
|
-
* @param {string} [domain] Domain for which to get the data.
|
|
34
|
-
* @return {LocaleData} Locale data.
|
|
27
|
+
* @param { string | undefined } [domain] Domain for which to get the data.
|
|
28
|
+
* @return { LocaleData } Locale data.
|
|
35
29
|
*/
|
|
36
30
|
export const getLocaleData = i18n.getLocaleData.bind(i18n);
|
|
37
31
|
|
|
@@ -41,8 +35,8 @@ export const getLocaleData = i18n.getLocaleData.bind(i18n);
|
|
|
41
35
|
*
|
|
42
36
|
* @see http://messageformat.github.io/Jed/
|
|
43
37
|
*
|
|
44
|
-
* @param {LocaleData}
|
|
45
|
-
* @param {string}
|
|
38
|
+
* @param {LocaleData } [data] Locale data configuration.
|
|
39
|
+
* @param {string | undefined} [domain] Domain for which configuration applies.
|
|
46
40
|
*/
|
|
47
41
|
export const setLocaleData = i18n.setLocaleData.bind(i18n);
|
|
48
42
|
|
|
@@ -52,8 +46,8 @@ export const setLocaleData = i18n.setLocaleData.bind(i18n);
|
|
|
52
46
|
*
|
|
53
47
|
* @see http://messageformat.github.io/Jed/
|
|
54
48
|
*
|
|
55
|
-
* @param {LocaleData}
|
|
56
|
-
* @param {string}
|
|
49
|
+
* @param {LocaleData} [data] Locale data configuration.
|
|
50
|
+
* @param {string | undefined} [domain] Domain for which configuration applies.
|
|
57
51
|
*/
|
|
58
52
|
export const resetLocaleData = i18n.resetLocaleData.bind(i18n);
|
|
59
53
|
|
|
@@ -72,10 +66,10 @@ export const subscribe = i18n.subscribe.bind(i18n);
|
|
|
72
66
|
*
|
|
73
67
|
* @template {string} Text
|
|
74
68
|
*
|
|
75
|
-
* @param {Text}
|
|
76
|
-
* @param {string}
|
|
69
|
+
* @param {Text} text Text to translate.
|
|
70
|
+
* @param {string | undefined} domain Domain to retrieve the translated text.
|
|
77
71
|
*
|
|
78
|
-
* @return {
|
|
72
|
+
* @return {TranslatableText<Text>} Translated text.
|
|
79
73
|
*/
|
|
80
74
|
export const __ = i18n.__.bind(i18n);
|
|
81
75
|
|
|
@@ -86,11 +80,11 @@ export const __ = i18n.__.bind(i18n);
|
|
|
86
80
|
*
|
|
87
81
|
* @template {string} Text
|
|
88
82
|
*
|
|
89
|
-
* @param {Text}
|
|
90
|
-
* @param {string}
|
|
91
|
-
* @param {string}
|
|
83
|
+
* @param {Text} text Text to translate.
|
|
84
|
+
* @param {string} context Context information for the translators.
|
|
85
|
+
* @param {string | undefined} domain Domain to retrieve the translated text.
|
|
92
86
|
*
|
|
93
|
-
* @return {
|
|
87
|
+
* @return {TranslatableText<Text>} Translated context string without pipe.
|
|
94
88
|
*/
|
|
95
89
|
export const _x = i18n._x.bind(i18n);
|
|
96
90
|
|
|
@@ -103,13 +97,13 @@ export const _x = i18n._x.bind(i18n);
|
|
|
103
97
|
* @template {string} Single
|
|
104
98
|
* @template {string} Plural
|
|
105
99
|
*
|
|
106
|
-
* @param {Single}
|
|
107
|
-
* @param {Plural}
|
|
108
|
-
* @param {number}
|
|
109
|
-
*
|
|
110
|
-
* @param {string}
|
|
100
|
+
* @param {Single} single The text to be used if the number is singular.
|
|
101
|
+
* @param {Plural} plural The text to be used if the number is plural.
|
|
102
|
+
* @param {number} number The number to compare against to use either the
|
|
103
|
+
* singular or plural form.
|
|
104
|
+
* @param {string | undefined} domain Domain to retrieve the translated text.
|
|
111
105
|
*
|
|
112
|
-
* @return {
|
|
106
|
+
* @return {TranslatableText<Single | Plural>} The translated singular or plural form.
|
|
113
107
|
*/
|
|
114
108
|
export const _n = i18n._n.bind(i18n);
|
|
115
109
|
|
|
@@ -121,15 +115,16 @@ export const _n = i18n._n.bind(i18n);
|
|
|
121
115
|
*
|
|
122
116
|
* @template {string} Single
|
|
123
117
|
* @template {string} Plural
|
|
118
|
+
* @param {Single} single The text to be used if the number is singular.
|
|
124
119
|
*
|
|
125
|
-
* @param {Single}
|
|
126
|
-
* @param {Plural}
|
|
127
|
-
* @param {number}
|
|
128
|
-
*
|
|
129
|
-
* @param {string}
|
|
130
|
-
* @param {string} [domain] Domain to retrieve the translated text.
|
|
120
|
+
* @param {Single} single The text to be used if the number is singular.
|
|
121
|
+
* @param {Plural} plural The text to be used if the number is plural.
|
|
122
|
+
* @param {number} number The number to compare against to use either the
|
|
123
|
+
* singular or plural form.
|
|
124
|
+
* @param {string} context Context information for the translators.
|
|
125
|
+
* @param {string | undefined} [domain] Domain to retrieve the translated text.
|
|
131
126
|
*
|
|
132
|
-
* @return {
|
|
127
|
+
* @return {TranslatableText<Single | Plural>} The translated singular or plural form.
|
|
133
128
|
*/
|
|
134
129
|
export const _nx = i18n._nx.bind(i18n);
|
|
135
130
|
|
|
@@ -148,9 +143,10 @@ export const isRTL = i18n.isRTL.bind(i18n);
|
|
|
148
143
|
/**
|
|
149
144
|
* Check if there is a translation for a given string (in singular form).
|
|
150
145
|
*
|
|
151
|
-
* @param {string} single
|
|
152
|
-
* @param {string}
|
|
153
|
-
* @param {string}
|
|
146
|
+
* @param {string} single Singular form of the string to look up.
|
|
147
|
+
* @param {string} context Context information for the translators.
|
|
148
|
+
* @param {string} domain Domain to retrieve the translated text.
|
|
149
|
+
*
|
|
154
150
|
* @return {boolean} Whether the translation exists or not.
|
|
155
151
|
*/
|
|
156
152
|
export const hasTranslation = i18n.hasTranslation.bind(i18n);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createI18n","defaultHooks","i18n","undefined","getLocaleData","bind","setLocaleData","resetLocaleData","subscribe","__","_x","_n","_nx","isRTL","hasTranslation"],"sources":["@wordpress/i18n/src/default-i18n.
|
|
1
|
+
{"version":3,"names":["createI18n","defaultHooks","i18n","undefined","getLocaleData","bind","setLocaleData","resetLocaleData","subscribe","__","_x","_n","_nx","isRTL","hasTranslation"],"sources":["@wordpress/i18n/src/default-i18n.ts"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { createI18n } from './create-i18n';\n\n/**\n * WordPress dependencies\n */\nimport { defaultHooks } from '@wordpress/hooks';\nimport {\n\tLocaleData,\n\tSubscribeCallback,\n\tTranslatableText,\n\tUnsubscribeCallback,\n} from './types';\n\nconst i18n = createI18n( undefined, undefined, defaultHooks );\n\n/**\n * Default, singleton instance of `I18n`.\n */\nexport default i18n;\n\n/*\n * Comments in this file are duplicated from ./i18n due to\n * https://github.com/WordPress/gutenberg/pull/20318#issuecomment-590837722\n */\n\n/**\n * Returns locale data by domain in a Jed-formatted JSON object shape.\n *\n * @see http://messageformat.github.io/Jed/\n *\n * @param { string | undefined } [domain] Domain for which to get the data.\n * @return { LocaleData } Locale data.\n */\nexport const getLocaleData = i18n.getLocaleData.bind( i18n );\n\n/**\n * Merges locale data into the Tannin instance by domain. Accepts data in a\n * Jed-formatted JSON object shape.\n *\n * @see http://messageformat.github.io/Jed/\n *\n * @param {LocaleData } [data] Locale data configuration.\n * @param {string | undefined} [domain] Domain for which configuration applies.\n */\nexport const setLocaleData = i18n.setLocaleData.bind( i18n );\n\n/**\n * Resets all current Tannin instance locale data and sets the specified\n * locale data for the domain. Accepts data in a Jed-formatted JSON object shape.\n *\n * @see http://messageformat.github.io/Jed/\n *\n * @param {LocaleData} [data] Locale data configuration.\n * @param {string | undefined} [domain] Domain for which configuration applies.\n */\nexport const resetLocaleData = i18n.resetLocaleData.bind( i18n );\n\n/**\n * Subscribes to changes of locale data\n *\n * @param {SubscribeCallback} callback Subscription callback\n * @return {UnsubscribeCallback} Unsubscribe callback\n */\nexport const subscribe = i18n.subscribe.bind( i18n );\n\n/**\n * Retrieve the translation of text.\n *\n * @see https://developer.wordpress.org/reference/functions/__/\n *\n * @template {string} Text\n *\n * @param {Text} text Text to translate.\n * @param {string | undefined} domain Domain to retrieve the translated text.\n *\n * @return {TranslatableText<Text>} Translated text.\n */\nexport const __ = i18n.__.bind( i18n );\n\n/**\n * Retrieve translated string with gettext context.\n *\n * @see https://developer.wordpress.org/reference/functions/_x/\n *\n * @template {string} Text\n *\n * @param {Text} text Text to translate.\n * @param {string} context Context information for the translators.\n * @param {string | undefined} domain Domain to retrieve the translated text.\n *\n * @return {TranslatableText<Text>} Translated context string without pipe.\n */\nexport const _x = i18n._x.bind( i18n );\n\n/**\n * Translates and retrieves the singular or plural form based on the supplied\n * number.\n *\n * @see https://developer.wordpress.org/reference/functions/_n/\n *\n * @template {string} Single\n * @template {string} Plural\n *\n * @param {Single} single The text to be used if the number is singular.\n * @param {Plural} plural The text to be used if the number is plural.\n * @param {number} number The number to compare against to use either the\n * singular or plural form.\n * @param {string | undefined} domain Domain to retrieve the translated text.\n *\n * @return {TranslatableText<Single | Plural>} The translated singular or plural form.\n */\nexport const _n = i18n._n.bind( i18n );\n\n/**\n * Translates and retrieves the singular or plural form based on the supplied\n * number, with gettext context.\n *\n * @see https://developer.wordpress.org/reference/functions/_nx/\n *\n * @template {string} Single\n * @template {string} Plural\n * @param {Single} single The text to be used if the number is singular.\n *\n * @param {Single} single The text to be used if the number is singular.\n * @param {Plural} plural The text to be used if the number is plural.\n * @param {number} number The number to compare against to use either the\n * singular or plural form.\n * @param {string} context Context information for the translators.\n * @param {string | undefined} [domain] Domain to retrieve the translated text.\n *\n * @return {TranslatableText<Single | Plural>} The translated singular or plural form.\n */\nexport const _nx = i18n._nx.bind( i18n );\n\n/**\n * Check if current locale is RTL.\n *\n * **RTL (Right To Left)** is a locale property indicating that text is written from right to left.\n * For example, the `he` locale (for Hebrew) specifies right-to-left. Arabic (ar) is another common\n * language written RTL. The opposite of RTL, LTR (Left To Right) is used in other languages,\n * including English (`en`, `en-US`, `en-GB`, etc.), Spanish (`es`), and French (`fr`).\n *\n * @return {boolean} Whether locale is RTL.\n */\nexport const isRTL = i18n.isRTL.bind( i18n );\n\n/**\n * Check if there is a translation for a given string (in singular form).\n *\n * @param {string} single Singular form of the string to look up.\n * @param {string} context Context information for the translators.\n * @param {string} domain Domain to retrieve the translated text.\n *\n * @return {boolean} Whether the translation exists or not.\n */\nexport const hasTranslation = i18n.hasTranslation.bind( i18n );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,UAAU,QAAQ,eAAe;;AAE1C;AACA;AACA;AACA,SAASC,YAAY,QAAQ,kBAAkB;AAQ/C,MAAMC,IAAI,GAAGF,UAAU,CAAEG,SAAS,EAAEA,SAAS,EAAEF,YAAa,CAAC;;AAE7D;AACA;AACA;AACA,eAAeC,IAAI;;AAEnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAME,aAAa,GAAGF,IAAI,CAACE,aAAa,CAACC,IAAI,CAAEH,IAAK,CAAC;;AAE5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMI,aAAa,GAAGJ,IAAI,CAACI,aAAa,CAACD,IAAI,CAAEH,IAAK,CAAC;;AAE5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMK,eAAe,GAAGL,IAAI,CAACK,eAAe,CAACF,IAAI,CAAEH,IAAK,CAAC;;AAEhE;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMM,SAAS,GAAGN,IAAI,CAACM,SAAS,CAACH,IAAI,CAAEH,IAAK,CAAC;;AAEpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMO,EAAE,GAAGP,IAAI,CAACO,EAAE,CAACJ,IAAI,CAAEH,IAAK,CAAC;;AAEtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMQ,EAAE,GAAGR,IAAI,CAACQ,EAAE,CAACL,IAAI,CAAEH,IAAK,CAAC;;AAEtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMS,EAAE,GAAGT,IAAI,CAACS,EAAE,CAACN,IAAI,CAAEH,IAAK,CAAC;;AAEtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMU,GAAG,GAAGV,IAAI,CAACU,GAAG,CAACP,IAAI,CAAEH,IAAK,CAAC;;AAExC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMW,KAAK,GAAGX,IAAI,CAACW,KAAK,CAACR,IAAI,CAAEH,IAAK,CAAC;;AAE5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMY,cAAc,GAAGZ,IAAI,CAACY,cAAc,CAACT,IAAI,CAAEH,IAAK,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["sprintf","default","defaultI18n","setLocaleData","resetLocaleData","getLocaleData","subscribe","__","_x","_n","_nx","isRTL","hasTranslation"],"sources":["@wordpress/i18n/src/index.
|
|
1
|
+
{"version":3,"names":["sprintf","default","defaultI18n","setLocaleData","resetLocaleData","getLocaleData","subscribe","__","_x","_n","_nx","isRTL","hasTranslation"],"sources":["@wordpress/i18n/src/index.ts"],"sourcesContent":["export { sprintf } from './sprintf';\nexport * from './create-i18n';\nexport type * from './types';\nexport {\n\tdefault as defaultI18n,\n\tsetLocaleData,\n\tresetLocaleData,\n\tgetLocaleData,\n\tsubscribe,\n\t__,\n\t_x,\n\t_n,\n\t_nx,\n\tisRTL,\n\thasTranslation,\n} from './default-i18n';\n"],"mappings":"AAAA,SAASA,OAAO,QAAQ,WAAW;AACnC,cAAc,eAAe;AAE7B,SACCC,OAAO,IAAIC,WAAW,EACtBC,aAAa,EACbC,eAAe,EACfC,aAAa,EACbC,SAAS,EACTC,EAAE,EACFC,EAAE,EACFC,EAAE,EACFC,GAAG,EACHC,KAAK,EACLC,cAAc,QACR,gBAAgB","ignoreList":[]}
|
package/build-module/sprintf.js
CHANGED
|
@@ -12,13 +12,12 @@ import _sprintf from '@tannin/sprintf';
|
|
|
12
12
|
/**
|
|
13
13
|
* Returns a formatted string.
|
|
14
14
|
*
|
|
15
|
-
* @
|
|
16
|
-
* @param
|
|
17
|
-
* @param {DistributeSprintfArgs<T>} args Arguments to apply to the format.
|
|
15
|
+
* @param format The format of the string to generate.
|
|
16
|
+
* @param args Arguments to apply to the format.
|
|
18
17
|
*
|
|
19
18
|
* @see https://www.npmjs.com/package/@tannin/sprintf
|
|
20
19
|
*
|
|
21
|
-
* @return
|
|
20
|
+
* @return The formatted string.
|
|
22
21
|
*/
|
|
23
22
|
export function sprintf(format, ...args) {
|
|
24
23
|
return _sprintf(format, ...args);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_sprintf","sprintf","format","args"],"sources":["@wordpress/i18n/src/sprintf.ts"],"sourcesContent":["/**\n * External dependencies\n */\n// Disable reason: `eslint-plugin-import` doesn't support `exports` (https://github.com/import-js/eslint-plugin-import/issues/1810)\n// eslint-disable-next-line import/no-unresolved\nimport _sprintf from '@tannin/sprintf';\
|
|
1
|
+
{"version":3,"names":["_sprintf","sprintf","format","args"],"sources":["@wordpress/i18n/src/sprintf.ts"],"sourcesContent":["/**\n * External dependencies\n */\n// Disable reason: `eslint-plugin-import` doesn't support `exports` (https://github.com/import-js/eslint-plugin-import/issues/1810)\n// eslint-disable-next-line import/no-unresolved\nimport _sprintf from '@tannin/sprintf';\n\n/**\n * Internal dependencies\n */\nimport type { DistributeSprintfArgs, TranslatableText } from './types';\n\nexport function sprintf< T extends string >(\n\tformat: T | TranslatableText< T >,\n\t...args: DistributeSprintfArgs< T >\n): string;\nexport function sprintf< T extends string >(\n\tformat: T | TranslatableText< T >,\n\targs: DistributeSprintfArgs< T >\n): string;\n\n/**\n * Returns a formatted string.\n *\n * @param format The format of the string to generate.\n * @param args Arguments to apply to the format.\n *\n * @see https://www.npmjs.com/package/@tannin/sprintf\n *\n * @return The formatted string.\n */\nexport function sprintf< T extends string >(\n\tformat: T | TranslatableText< T >,\n\t...args: DistributeSprintfArgs< T >\n): string {\n\treturn _sprintf( format as T, ...( args as DistributeSprintfArgs< T > ) );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA,OAAOA,QAAQ,MAAM,iBAAiB;;AAEtC;AACA;AACA;;AAYA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,OAAOA,CACtBC,MAAiC,EACjC,GAAGC,IAAgC,EAC1B;EACT,OAAOH,QAAQ,CAAEE,MAAM,EAAO,GAAKC,IAAqC,CAAC;AAC1E","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["@wordpress/i18n/src/types.ts"],"sourcesContent":["/**\n * Return type for string translation functions.\n *\n * This type should be treated as if it were `string`.\n */\nexport type TranslatableText< T extends string > = string & {\n\t/**\n\t * DO NOT USE! This property _does not exist_.\n\t * @private\n\t */\n\treadonly __translatableText: T;\n};\n"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":[],"sources":["@wordpress/i18n/src/types.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport type sprintf from '@tannin/sprintf';\nimport { type TanninDomainMetadata } from 'tannin';\n\n/**\n * Return type for string translation functions.\n *\n * This type should be treated as if it were `string`.\n */\nexport type TranslatableText< T extends string > = string & {\n\t/**\n\t * DO NOT USE! This property _does not exist_.\n\t * @private\n\t */\n\treadonly __translatableText: T;\n};\n\n/**\n * Type to extends TanninDomainMetadata to support additional properties.\n */\nexport type I18nDomainMetadata< TextDomain extends string > =\n\tTanninDomainMetadata & {\n\t\tdomain?: TextDomain;\n\t\t[ key: string ]: unknown;\n\t};\n\n/**\n * Locale data is a record of domain names to their metadata or translations.\n */\nexport type LocaleData< TextDomain extends string = string > = Record<\n\tstring,\n\tI18nDomainMetadata< TextDomain > | string[]\n>;\n\nexport type SubscribeCallback = () => void;\nexport type UnsubscribeCallback = () => void;\n\n/**\n * Retrieve the domain to use when calling domain-specific filters.\n */\nexport type getFilterDomain = ( domain?: string ) => string;\n\n/**\n * An i18n instance\n */\nexport interface I18n< TextDomain extends string = string > {\n\t/**\n\t * Returns locale data by domain in a\n\t * Jed-formatted JSON object shape.\n\t *\n\t * @see http://messageformat.github.io/Jed/\n\t */\n\tgetLocaleData: ( domain?: TextDomain ) => LocaleData< TextDomain >;\n\n\t/**\n\t * Merges locale data into the Tannin instance by domain. Note that this\n\t * function will overwrite the domain configuration. Accepts data in a\n\t * Jed-formatted JSON object shape.\n\t *\n\t * @see http://messageformat.github.io/Jed/\n\t */\n\tsetLocaleData: (\n\t\tdata?: LocaleData< TextDomain >,\n\t\tdomain?: TextDomain\n\t) => void;\n\n\t/**\n\t * Merges locale data into the Tannin instance by domain. Note that this\n\t * function will also merge the domain configuration. Accepts data in a\n\t * Jed-formatted JSON object shape.\n\t *\n\t * @see http://messageformat.github.io/Jed/\n\t */\n\taddLocaleData: (\n\t\tdata?: LocaleData< TextDomain >,\n\t\tdomain?: TextDomain\n\t) => void;\n\n\t/**\n\t * Resets all current Tannin instance locale data and sets the specified\n\t * locale data for the domain. Accepts data in a Jed-formatted JSON object shape.\n\t *\n\t * @see http://messageformat.github.io/Jed/\n\t */\n\tresetLocaleData: (\n\t\tdata?: LocaleData< TextDomain >,\n\t\tdomain?: TextDomain\n\t) => void;\n\n\t/**\n\t * Subscribes to changes of locale data\n\t */\n\tsubscribe: ( callback: SubscribeCallback ) => UnsubscribeCallback;\n\n\t/**\n\t * Retrieve the translation of text.\n\t *\n\t * @see https://developer.wordpress.org/reference/functions/__/\n\t */\n\t__: < Text extends string >(\n\t\ttext: Text,\n\t\tdomain?: TextDomain\n\t) => TranslatableText< Text >;\n\n\t/**\n\t * Retrieve translated string with gettext context.\n\t *\n\t * @see https://developer.wordpress.org/reference/functions/_x/\n\t */\n\t_x: < Text extends string >(\n\t\ttext: Text,\n\t\tcontext: string,\n\t\tdomain?: TextDomain\n\t) => TranslatableText< Text >;\n\n\t/**\n\t * Translates and retrieves the singular or plural form based on the supplied\n\t * number.\n\t *\n\t * @see https://developer.wordpress.org/reference/functions/_n/\n\t */\n\t_n: < Single extends string, Plural extends string >(\n\t\tsingle: Single,\n\t\tplural: Plural,\n\t\tnumber: number,\n\t\tdomain?: TextDomain\n\t) => TranslatableText< Single | Plural >;\n\n\t/**\n\t * Translates and retrieves the singular or plural form based on the supplied\n\t * number, with gettext context.\n\t *\n\t * @see https://developer.wordpress.org/reference/functions/_nx/\n\t */\n\t_nx: < Single extends string, Plural extends string >(\n\t\tsingle: Single,\n\t\tplural: Plural,\n\t\tnumber: number,\n\t\tcontext: string,\n\t\tdomain?: TextDomain\n\t) => TranslatableText< Single | Plural >;\n\n\t/**\n\t * Check if current locale is RTL.\n\t *\n\t * **RTL (Right To Left)** is a locale property indicating that text is written from right to left.\n\t * For example, the `he` locale (for Hebrew) specifies right-to-left. Arabic (ar) is another common\n\t * language written RTL. The opposite of RTL, LTR (Left To Right) is used in other languages,\n\t * including English (`en`, `en-US`, `en-GB`, etc.), Spanish (`es`), and French (`fr`).\n\t */\n\tisRTL: () => boolean;\n\n\t/**\n\t * Check if there is a translation for a given string in singular form.\n\t */\n\thasTranslation: (\n\t\tsingle: string,\n\t\tcontext?: string,\n\t\tdomain?: TextDomain\n\t) => boolean;\n}\n\nexport type DistributeSprintfArgs< T extends string > = T extends any\n\t? Parameters< typeof sprintf< T > >[ 1 ]\n\t: never;\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1,123 +1,19 @@
|
|
|
1
|
-
export function createI18n(initialData?: LocaleData, initialDomain?: string, hooks?: Hooks): I18n;
|
|
2
|
-
export type LocaleData = Record<string, any>;
|
|
3
1
|
/**
|
|
4
|
-
*
|
|
5
|
-
* Jed-formatted JSON object shape.
|
|
2
|
+
* Internal dependencies
|
|
6
3
|
*/
|
|
7
|
-
|
|
4
|
+
import type { I18n, LocaleData } from './types';
|
|
8
5
|
/**
|
|
9
|
-
*
|
|
10
|
-
* function will overwrite the domain configuration. Accepts data in a
|
|
11
|
-
* Jed-formatted JSON object shape.
|
|
6
|
+
* WordPress dependencies
|
|
12
7
|
*/
|
|
13
|
-
|
|
8
|
+
import type { Hooks } from '@wordpress/hooks';
|
|
14
9
|
/**
|
|
15
|
-
*
|
|
16
|
-
* function will also merge the domain configuration. Accepts data in a
|
|
17
|
-
* Jed-formatted JSON object shape.
|
|
18
|
-
*/
|
|
19
|
-
export type AddLocaleData = (data?: LocaleData, domain?: string) => void;
|
|
20
|
-
/**
|
|
21
|
-
* Resets all current Tannin instance locale data and sets the specified
|
|
22
|
-
* locale data for the domain. Accepts data in a Jed-formatted JSON object shape.
|
|
23
|
-
*/
|
|
24
|
-
export type ResetLocaleData = (data?: LocaleData, domain?: string) => void;
|
|
25
|
-
export type SubscribeCallback = () => void;
|
|
26
|
-
export type UnsubscribeCallback = () => void;
|
|
27
|
-
/**
|
|
28
|
-
* Subscribes to changes of locale data
|
|
29
|
-
*/
|
|
30
|
-
export type Subscribe = (callback: SubscribeCallback) => UnsubscribeCallback;
|
|
31
|
-
/**
|
|
32
|
-
* Retrieve the domain to use when calling domain-specific filters.
|
|
33
|
-
*/
|
|
34
|
-
export type GetFilterDomain = (domain?: string) => string;
|
|
35
|
-
/**
|
|
36
|
-
* Retrieve the translation of text.
|
|
37
|
-
*/
|
|
38
|
-
export type __ = <Text extends string>(text: Text, domain?: string) => import("./types").TranslatableText<Text>;
|
|
39
|
-
/**
|
|
40
|
-
* Retrieve translated string with gettext context.
|
|
41
|
-
*/
|
|
42
|
-
export type _x = <Text extends string>(text: Text, context: string, domain?: string) => import("./types").TranslatableText<Text>;
|
|
43
|
-
/**
|
|
44
|
-
* Translates and retrieves the singular or plural form based on the supplied
|
|
45
|
-
* number.
|
|
46
|
-
*/
|
|
47
|
-
export type _n = <Single extends string, Plural extends string>(single: Single, plural: Plural, number: number, domain?: string) => import("./types").TranslatableText<Single | Plural>;
|
|
48
|
-
/**
|
|
49
|
-
* Translates and retrieves the singular or plural form based on the supplied
|
|
50
|
-
* number, with gettext context.
|
|
51
|
-
*/
|
|
52
|
-
export type _nx = <Single extends string, Plural extends string>(single: Single, plural: Plural, number: number, context: string, domain?: string) => import("./types").TranslatableText<Single | Plural>;
|
|
53
|
-
/**
|
|
54
|
-
* Check if current locale is RTL.
|
|
10
|
+
* Create an i18n instance
|
|
55
11
|
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
|
|
61
|
-
export type IsRtl = () => boolean;
|
|
62
|
-
/**
|
|
63
|
-
* Check if there is a translation for a given string in singular form.
|
|
64
|
-
*/
|
|
65
|
-
export type HasTranslation = (single: string, context?: string, domain?: string) => boolean;
|
|
66
|
-
export type Hooks = import("@wordpress/hooks").Hooks;
|
|
67
|
-
/**
|
|
68
|
-
* An i18n instance
|
|
12
|
+
* @param [initialData] Locale data configuration.
|
|
13
|
+
* @param [initialDomain] Domain for which configuration applies.
|
|
14
|
+
* @param [hooks] Hooks implementation.
|
|
15
|
+
*
|
|
16
|
+
* @return I18n instance.
|
|
69
17
|
*/
|
|
70
|
-
export
|
|
71
|
-
/**
|
|
72
|
-
* Returns locale data by domain in a Jed-formatted JSON object shape.
|
|
73
|
-
*/
|
|
74
|
-
getLocaleData: GetLocaleData;
|
|
75
|
-
/**
|
|
76
|
-
* Merges locale data into the Tannin instance by domain. Note that this
|
|
77
|
-
* function will overwrite the domain configuration. Accepts data in a
|
|
78
|
-
* Jed-formatted JSON object shape.
|
|
79
|
-
*/
|
|
80
|
-
setLocaleData: SetLocaleData;
|
|
81
|
-
/**
|
|
82
|
-
* Merges locale data into the Tannin instance by domain. Note that this
|
|
83
|
-
* function will also merge the domain configuration. Accepts data in a
|
|
84
|
-
* Jed-formatted JSON object shape.
|
|
85
|
-
*/
|
|
86
|
-
addLocaleData: AddLocaleData;
|
|
87
|
-
/**
|
|
88
|
-
* Resets all current Tannin instance locale data and sets the specified
|
|
89
|
-
* locale data for the domain. Accepts data in a Jed-formatted JSON object shape.
|
|
90
|
-
*/
|
|
91
|
-
resetLocaleData: ResetLocaleData;
|
|
92
|
-
/**
|
|
93
|
-
* Subscribes to changes of Tannin locale data.
|
|
94
|
-
*/
|
|
95
|
-
subscribe: Subscribe;
|
|
96
|
-
/**
|
|
97
|
-
* Retrieve the translation of text.
|
|
98
|
-
*/
|
|
99
|
-
__: __;
|
|
100
|
-
/**
|
|
101
|
-
* Retrieve translated string with gettext context.
|
|
102
|
-
*/
|
|
103
|
-
_x: _x;
|
|
104
|
-
/**
|
|
105
|
-
* Translates and retrieves the singular or plural form based on the supplied
|
|
106
|
-
* number.
|
|
107
|
-
*/
|
|
108
|
-
_n: _n;
|
|
109
|
-
/**
|
|
110
|
-
* Translates and retrieves the singular or plural form based on the supplied
|
|
111
|
-
* number, with gettext context.
|
|
112
|
-
*/
|
|
113
|
-
_nx: _nx;
|
|
114
|
-
/**
|
|
115
|
-
* Check if current locale is RTL.
|
|
116
|
-
*/
|
|
117
|
-
isRTL: IsRtl;
|
|
118
|
-
/**
|
|
119
|
-
* Check if there is a translation for a given string.
|
|
120
|
-
*/
|
|
121
|
-
hasTranslation: HasTranslation;
|
|
122
|
-
};
|
|
18
|
+
export declare const createI18n: <TextDomain extends string>(initialData?: LocaleData<TextDomain>, initialDomain?: TextDomain, hooks?: Hooks) => I18n<TextDomain>;
|
|
123
19
|
//# sourceMappingURL=create-i18n.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-i18n.d.ts","sourceRoot":"","sources":["../src/create-i18n.
|
|
1
|
+
{"version":3,"file":"create-i18n.d.ts","sourceRoot":"","sources":["../src/create-i18n.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,OAAO,KAAK,EAEX,IAAI,EACJ,UAAU,EAIV,MAAM,SAAS,CAAC;AACjB;;GAEG;AACH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAmB9C;;;;;;;;GAQG;AACH,eAAO,MAAM,UAAU,GAAK,UAAU,SAAS,MAAM,gBACtC,UAAU,CAAE,UAAU,CAAE,kBACtB,UAAU,UAClB,KAAK,KACX,IAAI,CAAE,UAAU,CAiWlB,CAAC"}
|