Skip to content

Commit abea78f

Browse files
authored
Update Phrase schema (#4638)
1 parent 6aa7762 commit abea78f

File tree

2 files changed

+46
-18
lines changed

2 files changed

+46
-18
lines changed

src/schemas/json/phrase.json

Lines changed: 40 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,17 @@
1919
"description": "Enforces a specific encoding on the file contents. Valid options are \"UTF-8\", \"UTF-16\" and \"ISO-8859-1\"",
2020
"type": "string",
2121
"default": "UTF-8"
22+
},
23+
"format_options": {
24+
"description": "Additional options available for specific formats. See our format guide for complete list.",
25+
"type": "object",
26+
"properties": {
27+
"column_separator": {
28+
"description": "Column separator character",
29+
"type": "string",
30+
"default": ";"
31+
}
32+
}
2233
}
2334
},
2435
"properties": {
@@ -51,24 +62,28 @@
5162
"type": "object",
5263
"properties": {
5364
"file": {
54-
"description": "Translation file which will be uploaded",
65+
"description": "Translation file(s) which should be uploaded. You can either specify a single file or a pattern. The glob pattern will be expanded to all files matching the pattern. Besides '*' and '**', you can use the following placeholders: <locale_name> for the locale name and <locale_code> for the locale code",
5566
"type": "string",
56-
"default": "<locale_name>.yml"
67+
"examples": [
68+
"en.yml",
69+
"translations/*.yml",
70+
"./src/<locale_name>.yml"
71+
]
5772
},
5873
"params": {
5974
"description": "Locale upload parameter",
6075
"type": "object",
6176
"properties": {
62-
"branch": {
63-
"description": "Branch name",
64-
"type": "string"
65-
},
6677
"file_format": {
6778
"$ref": "#/definitions/file_format"
6879
},
6980
"locale_id": {
7081
"$ref": "#/definitions/locale_id"
7182
},
83+
"branch": {
84+
"description": "Branch name",
85+
"type": "string"
86+
},
7287
"tags": {
7388
"description": "List of tags separated by comma to be associated with the new keys contained in the upload",
7489
"type": "string"
@@ -110,27 +125,23 @@
110125
"default": false
111126
},
112127
"mark_reviewed": {
113-
"description": "Indicated whether the imported translations should be marked as reviewed",
128+
"description": "Indicates whether the imported translations should be marked as reviewed",
114129
"type": "boolean",
115130
"default": false
116131
},
117132
"file_encoding": {
118133
"$ref": "#/definitions/encoding"
119134
},
135+
"translation_key_prefix": {
136+
"description": "Prefix all the created keys with the given prefix. This can be used to prevent collisions from multiple different sources",
137+
"type": "string"
138+
},
120139
"locale_mapping": {
121140
"description": "Optional, format specific mapping between locale names and the columns the translations to those locales are contained in",
122141
"type": "object"
123142
},
124143
"format_options": {
125-
"description": "Additional options available for specific formats. See our format guide for complete list",
126-
"type": "object",
127-
"properties": {
128-
"column_separator": {
129-
"description": "Column separator character",
130-
"type": "string",
131-
"default": ";"
132-
}
133-
}
144+
"$ref": "#/definitions/format_options"
134145
}
135146
}
136147
}
@@ -150,9 +161,9 @@
150161
"type": "object",
151162
"properties": {
152163
"file": {
153-
"description": "Translation file which will be downloaded",
164+
"description": "Translation file which will be downloaded. You can either specify a single file or a pattern. The pattern can contain the following placeholders: <locale_name> for the locale name, <locale_code> for the locale code, and <tag>, which will go through the tag list and create a file for each tag. The placeholders will be replaced with the corresponding values.",
154165
"type": "string",
155-
"default": "<locale_name>.yml"
166+
"examples": ["en.yml", "translations/<locale_name>.yml"]
156167
},
157168
"project_id": {
158169
"$ref": "#/definitions/project_id"
@@ -228,6 +239,17 @@
228239
"custom_metadata_filters": {
229240
"description": "Custom metadata filters. Provide the name of the metadata field and the value to filter by. Only keys with matching metadata will be included in the download",
230241
"type": "object"
242+
},
243+
"filter_by_prefix": {
244+
"description": "Filters keys by prefix. Only keys starting with the given prefix will be included in the download, and the prefix will be removed from the key name in the files",
245+
"type": "string"
246+
},
247+
"translation_key_prefix": {
248+
"description": "If a key name starts with the given prefix, the prefix will be removed from the key name in the files",
249+
"type": "string"
250+
},
251+
"format_options": {
252+
"$ref": "#/definitions/format_options"
231253
}
232254
}
233255
}

src/test/phrase/.phrase.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@ phrase:
88
sources:
99
- file: ./config/locales/en.yml
1010
params:
11+
branch: main
1112
locale_id: en
1213
file_format: yml
14+
translation_key_prefix: 'prefix.'
1315
pull:
1416
targets:
1517
- file: ./config/locales/<locale_name>.yml
@@ -18,3 +20,7 @@ phrase:
1820
use_last_reviewed_version: true
1921
include_empty_translations: true
2022
exclude_empty_zero_forms: true
23+
custom_metadata_filters:
24+
character: 'John Doe'
25+
format_options:
26+
column_separator: ','

0 commit comments

Comments
 (0)