@enplug/scripts 1.11.4-dev61 → 1.11.4-dev63
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,11 @@ 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
|
+
|
|
256
|
+
|
|
252
257
|
function promptAddFile(crowdinPath) {
|
|
253
258
|
const prompt = inquirer.createPromptModule();
|
|
254
259
|
|
|
@@ -85,14 +85,14 @@ async function syncTranslations(s3Client, bucket) {
|
|
|
85
85
|
const storageId = await uploadFileToCrowdinStorage(credentials, config.localPath);
|
|
86
86
|
if(fileId && storageId) {
|
|
87
87
|
await updateCrowdinFile(credentials, crowdinPath, storageId.data.data.id, fileId);
|
|
88
|
-
await updateFrakeTranslations(credentials, fileId);
|
|
88
|
+
await updateFrakeTranslations(credentials, fileId, s3EnPath);
|
|
89
89
|
}
|
|
90
90
|
} else {
|
|
91
91
|
const storageId = await uploadFileToCrowdinStorage(credentials, config.localPath);
|
|
92
92
|
if(storageId) {
|
|
93
93
|
const result = await addCrowdinFile(credentials, crowdinPath, storageId.data.data.id, folderId);
|
|
94
94
|
console.log('add result', result.data);
|
|
95
|
-
// await updateFrakeTranslations(credentials, fileId);
|
|
95
|
+
// await updateFrakeTranslations(credentials, fileId, s3EnPath);
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
} else if((crowdinPathSections[0] === 'dashboard' || crowdinPathSections[0] === 'player-web' || crowdinPathSections[0] === 'components') && appDirectoryId) {
|
|
@@ -102,7 +102,7 @@ async function syncTranslations(s3Client, bucket) {
|
|
|
102
102
|
const storageId = await uploadFileToCrowdinStorage(credentials, config.localPath);
|
|
103
103
|
if(fileId && storageId) {
|
|
104
104
|
await updateCrowdinFile(credentials, crowdinPath, storageId.data.data.id, fileId);
|
|
105
|
-
await updateFrakeTranslations(credentials, fileId);
|
|
105
|
+
await updateFrakeTranslations(credentials, fileId, s3EnPath);
|
|
106
106
|
}
|
|
107
107
|
} else {
|
|
108
108
|
console.error(`Could not upload ${chalk.yellow.bold(`${rowdinPathSections[1]}`)}. Only en.json supported.`);
|
|
@@ -116,7 +116,7 @@ async function syncTranslations(s3Client, bucket) {
|
|
|
116
116
|
const storageId = await uploadFileToCrowdinStorage(credentials, config.localPath);
|
|
117
117
|
if(fileId && storageId) {
|
|
118
118
|
await updateCrowdinFile(credentials, crowdinPath, storageId.data.data.id, fileId);
|
|
119
|
-
await updateFrakeTranslations(credentials, fileId);
|
|
119
|
+
await updateFrakeTranslations(credentials, fileId, s3EnPath);
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
122
|
}
|
|
@@ -125,13 +125,16 @@ async function syncTranslations(s3Client, bucket) {
|
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
127
|
|
|
128
|
-
async function updateFrakeTranslations(credentials, fileId) {
|
|
129
|
-
const { data:
|
|
130
|
-
console.log('eo data',
|
|
128
|
+
async function updateFrakeTranslations(credentials, fileId, s3EnPath) {
|
|
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
|
|