@lingui/format-json 5.0.0-next.2 → 5.0.0-next.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/README.md +4 -80
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -6,88 +6,11 @@
|
|
|
6
6
|
|
|
7
7
|
> Read and write message catalogs in JSON
|
|
8
8
|
|
|
9
|
-
`@lingui/format-json` is part of [LinguiJS][linguijs]. See the
|
|
10
|
-
[documentation][documentation] for all information, tutorials and examples.
|
|
9
|
+
`@lingui/format-json` is part of [LinguiJS][linguijs]. See the [documentation][documentation] for all information, tutorials and examples.
|
|
11
10
|
|
|
12
|
-
## Installation
|
|
11
|
+
## Installation & Usage
|
|
13
12
|
|
|
14
|
-
|
|
15
|
-
npm install --save-dev @lingui/format-json
|
|
16
|
-
# yarn add --dev @lingui/format-json
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
## Usage
|
|
20
|
-
|
|
21
|
-
```js
|
|
22
|
-
// lingui.config.{js,ts}
|
|
23
|
-
import {formatter} from "@lingui/format-json"
|
|
24
|
-
|
|
25
|
-
export default {
|
|
26
|
-
[...]
|
|
27
|
-
format: formatter({style: "lingui"}),
|
|
28
|
-
}
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
Possible options:
|
|
32
|
-
|
|
33
|
-
```ts
|
|
34
|
-
export type JsonFormatterOptions = {
|
|
35
|
-
/**
|
|
36
|
-
* Print places where message is used
|
|
37
|
-
*
|
|
38
|
-
* @default true
|
|
39
|
-
*/
|
|
40
|
-
origins?: boolean
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Print line numbers in origins
|
|
44
|
-
*
|
|
45
|
-
* @default true
|
|
46
|
-
*/
|
|
47
|
-
lineNumbers?: boolean
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Different styles of how information could be printed
|
|
51
|
-
*
|
|
52
|
-
* @default "lingui"
|
|
53
|
-
*/
|
|
54
|
-
style?: "lingui" | "minimal"
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Indentation of output JSON
|
|
58
|
-
*
|
|
59
|
-
* @default 2
|
|
60
|
-
*/
|
|
61
|
-
indentation?: number
|
|
62
|
-
}
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
### Style: minimal
|
|
67
|
-
|
|
68
|
-
Simple JSON with message ID -> translation mapping. All metadata (default message, comments for translators, message origin, etc) are stripped:
|
|
69
|
-
|
|
70
|
-
```json
|
|
71
|
-
{
|
|
72
|
-
"MessageID": "Translated Message"
|
|
73
|
-
}
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
### Style: lingui
|
|
77
|
-
|
|
78
|
-
Raw catalog data serialized to JSON:
|
|
79
|
-
|
|
80
|
-
```json
|
|
81
|
-
{
|
|
82
|
-
"MessageID": {
|
|
83
|
-
"translation": "Translated Message",
|
|
84
|
-
"message": "Default string (from source code)",
|
|
85
|
-
"origin": [
|
|
86
|
-
["path/to/src.js", 42]
|
|
87
|
-
]
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
```
|
|
13
|
+
See the [reference][reference] documentation.
|
|
91
14
|
|
|
92
15
|
## License
|
|
93
16
|
|
|
@@ -96,6 +19,7 @@ This package is licensed under [MIT][license] license.
|
|
|
96
19
|
[license]: https://github.com/lingui/js-lingui/blob/main/LICENSE
|
|
97
20
|
[linguijs]: https://github.com/lingui/js-lingui
|
|
98
21
|
[documentation]: https://lingui.dev
|
|
22
|
+
[reference]: https://lingui.dev/ref/catalog-formats#json
|
|
99
23
|
[package]: https://www.npmjs.com/package/@lingui/format-json
|
|
100
24
|
[badge-downloads]: https://img.shields.io/npm/dw/@lingui/format-json.svg
|
|
101
25
|
[badge-version]: https://img.shields.io/npm/v/@lingui/format-json.svg
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lingui/format-json",
|
|
3
|
-
"version": "5.0.0-next.
|
|
3
|
+
"version": "5.0.0-next.4",
|
|
4
4
|
"description": "JSON format for Lingui Catalogs",
|
|
5
5
|
"main": "./dist/json.cjs",
|
|
6
6
|
"module": "./dist/json.mjs",
|
|
@@ -39,12 +39,12 @@
|
|
|
39
39
|
"dist/"
|
|
40
40
|
],
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@lingui/conf": "^5.0.0-next.
|
|
42
|
+
"@lingui/conf": "^5.0.0-next.4",
|
|
43
43
|
"ramda": "^0.28.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"tsd": "^0.28.0",
|
|
47
47
|
"unbuild": "^2.0.0"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "7b9ca5b479be4acd58ed95bff841e89efba06279"
|
|
50
50
|
}
|