@wordpress/i18n 6.4.1-next.f56bd8138.0 → 6.5.1-next.47f435fc9.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/CHANGELOG.md +2 -0
- package/build/create-i18n.js +150 -167
- package/build/create-i18n.js.map +7 -1
- package/build/default-i18n.js +59 -156
- package/build/default-i18n.js.map +7 -1
- package/build/index.js +60 -103
- package/build/index.js.map +7 -1
- package/build/sprintf.js +38 -28
- package/build/sprintf.js.map +7 -1
- package/build/types.js +16 -5
- package/build/types.js.map +7 -1
- package/build-module/create-i18n.js +118 -161
- package/build-module/create-i18n.js.map +7 -1
- package/build-module/default-i18n.js +28 -153
- package/build-module/default-i18n.js.map +7 -1
- package/build-module/index.js +30 -4
- package/build-module/index.js.map +7 -1
- package/build-module/sprintf.js +6 -23
- package/build-module/sprintf.js.map +7 -1
- package/build-module/types.js +1 -2
- package/build-module/types.js.map +7 -1
- package/package.json +11 -4
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/default-i18n.ts"],
|
|
4
|
+
"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"],
|
|
5
|
+
"mappings": "AAGA,SAAS,kBAAkB;AAK3B,SAAS,oBAAoB;AAQ7B,MAAM,OAAO,WAAY,QAAW,QAAW,YAAa;AAK5D,IAAO,uBAAQ;AAeR,MAAM,gBAAgB,KAAK,cAAc,KAAM,IAAK;AAWpD,MAAM,gBAAgB,KAAK,cAAc,KAAM,IAAK;AAWpD,MAAM,kBAAkB,KAAK,gBAAgB,KAAM,IAAK;AAQxD,MAAM,YAAY,KAAK,UAAU,KAAM,IAAK;AAc5C,MAAM,KAAK,KAAK,GAAG,KAAM,IAAK;AAe9B,MAAM,KAAK,KAAK,GAAG,KAAM,IAAK;AAmB9B,MAAM,KAAK,KAAK,GAAG,KAAM,IAAK;AAqB9B,MAAM,MAAM,KAAK,IAAI,KAAM,IAAK;AAYhC,MAAM,QAAQ,KAAK,MAAM,KAAM,IAAK;AAWpC,MAAM,iBAAiB,KAAK,eAAe,KAAM,IAAK;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/build-module/index.js
CHANGED
|
@@ -1,4 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
export * from
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { sprintf } from "./sprintf";
|
|
2
|
+
export * from "./create-i18n";
|
|
3
|
+
import {
|
|
4
|
+
default as default2,
|
|
5
|
+
setLocaleData,
|
|
6
|
+
resetLocaleData,
|
|
7
|
+
getLocaleData,
|
|
8
|
+
subscribe,
|
|
9
|
+
__,
|
|
10
|
+
_x,
|
|
11
|
+
_n,
|
|
12
|
+
_nx,
|
|
13
|
+
isRTL,
|
|
14
|
+
hasTranslation
|
|
15
|
+
} from "./default-i18n";
|
|
16
|
+
export {
|
|
17
|
+
__,
|
|
18
|
+
_n,
|
|
19
|
+
_nx,
|
|
20
|
+
_x,
|
|
21
|
+
default2 as defaultI18n,
|
|
22
|
+
getLocaleData,
|
|
23
|
+
hasTranslation,
|
|
24
|
+
isRTL,
|
|
25
|
+
resetLocaleData,
|
|
26
|
+
setLocaleData,
|
|
27
|
+
sprintf,
|
|
28
|
+
subscribe
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/index.ts"],
|
|
4
|
+
"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"],
|
|
5
|
+
"mappings": "AAAA,SAAS,eAAe;AACxB,cAAc;AAEd;AAAA,EACY,WAAXA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;",
|
|
6
|
+
"names": ["default"]
|
|
7
|
+
}
|
package/build-module/sprintf.js
CHANGED
|
@@ -1,25 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*/
|
|
4
|
-
// Disable reason: `eslint-plugin-import` doesn't support `exports` (https://github.com/import-js/eslint-plugin-import/issues/1810)
|
|
5
|
-
// eslint-disable-next-line import/no-unresolved
|
|
6
|
-
import _sprintf from '@tannin/sprintf';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Internal dependencies
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Returns a formatted string.
|
|
14
|
-
*
|
|
15
|
-
* @param format The format of the string to generate.
|
|
16
|
-
* @param args Arguments to apply to the format.
|
|
17
|
-
*
|
|
18
|
-
* @see https://www.npmjs.com/package/@tannin/sprintf
|
|
19
|
-
*
|
|
20
|
-
* @return The formatted string.
|
|
21
|
-
*/
|
|
22
|
-
export function sprintf(format, ...args) {
|
|
1
|
+
import _sprintf from "@tannin/sprintf";
|
|
2
|
+
function sprintf(format, ...args) {
|
|
23
3
|
return _sprintf(format, ...args);
|
|
24
4
|
}
|
|
25
|
-
|
|
5
|
+
export {
|
|
6
|
+
sprintf
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=sprintf.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/sprintf.ts"],
|
|
4
|
+
"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"],
|
|
5
|
+
"mappings": "AAKA,OAAO,cAAc;AA0Bd,SAAS,QACf,WACG,MACM;AACT,SAAO,SAAU,QAAa,GAAK,IAAqC;AACzE;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/build-module/types.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
//# sourceMappingURL=types.js.map
|
|
1
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": [],
|
|
4
|
+
"sourcesContent": [],
|
|
5
|
+
"mappings": "",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/i18n",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.5.1-next.47f435fc9.0",
|
|
4
4
|
"description": "WordPress internationalization (i18n) library.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -24,6 +24,14 @@
|
|
|
24
24
|
},
|
|
25
25
|
"main": "build/index.js",
|
|
26
26
|
"module": "build-module/index.js",
|
|
27
|
+
"exports": {
|
|
28
|
+
".": {
|
|
29
|
+
"types": "./build-types/index.d.ts",
|
|
30
|
+
"import": "./build-module/index.js",
|
|
31
|
+
"require": "./build/index.js"
|
|
32
|
+
},
|
|
33
|
+
"./package.json": "./package.json"
|
|
34
|
+
},
|
|
27
35
|
"react-native": "src/index",
|
|
28
36
|
"wpScript": true,
|
|
29
37
|
"types": "build-types",
|
|
@@ -31,9 +39,8 @@
|
|
|
31
39
|
"pot-to-php": "./tools/pot-to-php.js"
|
|
32
40
|
},
|
|
33
41
|
"dependencies": {
|
|
34
|
-
"@babel/runtime": "7.25.7",
|
|
35
42
|
"@tannin/sprintf": "^1.3.2",
|
|
36
|
-
"@wordpress/hooks": "^4.
|
|
43
|
+
"@wordpress/hooks": "^4.32.1-next.47f435fc9.0",
|
|
37
44
|
"gettext-parser": "^1.3.1",
|
|
38
45
|
"memize": "^2.1.0",
|
|
39
46
|
"tannin": "^1.2.0"
|
|
@@ -41,5 +48,5 @@
|
|
|
41
48
|
"publishConfig": {
|
|
42
49
|
"access": "public"
|
|
43
50
|
},
|
|
44
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "9720f22c138771d2ed1a0522725c3cdf1c242953"
|
|
45
52
|
}
|