@enplug/scripts 1.11.4-dev62 → 1.11.4-dev64
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.
|
@@ -249,6 +249,10 @@ function fetchFileFromCrowdin(credentials, language, fileId) {
|
|
|
249
249
|
return axios.post(url, body, { headers: { Authorization: AuthStr } });
|
|
250
250
|
}
|
|
251
251
|
|
|
252
|
+
function readFakeTranslationsFile(url) {
|
|
253
|
+
return axios.get(url);
|
|
254
|
+
}
|
|
255
|
+
|
|
252
256
|
function promptAddFile(crowdinPath) {
|
|
253
257
|
const prompt = inquirer.createPromptModule();
|
|
254
258
|
|
|
@@ -259,4 +263,4 @@ function promptAddFile(crowdinPath) {
|
|
|
259
263
|
}));
|
|
260
264
|
}
|
|
261
265
|
|
|
262
|
-
module.exports = { getCrowdinCredentials, getCrowdinConfig, findCrowdinAppDirectoryId, findCrowdinAppSubFolderId, getFileIdIfExists, uploadFileToCrowdinStorage, updateCrowdinFile, addCrowdinFile, uploadFileToCrowdin, fetchFileFromCrowdin };
|
|
266
|
+
module.exports = { getCrowdinCredentials, getCrowdinConfig, findCrowdinAppDirectoryId, findCrowdinAppSubFolderId, getFileIdIfExists, uploadFileToCrowdinStorage, updateCrowdinFile, addCrowdinFile, uploadFileToCrowdin, fetchFileFromCrowdin, readFakeTranslationsFile };
|
|
@@ -5,7 +5,7 @@ const inquirer = require('inquirer');
|
|
|
5
5
|
const fs = require('fs');
|
|
6
6
|
const path = require('path');
|
|
7
7
|
|
|
8
|
-
const { getCrowdinCredentials, getCrowdinConfig, findCrowdinAppDirectoryId, findCrowdinAppSubFolderId, getFileIdIfExists, uploadFileToCrowdinStorage, updateCrowdinFile, addCrowdinFile, uploadFileToCrowdin, fetchFileFromCrowdin } = require('./crowdin');
|
|
8
|
+
const { getCrowdinCredentials, getCrowdinConfig, findCrowdinAppDirectoryId, findCrowdinAppSubFolderId, getFileIdIfExists, uploadFileToCrowdinStorage, updateCrowdinFile, addCrowdinFile, uploadFileToCrowdin, fetchFileFromCrowdin, readFakeTranslationsFile } = require('./crowdin');
|
|
9
9
|
const { checkKeys, validateTranslationFile } = require('./transloco');
|
|
10
10
|
const { uploadTranslationToS3 } = require('./translation-s3');
|
|
11
11
|
const getPackageJson = require('../getPackageJson');
|
|
@@ -126,12 +126,15 @@ async function syncTranslations(s3Client, bucket) {
|
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
async function updateFrakeTranslations(credentials, fileId, s3EnPath) {
|
|
129
|
-
const { data:
|
|
130
|
-
console.log('eo data',
|
|
129
|
+
const { data: fakeTranslationUrl } = await fetchFileFromCrowdin(credentials, FAKE_IN_CONTEXT_LANGUAGE, fileId);
|
|
130
|
+
console.log('eo data', fakeTranslationUrl);
|
|
131
131
|
const s3TranslationsPath = path.parse(s3EnPath).dir;
|
|
132
132
|
console.log('s3TranslationsPath', s3TranslationsPath);
|
|
133
133
|
const s3FakeTranslationPath = path.join(s3TranslationsPath, FAKE_IN_CONTEXT_LANGUAGE_FILE);
|
|
134
134
|
console.log('s3FakeTranslationPath', s3FakeTranslationPath);
|
|
135
|
+
const fakeTranslation = await readFakeTranslationsFile(fakeTranslationUrl.data.url);
|
|
136
|
+
console.log('s3FakeTranslationPath', fakeTranslation.data);
|
|
137
|
+
|
|
135
138
|
// await uploadTranslationToS3(s3Client, bucket, s3FakeTranslationPath, JSON.stringify(fakeTranslation));
|
|
136
139
|
}
|
|
137
140
|
|