@generaltranslation/react-core 1.0.2 → 1.0.4
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 +14 -0
- package/dist/index.cjs.min.cjs +1 -1
- package/dist/index.cjs.min.cjs.map +1 -1
- package/dist/index.esm.min.mjs +1 -1
- package/dist/index.esm.min.mjs.map +1 -1
- package/dist/internal.cjs.min.cjs +1 -1
- package/dist/internal.cjs.min.cjs.map +1 -1
- package/dist/internal.esm.min.mjs +1 -1
- package/dist/internal.esm.min.mjs.map +1 -1
- package/dist/messages/messages.d.ts +32 -1
- package/dist/messages/messages.d.ts.map +1 -1
- package/dist/provider/hooks/translation/useCreateInternalUseGTFunction.d.ts.map +1 -1
- package/package.json +3 -3
|
@@ -22,7 +22,38 @@ export declare function icuMessageContainsVariables(message: string): boolean;
|
|
|
22
22
|
* encodes to {"$_hash": "0x123", "$_source": "Hello, {name}!", "name": "Brian"}
|
|
23
23
|
*
|
|
24
24
|
*/
|
|
25
|
-
|
|
25
|
+
/**
|
|
26
|
+
* Encodes content into a message that contains important translation metadata
|
|
27
|
+
* @param message The message to encode.
|
|
28
|
+
* @param options The options to encode.
|
|
29
|
+
* @returns The encoded message.
|
|
30
|
+
*
|
|
31
|
+
* @note - Message format
|
|
32
|
+
* A message is broken into two parts separated by colons:
|
|
33
|
+
* - interpolated content - the content with interpolated variables
|
|
34
|
+
* - hash + options - a unique identifier for the source content and options for the translation
|
|
35
|
+
*
|
|
36
|
+
* @example - Basic usage
|
|
37
|
+
*
|
|
38
|
+
* ```jsx
|
|
39
|
+
* import { msg } from 'gt-react';
|
|
40
|
+
* const message = msg('Hello, {name}!');
|
|
41
|
+
* console.log(message); // "Hello, {name}!"
|
|
42
|
+
* ```
|
|
43
|
+
*
|
|
44
|
+
* @example - Usage with options
|
|
45
|
+
*
|
|
46
|
+
* ```jsx
|
|
47
|
+
* import { msg } from 'gt-react';
|
|
48
|
+
* const message = msg('Hello, {name}!', { name: 'Brian' });
|
|
49
|
+
* console.log(message); // "Hello, Brian:eyIkX2hhc2giOiAiMHgxMjMiLCAiJF9zb3VyY2UiOiAiSGVsbG8sIHtuYW1lfSEiLCAibmFtZSI6ICJCcmlhbiJ9"
|
|
50
|
+
* ```
|
|
51
|
+
* eyIkX2hhc2giOiAiMHgxMjMiLCAiJF9zb3VyY2UiOiAiSGVsbG8sIHtuYW1lfSEiLCAibmFtZSI6ICJCcmlhbiJ9
|
|
52
|
+
* encodes to {"$_hash": "0x123", "$_source": "Hello, {name}!", "name": "Brian"}
|
|
53
|
+
*
|
|
54
|
+
*/
|
|
55
|
+
export declare function msg<T extends string>(message: T): T;
|
|
56
|
+
export declare function msg<T extends string>(message: T, options: InlineTranslationOptions): string;
|
|
26
57
|
/**
|
|
27
58
|
* Extracts the original interpolated message string.
|
|
28
59
|
* If the message cannot be decoded (i.e., it does not contain a colon separator),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/messages/messages.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAI9D,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAiDpE;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,GAAG,
|
|
1
|
+
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/messages/messages.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAI9D,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAiDpE;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,GAAG,CAAC,CAAC,SAAS,MAAM,EAAE,OAAO,EAAE,CAAC,GAAG,CAAC,CAAC;AACrD,wBAAgB,GAAG,CAAC,CAAC,SAAS,MAAM,EAClC,OAAO,EAAE,CAAC,EACV,OAAO,EAAE,wBAAwB,GAChC,MAAM,CAAC;AAuCV;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS,MAAM,GAAG,IAAI,GAAG,SAAS,EAC3D,UAAU,EAAE,CAAC,GACZ,CAAC,CAKH;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,UAAU,EAAE,MAAM,GAC5C,CAAC;IACC,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;CAChB,GAAG,wBAAwB,CAAC,GAC7B,IAAI,CAeP"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCreateInternalUseGTFunction.d.ts","sourceRoot":"","sources":["../../../../src/provider/hooks/translation/useCreateInternalUseGTFunction.ts"],"names":[],"mappings":"AACA,OAAO,EACL,wBAAwB,EACxB,YAAY,EACZ,SAAS,EAEV,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AASxC,MAAM,CAAC,OAAO,UAAU,8BAA8B,CAAC,EACrD,EAAE,EACF,YAAY,EACZ,MAAM,EACN,aAAa,EACb,mBAAmB,EACnB,qBAAqB,EACrB,yBAAyB,GAC1B,EAAE;IACD,EAAE,EAAE,EAAE,CAAC;IACP,YAAY,EAAE,YAAY,GAAG,IAAI,CAAC;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;IACtB,mBAAmB,EAAE,OAAO,CAAC;IAC7B,qBAAqB,EAAE,OAAO,CAAC;IAC/B,yBAAyB,EAAE,oBAAoB,CAAC;CACjD,GAAG;IACF,UAAU,EAAE,CACV,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,wBAAwB,EAClC,qBAAqB,CAAC,EAAE,YAAY,KACjC,MAAM,CAAC;IACZ,UAAU,EAAE,CAAC,CAAC,SAAS,MAAM,GAAG,IAAI,GAAG,SAAS,EAC9C,OAAO,EAAE,CAAC,EACV,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC7B,qBAAqB,CAAC,EAAE,YAAY,KACjC,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG,CAAC,CAAC;IACnC,yBAAyB,EAAE,CAAC,SAAS,EAAE,SAAS,KAAK,SAAS,CAAC;IAC/D,gBAAgB,EAAE,CAAC,SAAS,EAAE,SAAS,KAAK,OAAO,CAAC,YAAY,CAAC,CAAC;CACnE,
|
|
1
|
+
{"version":3,"file":"useCreateInternalUseGTFunction.d.ts","sourceRoot":"","sources":["../../../../src/provider/hooks/translation/useCreateInternalUseGTFunction.ts"],"names":[],"mappings":"AACA,OAAO,EACL,wBAAwB,EACxB,YAAY,EACZ,SAAS,EAEV,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AASxC,MAAM,CAAC,OAAO,UAAU,8BAA8B,CAAC,EACrD,EAAE,EACF,YAAY,EACZ,MAAM,EACN,aAAa,EACb,mBAAmB,EACnB,qBAAqB,EACrB,yBAAyB,GAC1B,EAAE;IACD,EAAE,EAAE,EAAE,CAAC;IACP,YAAY,EAAE,YAAY,GAAG,IAAI,CAAC;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;IACtB,mBAAmB,EAAE,OAAO,CAAC;IAC7B,qBAAqB,EAAE,OAAO,CAAC;IAC/B,yBAAyB,EAAE,oBAAoB,CAAC;CACjD,GAAG;IACF,UAAU,EAAE,CACV,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,wBAAwB,EAClC,qBAAqB,CAAC,EAAE,YAAY,KACjC,MAAM,CAAC;IACZ,UAAU,EAAE,CAAC,CAAC,SAAS,MAAM,GAAG,IAAI,GAAG,SAAS,EAC9C,OAAO,EAAE,CAAC,EACV,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC7B,qBAAqB,CAAC,EAAE,YAAY,KACjC,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG,CAAC,CAAC;IACnC,yBAAyB,EAAE,CAAC,SAAS,EAAE,SAAS,KAAK,SAAS,CAAC;IAC/D,gBAAgB,EAAE,CAAC,SAAS,EAAE,SAAS,KAAK,OAAO,CAAC,YAAY,CAAC,CAAC;CACnE,CAqSA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@generaltranslation/react-core",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "A pure React library for internationalization",
|
|
5
5
|
"main": "./dist/index.cjs.min.cjs",
|
|
6
6
|
"module": "./dist/index.esm.min.mjs",
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
"react": ">=16.8.0"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@generaltranslation/supported-locales": "2.0.
|
|
17
|
-
"generaltranslation": "7.7.
|
|
16
|
+
"@generaltranslation/supported-locales": "2.0.19",
|
|
17
|
+
"generaltranslation": "7.7.3"
|
|
18
18
|
},
|
|
19
19
|
"repository": {
|
|
20
20
|
"type": "git",
|