forked from lit/lit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.schema.json
208 lines (207 loc) · 9.73 KB
/
config.schema.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"definitions": {
"Patch": {
"additionalProperties": false,
"description": "Replace one string with another.",
"properties": {
"after": {
"description": "The string to replace matches with.",
"type": "string"
},
"before": {
"description": "The string to search for.",
"type": "string"
}
},
"required": [
"after",
"before"
],
"type": "object"
},
"RuntimeOutputConfig": {
"additionalProperties": false,
"description": "Configuration specific to the `runtime` output mode.",
"properties": {
"language": {
"description": "Language for emitting generated modules. Defaults to \"js\" unless a\n`tsConfig` was specified, in which case it defaults to \"ts\".\n\n- \"js\": Emit JavaScript modules with \".js\" file extension.\n- \"ts\": Emit TypeScript modules with \".ts\" file extension.",
"enum": [
"js",
"ts"
],
"type": "string"
},
"localeCodesModule": {
"description": "Optional filepath for a generated module that exports `sourceLocale`,\n`targetLocales`, and `allLocales` using the locale codes from your config\nfile. Use to keep your config file and client config in sync. For example:\n\n export const sourceLocale = 'en';\n export const targetLocales = ['es-419', 'zh_CN'];\n export const allLocales = ['es-419', 'zh_CN', 'en'];\n\nThis path should end with either \".js\" or \".ts\". If it ends with \".js\" it\nwill be emitted as a JavaScript module. If it ends with \".ts\" it will be\nemitted as a TypeScript module.",
"type": "string"
},
"mode": {
"enum": [
"runtime"
],
"type": "string"
},
"outputDir": {
"description": "Output directory for generated modules. Into this directory will be\ngenerated a <locale>.ts for each `targetLocale`, each a module that exports\nthe translations in that locale keyed by message ID.",
"type": "string"
}
},
"required": [
"mode",
"outputDir"
],
"type": "object"
},
"TransformOutputConfig": {
"additionalProperties": false,
"description": "Configuration specific to the `transform` output mode.",
"properties": {
"localeCodesModule": {
"description": "Optional filepath for a generated module module that exports\n`sourceLocale`, `targetLocales`, and `allLocales` using the locale codes\nfrom your config file. Use to keep your config file and client config in\nsync. For example:\n\n export const sourceLocale = 'en';\n export const targetLocales = ['es-419', 'zh_CN'];\n export const allLocales = ['es-419', 'zh_CN', 'en'];\n\nThis path should end with either \".js\" or \".ts\". If it ends with \".js\" it\nwill be emitted as a JavaScript module. If it ends with \".ts\" it will be\nemitted as a TypeScript module.",
"type": "string"
},
"mode": {
"enum": [
"transform"
],
"type": "string"
},
"outputDir": {
"description": "Output directory for transformed projects. A subdirectory will be created\nfor each locale within this directory, each containing a full build of the\nproject for that locale.\n\nRequired unless `tsConfig` is specified, in which case it defaults to that\nconfig's `outDir`. If both are specified, this field takes precedence.",
"type": "string"
}
},
"required": [
"mode"
],
"type": "object"
},
"XlbConfig": {
"additionalProperties": false,
"description": "Parse an XLB XML file. These files contain translations organized using the\nsame message names that we originally requested.\nConfiguration for XLB interchange format.",
"properties": {
"format": {
"enum": [
"xlb"
],
"type": "string"
},
"outputFile": {
"description": "Output path on disk to the XLB XML file that will be created containing all\nmessages extracted from the source. E.g. \"data/localization/en.xlb\".",
"type": "string"
},
"translationsGlob": {
"description": "Glob pattern of XLB XML files to read from disk containing translated\nmessages. E.g. \"data/localization/*.xlb\".\n\nSee https://github.com/isaacs/node-glob#README for valid glob syntax.",
"type": "string"
}
},
"required": [
"format",
"outputFile",
"translationsGlob"
],
"type": "object"
},
"XliffConfig": {
"additionalProperties": false,
"description": "Configuration for XLIFF interchange format.",
"properties": {
"format": {
"enum": [
"xliff"
],
"type": "string"
},
"placeholderStyle": {
"description": "How to represent placeholders containing HTML markup and dynamic\nexpressions. Different localization tools and services have varying support\nfor placeholder syntax.\n\nDefaults to \"x\". Options:\n\n- \"x\": Emit placeholders using <x> tags. See\n http://docs.oasis-open.org/xliff/v1.2/os/xliff-core.html#x\n\n- \"ph\": Emit placeholders using <ph> tags. See\n http://docs.oasis-open.org/xliff/v1.2/os/xliff-core.html#ph",
"enum": [
"ph",
"x"
],
"type": "string"
},
"xliffDir": {
"description": "Directory on disk to read/write .xlf XML files. For each target locale,\nthe file path \"<xliffDir>/<locale>.xlf\" will be used.",
"type": "string"
}
},
"required": [
"format",
"xliffDir"
],
"type": "object"
}
},
"properties": {
"$schema": {
"description": "See https://json-schema.org/understanding-json-schema/reference/schema.html",
"type": "string"
},
"inputFiles": {
"description": "Array of filenames or glob patterns to extract messages from.\n\nRequired unless `tsConfig` is specified. If `tsConfig` is also specified,\nthen this field takes precedence.",
"items": {
"type": "string"
},
"type": "array"
},
"interchange": {
"anyOf": [
{
"$ref": "#/definitions/XlbConfig"
},
{
"$ref": "#/definitions/XliffConfig"
}
],
"description": "Localization interchange format and configuration specific to that format."
},
"output": {
"anyOf": [
{
"$ref": "#/definitions/RuntimeOutputConfig"
},
{
"$ref": "#/definitions/TransformOutputConfig"
}
],
"description": "Set and configure the output mode."
},
"patches": {
"additionalProperties": {
"additionalProperties": {
"items": {
"$ref": "#/definitions/Patch"
},
"type": "array"
},
"type": "object"
},
"description": "Optional string substitutions to apply to specific locale messages. Useful\nfor making minor corrections without modifying source files or repeating a\nfull localization cycle.\n\nExample:\n\n\"patches\": {\n \"es-419\": {\n \"greeting\": [\n {\n \"before\": \"Buenos dias\",\n \"after\": \"Buenos días\"\n }\n ]\n }\n}",
"type": "object"
},
"sourceLocale": {
"description": "Required locale code that messages in the source code are written in.",
"type": "string"
},
"targetLocales": {
"description": "Required locale codes that messages will be localized to.",
"items": {
"type": "string"
},
"type": "array"
},
"tsConfig": {
"description": "Path to a tsconfig.json file that determines the source files from which\nmessages will be extracted, and also the compiler options that will be used\nwhen building for transform mode.\n\nRequired unless `inputFiles` is specified. If `inputFiles` is also\nspecified, then the files specified by this config will be ignored in favor\nof `inputFiles`.",
"type": "string"
}
},
"required": [
"interchange",
"output",
"sourceLocale",
"targetLocales"
],
"type": "object"
}