-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathi18n-tasks.json
More file actions
309 lines (309 loc) · 15.9 KB
/
Copy pathi18n-tasks.json
File metadata and controls
309 lines (309 loc) · 15.9 KB
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
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://www.rubyschema.org/i18n-tasks.json",
"title": "I18n-tasks config",
"markdownDescription": "Configuration for i18n-tasks, a gem for managing translations in Ruby i18n projects. Helps find missing and unused translations, pre-fill keys, and maintain translation files. Typically located at `config/i18n-tasks.yml`.\n\n[i18n-tasks Documentation](https://github.com/glebm/i18n-tasks)",
"definitions": {
"erb": {
"type": "string",
"pattern": "^<%=.*%>$"
},
"google": {
"type": "object",
"properties": {
"backend": {
"const": "google",
"markdownDescription": "Use Google Translate API for automatic translation.\n\n[Get API Key](https://console.cloud.google.com/apis/credentials)"
},
"google_translate_api_key": {
"type": "string",
"markdownDescription": "Google Translate API key. Get it from [Google API Console](https://console.cloud.google.com/apis/credentials).\n\n⚠️ **Security:** Use environment variables, never commit API keys.\n\n**Env Var:** `GOOGLE_TRANSLATE_API_KEY`\n\n**Example:**\n```yaml\ngoogle_translate_api_key: <%= ENV['GOOGLE_TRANSLATE_API_KEY'] %>\n```"
}
},
"additionalProperties": false,
"required": ["google_translate_api_key"]
},
"deepl": {
"type": "object",
"properties": {
"backend": {
"const": "deepl",
"markdownDescription": "Use DeepL Pro API for high-quality automatic translation.\n\n[Get API Key](https://www.deepl.com/pro)"
},
"deepl_api_key": {
"type": "string",
"markdownDescription": "DeepL Pro API authentication key. Get it from [DeepL Pro](https://www.deepl.com/pro).\n\n⚠️ **Security:** Use environment variables, never commit API keys.\n\n**Env Var:** `DEEPL_AUTH_KEY`\n\n**Example:**\n```yaml\ndeepl_api_key: <%= ENV['DEEPL_AUTH_KEY'] %>\n```"
},
"deepl_host": {
"type": "string",
"markdownDescription": "DeepL API host URL. Use this for DeepL Pro API servers or custom endpoints.\n\n**Env Var:** `DEEPL_HOST`\n\n**Default:** `https://api.deepl.com` (Free) or `https://api-free.deepl.com` (Pro)\n\n**Example:**\n```yaml\ndeepl_host: https://api.deepl.com\n```"
},
"deepl_version": {
"type": "string",
"markdownDescription": "DeepL API version to use.\n\n**Env Var:** `DEEPL_VERSION`\n\n**Default:** `v2`"
},
"deepl_glossary_ids": {
"type": "array",
"uniqueItems": true,
"markdownDescription": "List of DeepL glossary IDs to use for translations. Glossaries ensure consistent terminology across translations.\n\n**Example:**\n```yaml\ndeepl_glossary_ids:\n - f28106eb-0e06-489e-82c6-8215d6f95089\n - 2c6415be-1852-4f54-9e1b-d800463496b4\n```\n\n[DeepL Glossaries Documentation](https://www.deepl.com/docs-api/glossaries)",
"items": { "type": "string" }
},
"deepl_options": {
"type": "object",
"markdownDescription": "Additional options for DeepL API calls.",
"properties": {
"formality": {
"anyOf": [{ "enum": ["prefer_less"] }, { "type": "string" }],
"markdownDescription": "Control formality level of translations.\n\n**Options:**\n- `prefer_less` - Less formal\n- `prefer_more` - More formal\n- `default` - Default formality\n\n**Example:**\n```yaml\nformality: prefer_less\n```"
}
}
},
"deepl_locale_aliases": {
"type": "object",
"propertyNames": { "type": "string" },
"additionalProperties": { "type": "string" },
"markdownDescription": "Map internal locale codes to DeepL-supported locale codes. Useful when your app uses simplified locale codes.\n\n**Example:**\n```yaml\ndeepl_locale_aliases:\n en: en-us # Map 'en' to 'en-us'\n pt: pt-br # Map 'pt' to 'pt-br'\n```"
}
},
"additionalProperties": false,
"required": ["deepl_api_key"]
},
"yandex": {
"type": "object",
"properties": {
"backend": {
"const": "yandex",
"markdownDescription": "Use Yandex Translate API for automatic translation.\n\n[Get API Key](https://tech.yandex.com/translate)"
},
"yandex_api_key": {
"type": "string",
"markdownDescription": "Yandex Translate API key. Get it from [Yandex](https://tech.yandex.com/translate).\n\n⚠️ **Security:** Use environment variables, never commit API keys.\n\n**Env Var:** `YANDEX_API_KEY`\n\n**Example:**\n```yaml\nyandex_api_key: <%= ENV['YANDEX_API_KEY'] %>\n```"
}
},
"additionalProperties": false,
"required": ["yandex_api_key"]
},
"openai": {
"type": "object",
"properties": {
"backend": {
"const": "openai",
"markdownDescription": "Use OpenAI API for AI-powered translation.\n\n[Get API Key](https://platform.openai.com/api-keys)"
},
"openai_api_key": {
"type": "string",
"markdownDescription": "OpenAI API key. Get it from [OpenAI](https://platform.openai.com/api-keys).\n\n⚠️ **Security:** Use environment variables, never commit API keys.\n\n**Env Var:** `OPENAI_API_KEY`\n\n**Example:**\n```yaml\nopenai_api_key: <%= ENV['OPENAI_API_KEY'] %>\n```"
},
"openai_model": {
"type": "string",
"markdownDescription": "OpenAI model to use for translations.\n\n**Env Var:** `OPENAI_MODEL`\n\n**Default:** `gpt-3.5-turbo`\n\n**Example:**\n```yaml\nopenai_model: gpt-4\n```"
}
},
"additionalProperties": false,
"required": ["openai_api_key"]
},
"watsonx": {
"type": "object",
"properties": {
"backend": {
"const": "watsonx",
"markdownDescription": "Use IBM watsonx AI for translation.\n\n[Get Started with watsonx](https://www.ibm.com/watsonx)"
},
"watsonx_api_key": {
"type": "string",
"markdownDescription": "IBM watsonx API key. Get it from [IBM watsonx](https://www.ibm.com/watsonx).\n\n⚠️ **Security:** Use environment variables, never commit API keys.\n\n**Env Var:** `WATSONX_API_KEY`\n\n**Example:**\n```yaml\nwatsonx_api_key: <%= ENV['WATSONX_API_KEY'] %>\n```"
},
"watsonx_project_id": {
"type": "string",
"markdownDescription": "IBM watsonx project ID. Required for watsonx API authentication.\n\n**Env Var:** `WATSONX_PROJECT_ID`\n\n**Example:**\n```yaml\nwatsonx_project_id: <%= ENV['WATSONX_PROJECT_ID'] %>\n```"
},
"watsonx_model": {
"type": "string",
"markdownDescription": "IBM watsonx model to use for translations.\n\n**Env Var:** `WATSONX_MODEL`\n\n**Example:**\n```yaml\nwatsonx_model: ibm/granite-13b-instruct-v2\n```"
}
},
"additionalProperties": false,
"required": ["watsonx_api_key", "watsonx_project_id"]
}
},
"properties": {
"base_locale": {
"type": "string",
"markdownDescription": "The base (default) locale for your application. This is the locale from which translations will be derived.\n\n**Default:** `en`\n\n**Example:**\n```yaml\nbase_locale: en\n```"
},
"locales": {
"type": "array",
"uniqueItems": true,
"markdownDescription": "List of supported locales for translation. By default, i18n-tasks infers locales from the paths to data files.\n\n**Example:**\n```yaml\nlocales: [en, es, fr, de]\n```",
"items": {
"type": "string"
}
},
"data": {
"type": "object",
"markdownDescription": "Configuration for reading and writing locale data files. Supports multiple file patterns and organization strategies.",
"properties": {
"adapter": {
"type": "string",
"markdownDescription": "Data adapter for reading/writing translation files. The default adapter supports YAML and JSON files.\n\n**Default:** `file_system`\n\nFor custom storage (e.g., database, MongoDB), implement a custom adapter."
},
"read": {
"type": "array",
"markdownDescription": "Locale files or `Dir.glob` patterns where translations are read from. Supports wildcards for scanning multiple directories.\n\n**Default:** `['config/locales/%{locale}.yml']`\n\n**Example:**\n```yaml\nread:\n - 'config/locales/**/%{locale}.yml'\n - 'config/locales/%{locale}.yml'\n```",
"uniqueItems": true,
"items": {
"type": "string"
}
},
"write": {
"type": "array",
"uniqueItems": true,
"markdownDescription": "File patterns for writing translations. Supports key-based routing to organize translations into multiple files.\n\n**Routers:**\n- `pattern_router` - Routes keys based on patterns (e.g., `models.*` → `models.%{locale}.yml`)\n- `conservative_router` (default) - Keeps keys where found\n- `isolating_router` - Each YAML file is independent with similar keys\n\n**Example:**\n```yaml\nwrite:\n - ['{models,views}.*', 'config/locales/\\\\1.%{locale}.yml']\n - 'config/locales/%{locale}.yml'\n```",
"items": {
"anyOf": [
{ "type": "string" },
{
"type": "array",
"uniqueItems": true,
"items": { "type": "string" },
"minItems": 2,
"maxItems": 2
}
]
}
},
"external": {
"type": "array",
"uniqueItems": true,
"markdownDescription": "External translation file patterns (e.g., from gems). These are read-only and won't be modified by i18n-tasks.\n\n**Example:**\n```yaml\nexternal:\n - 'vendor/gems/**/config/locales/%{locale}.yml'\n```",
"items": {
"type": "string"
}
},
"yaml": {
"type": "object",
"markdownDescription": "YAML-specific write configuration for controlling file formatting.",
"properties": {
"write": {
"type": "object",
"properties": {
"line_width": {
"anyOf": [
{ "type": "integer", "minimum": -1 },
{ "$ref": "#/definitions/erb" }
],
"markdownDescription": "Maximum line width for YAML values before wrapping. Set to `-1` to prevent wrapping long lines at 80 characters.\n\n**Default:** `80`\n\n**Example:**\n```yaml\nyaml:\n write:\n line_width: -1 # Never wrap lines\n```"
}
},
"additionalProperties": false
}
},
"additionalProperties": false
},
"json": {
"type": "object",
"markdownDescription": "JSON-specific write configuration for controlling file formatting.",
"properties": {
"write": {
"type": "object",
"properties": {
"indent": {
"type": "string",
"default": " ",
"markdownDescription": "Indentation string for nested JSON objects.\n\n**Default:** `\" \"` (2 spaces)"
},
"space": {
"type": "string",
"default": " ",
"markdownDescription": "Space character after colons in JSON.\n\n**Default:** `\" \"` (1 space)"
},
"object_nl": {
"type": "string",
"default": "\n",
"markdownDescription": "Newline character after JSON objects.\n\n**Default:** `\"\\n\"`"
},
"array_nl": {
"type": "string",
"default": "\n",
"markdownDescription": "Newline character after JSON arrays.\n\n**Default:** `\"\\n\"`"
}
},
"additionalProperties": false
}
},
"additionalProperties": false
}
},
"additionalProperties": false
},
"search": {
"type": "object",
"markdownDescription": "Configuration for scanning code to find translation key usages. i18n-tasks uses AST scanners for `.rb` and `.html.erb` files, and regexp scanners for other files.",
"properties": {
"paths": {
"type": "array",
"uniqueItems": true,
"markdownDescription": "Directories or file patterns to search for translation key usages.\n\n**Default:** `['app/']`\n\n**Example:**\n```yaml\npaths:\n - app/\n - lib/\n - config/\n```",
"items": {
"type": "string"
}
},
"relative_roots": {
"type": "array",
"uniqueItems": true,
"markdownDescription": "Directories where relative keys (e.g., `t('.title')`) are resolved relative to the file path.\n\n**Example:**\n```yaml\nrelative_roots:\n - app/views\n - app/controllers\n```\n\nFor `app/views/users/show.html.erb`, the key `t('.title')` resolves to `users.show.title`.",
"items": {
"type": "string"
}
},
"relative_exclude_method_name_paths": {
"type": "array",
"uniqueItems": true,
"markdownDescription": "Paths where method names should be excluded from relative key resolution. Useful for preventing false positives in certain file patterns.",
"items": {
"type": "string"
}
},
"exclude": {
"type": "array",
"markdownDescription": "Files or `File.fnmatch` patterns to exclude from search. Some files are always excluded regardless (e.g., `.git/`, `node_modules/`).\n\n**Example:**\n```yaml\nexclude:\n - app/assets/**\n - vendor/**\n - spec/**\n```",
"uniqueItems": true,
"items": {
"type": "string"
}
},
"only": {
"type": "array",
"markdownDescription": "The only files or `File.fnmatch` patterns to search in `paths`. If specified, this takes priority over `exclude`, though `exclude` still applies.\n\n**Example:**\n```yaml\nonly:\n - '*.rb'\n - '*.erb'\n```",
"uniqueItems": true,
"items": {
"type": "string"
}
},
"strict": {
"anyOf": [{ "type": "boolean" }, { "$ref": "#/definitions/erb" }],
"markdownDescription": "Enable strict mode for dynamic key inference. When `false`, dynamic keys like `t(\"cats.#{cat}.name\")` are partially recognized (wildcards for interpolated parts).\n\n**Default:** `true` (strict)\n\n- `true` - Only static keys are recognized\n- `false` - Dynamic keys are inferred with wildcards\n\n**Example:**\n```yaml\nstrict: false\n```"
},
"prism": {
"anyOf": [
{ "enum": ["rails", "ruby"] },
{ "$ref": "#/definitions/erb" }
],
"markdownDescription": "Use Prism-based scanner for Ruby and ERB files (experimental).\n\n**Modes:**\n- `rails` - Handles Rails-specific contexts (controllers, `before_action`, model translations)\n- `ruby` - Basic Ruby parsing only\n\n**Example:**\n```yaml\nprism: rails\n```\n\nPlease run `i18n-tasks check-prism` to help test this feature."
}
},
"additionalProperties": false
},
"translation": {
"markdownDescription": "Translation backend configuration for automatic translation of missing keys. Use `i18n-tasks translate-missing` to translate.\n\n**Available backends:**\n- `google` - Google Translate API\n- `deepl` - DeepL Pro API (recommended for quality)\n- `yandex` - Yandex Translate API\n- `openai` - OpenAI API\n- `watsonx` - IBM watsonx AI\n\n**Example:**\n```yaml\ntranslation:\n backend: deepl\n deepl_api_key: <%= ENV['DEEPL_AUTH_KEY'] %>\n```",
"oneOf": [
{ "$ref": "#/definitions/google" },
{ "$ref": "#/definitions/deepl" },
{ "$ref": "#/definitions/yandex" },
{ "$ref": "#/definitions/openai" },
{ "$ref": "#/definitions/watsonx" }
]
}
},
"additionalProperties": false
}