@vocab/phrase 0.0.0-push-split-translation-files-20230508031119 → 0.0.0-push-split-translation-files-20230508044055
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.
|
@@ -6,7 +6,7 @@ export declare function pushTranslations(translationsByLanguage: TranslationsByL
|
|
|
6
6
|
devLanguage: string;
|
|
7
7
|
branch: string;
|
|
8
8
|
}): Promise<{
|
|
9
|
-
|
|
9
|
+
devLanguageUploadId: string;
|
|
10
10
|
}>;
|
|
11
11
|
export declare function deleteUnusedKeys(uploadId: string, branch: string): Promise<void>;
|
|
12
12
|
export declare function ensureBranch(branch: string): Promise<void>;
|
|
@@ -66,11 +66,13 @@ function translationsToCsv(translations, devLanguage) {
|
|
|
66
66
|
const keyIndex = 1;
|
|
67
67
|
const commentIndex = keyIndex + 1;
|
|
68
68
|
const tagColumn = commentIndex + 1;
|
|
69
|
+
const messageIndex = tagColumn + 1;
|
|
69
70
|
return {
|
|
70
71
|
csvFileStrings,
|
|
71
72
|
keyIndex,
|
|
72
73
|
commentIndex,
|
|
73
|
-
tagColumn
|
|
74
|
+
tagColumn,
|
|
75
|
+
messageIndex
|
|
74
76
|
};
|
|
75
77
|
}
|
|
76
78
|
|
|
@@ -153,21 +155,22 @@ async function pushTranslations(translationsByLanguage, {
|
|
|
153
155
|
csvFileStrings,
|
|
154
156
|
keyIndex,
|
|
155
157
|
commentIndex,
|
|
156
|
-
tagColumn
|
|
158
|
+
tagColumn,
|
|
159
|
+
messageIndex
|
|
157
160
|
} = translationsToCsv(translationsByLanguage, devLanguage);
|
|
158
|
-
|
|
161
|
+
let devLanguageUploadId = '';
|
|
159
162
|
for (const [language, csvFileString] of Object.entries(csvFileStrings)) {
|
|
160
163
|
const formData = new FormData__default["default"]();
|
|
161
164
|
const fileContents = Buffer.from(csvFileString);
|
|
162
165
|
formData.append('file', fileContents, {
|
|
163
166
|
contentType: 'text/csv',
|
|
164
|
-
filename:
|
|
167
|
+
filename: `${language}.translations.csv`
|
|
165
168
|
});
|
|
166
169
|
formData.append('file_format', 'csv');
|
|
167
170
|
formData.append('branch', branch);
|
|
168
171
|
formData.append('update_translations', 'true');
|
|
169
172
|
formData.append('update_descriptions', 'true');
|
|
170
|
-
formData.append(
|
|
173
|
+
formData.append(`locale_mapping[${language}]`, messageIndex);
|
|
171
174
|
formData.append('format_options[key_index]', keyIndex);
|
|
172
175
|
formData.append('format_options[comment_index]', commentIndex);
|
|
173
176
|
formData.append('format_options[tag_column]', tagColumn);
|
|
@@ -186,10 +189,12 @@ async function pushTranslations(translationsByLanguage, {
|
|
|
186
189
|
log('Response:', result);
|
|
187
190
|
throw new Error('Error uploading');
|
|
188
191
|
}
|
|
189
|
-
|
|
192
|
+
if (language === devLanguage) {
|
|
193
|
+
devLanguageUploadId = result.id;
|
|
194
|
+
}
|
|
190
195
|
}
|
|
191
196
|
return {
|
|
192
|
-
|
|
197
|
+
devLanguageUploadId
|
|
193
198
|
};
|
|
194
199
|
}
|
|
195
200
|
async function deleteUnusedKeys(uploadId, branch) {
|
|
@@ -335,15 +340,13 @@ async function push({
|
|
|
335
340
|
}
|
|
336
341
|
}
|
|
337
342
|
const {
|
|
338
|
-
|
|
343
|
+
devLanguageUploadId
|
|
339
344
|
} = await pushTranslations(phraseTranslations, {
|
|
340
345
|
devLanguage: config.devLanguage,
|
|
341
346
|
branch
|
|
342
347
|
});
|
|
343
348
|
if (deleteUnusedKeys$1) {
|
|
344
|
-
|
|
345
|
-
await deleteUnusedKeys(uploadId, branch);
|
|
346
|
-
}
|
|
349
|
+
await deleteUnusedKeys(devLanguageUploadId, branch);
|
|
347
350
|
}
|
|
348
351
|
}
|
|
349
352
|
|
|
@@ -66,11 +66,13 @@ function translationsToCsv(translations, devLanguage) {
|
|
|
66
66
|
const keyIndex = 1;
|
|
67
67
|
const commentIndex = keyIndex + 1;
|
|
68
68
|
const tagColumn = commentIndex + 1;
|
|
69
|
+
const messageIndex = tagColumn + 1;
|
|
69
70
|
return {
|
|
70
71
|
csvFileStrings,
|
|
71
72
|
keyIndex,
|
|
72
73
|
commentIndex,
|
|
73
|
-
tagColumn
|
|
74
|
+
tagColumn,
|
|
75
|
+
messageIndex
|
|
74
76
|
};
|
|
75
77
|
}
|
|
76
78
|
|
|
@@ -153,21 +155,22 @@ async function pushTranslations(translationsByLanguage, {
|
|
|
153
155
|
csvFileStrings,
|
|
154
156
|
keyIndex,
|
|
155
157
|
commentIndex,
|
|
156
|
-
tagColumn
|
|
158
|
+
tagColumn,
|
|
159
|
+
messageIndex
|
|
157
160
|
} = translationsToCsv(translationsByLanguage, devLanguage);
|
|
158
|
-
|
|
161
|
+
let devLanguageUploadId = '';
|
|
159
162
|
for (const [language, csvFileString] of Object.entries(csvFileStrings)) {
|
|
160
163
|
const formData = new FormData__default["default"]();
|
|
161
164
|
const fileContents = Buffer.from(csvFileString);
|
|
162
165
|
formData.append('file', fileContents, {
|
|
163
166
|
contentType: 'text/csv',
|
|
164
|
-
filename:
|
|
167
|
+
filename: `${language}.translations.csv`
|
|
165
168
|
});
|
|
166
169
|
formData.append('file_format', 'csv');
|
|
167
170
|
formData.append('branch', branch);
|
|
168
171
|
formData.append('update_translations', 'true');
|
|
169
172
|
formData.append('update_descriptions', 'true');
|
|
170
|
-
formData.append(
|
|
173
|
+
formData.append(`locale_mapping[${language}]`, messageIndex);
|
|
171
174
|
formData.append('format_options[key_index]', keyIndex);
|
|
172
175
|
formData.append('format_options[comment_index]', commentIndex);
|
|
173
176
|
formData.append('format_options[tag_column]', tagColumn);
|
|
@@ -186,10 +189,12 @@ async function pushTranslations(translationsByLanguage, {
|
|
|
186
189
|
log('Response:', result);
|
|
187
190
|
throw new Error('Error uploading');
|
|
188
191
|
}
|
|
189
|
-
|
|
192
|
+
if (language === devLanguage) {
|
|
193
|
+
devLanguageUploadId = result.id;
|
|
194
|
+
}
|
|
190
195
|
}
|
|
191
196
|
return {
|
|
192
|
-
|
|
197
|
+
devLanguageUploadId
|
|
193
198
|
};
|
|
194
199
|
}
|
|
195
200
|
async function deleteUnusedKeys(uploadId, branch) {
|
|
@@ -335,15 +340,13 @@ async function push({
|
|
|
335
340
|
}
|
|
336
341
|
}
|
|
337
342
|
const {
|
|
338
|
-
|
|
343
|
+
devLanguageUploadId
|
|
339
344
|
} = await pushTranslations(phraseTranslations, {
|
|
340
345
|
devLanguage: config.devLanguage,
|
|
341
346
|
branch
|
|
342
347
|
});
|
|
343
348
|
if (deleteUnusedKeys$1) {
|
|
344
|
-
|
|
345
|
-
await deleteUnusedKeys(uploadId, branch);
|
|
346
|
-
}
|
|
349
|
+
await deleteUnusedKeys(devLanguageUploadId, branch);
|
|
347
350
|
}
|
|
348
351
|
}
|
|
349
352
|
|
package/dist/vocab-phrase.esm.js
CHANGED
|
@@ -54,11 +54,13 @@ function translationsToCsv(translations, devLanguage) {
|
|
|
54
54
|
const keyIndex = 1;
|
|
55
55
|
const commentIndex = keyIndex + 1;
|
|
56
56
|
const tagColumn = commentIndex + 1;
|
|
57
|
+
const messageIndex = tagColumn + 1;
|
|
57
58
|
return {
|
|
58
59
|
csvFileStrings,
|
|
59
60
|
keyIndex,
|
|
60
61
|
commentIndex,
|
|
61
|
-
tagColumn
|
|
62
|
+
tagColumn,
|
|
63
|
+
messageIndex
|
|
62
64
|
};
|
|
63
65
|
}
|
|
64
66
|
|
|
@@ -141,21 +143,22 @@ async function pushTranslations(translationsByLanguage, {
|
|
|
141
143
|
csvFileStrings,
|
|
142
144
|
keyIndex,
|
|
143
145
|
commentIndex,
|
|
144
|
-
tagColumn
|
|
146
|
+
tagColumn,
|
|
147
|
+
messageIndex
|
|
145
148
|
} = translationsToCsv(translationsByLanguage, devLanguage);
|
|
146
|
-
|
|
149
|
+
let devLanguageUploadId = '';
|
|
147
150
|
for (const [language, csvFileString] of Object.entries(csvFileStrings)) {
|
|
148
151
|
const formData = new FormData();
|
|
149
152
|
const fileContents = Buffer.from(csvFileString);
|
|
150
153
|
formData.append('file', fileContents, {
|
|
151
154
|
contentType: 'text/csv',
|
|
152
|
-
filename:
|
|
155
|
+
filename: `${language}.translations.csv`
|
|
153
156
|
});
|
|
154
157
|
formData.append('file_format', 'csv');
|
|
155
158
|
formData.append('branch', branch);
|
|
156
159
|
formData.append('update_translations', 'true');
|
|
157
160
|
formData.append('update_descriptions', 'true');
|
|
158
|
-
formData.append(
|
|
161
|
+
formData.append(`locale_mapping[${language}]`, messageIndex);
|
|
159
162
|
formData.append('format_options[key_index]', keyIndex);
|
|
160
163
|
formData.append('format_options[comment_index]', commentIndex);
|
|
161
164
|
formData.append('format_options[tag_column]', tagColumn);
|
|
@@ -174,10 +177,12 @@ async function pushTranslations(translationsByLanguage, {
|
|
|
174
177
|
log('Response:', result);
|
|
175
178
|
throw new Error('Error uploading');
|
|
176
179
|
}
|
|
177
|
-
|
|
180
|
+
if (language === devLanguage) {
|
|
181
|
+
devLanguageUploadId = result.id;
|
|
182
|
+
}
|
|
178
183
|
}
|
|
179
184
|
return {
|
|
180
|
-
|
|
185
|
+
devLanguageUploadId
|
|
181
186
|
};
|
|
182
187
|
}
|
|
183
188
|
async function deleteUnusedKeys(uploadId, branch) {
|
|
@@ -323,15 +328,13 @@ async function push({
|
|
|
323
328
|
}
|
|
324
329
|
}
|
|
325
330
|
const {
|
|
326
|
-
|
|
331
|
+
devLanguageUploadId
|
|
327
332
|
} = await pushTranslations(phraseTranslations, {
|
|
328
333
|
devLanguage: config.devLanguage,
|
|
329
334
|
branch
|
|
330
335
|
});
|
|
331
336
|
if (deleteUnusedKeys$1) {
|
|
332
|
-
|
|
333
|
-
await deleteUnusedKeys(uploadId, branch);
|
|
334
|
-
}
|
|
337
|
+
await deleteUnusedKeys(devLanguageUploadId, branch);
|
|
335
338
|
}
|
|
336
339
|
}
|
|
337
340
|
|
package/package.json
CHANGED