This commit is contained in:
Martin Raifer
2023-07-12 13:01:16 +02:00
parent 9af341b7bf
commit ef5e6c1032
+5 -1
View File
@@ -197,7 +197,7 @@ function getLanguage(resourceId) {
return async (code, callback) => {
try {
code = code.replace(/-/g, '_');
function delay(t) { return new Promise(resolve => setTimeout(resolve, t)); }
// random delay to avoid rate-limit of Transifex' API
await delay(Math.random() * 60000);
const url = await transifexApi.ResourceTranslationsAsyncDownload.download({
resource: {data:{type:'resources', id:`o:${transifexOrganization}:p:${transifexProject}:r:${resourceId}`}},
@@ -308,3 +308,7 @@ function checkForDuplicateShortcuts(code, coreStrings) {
}
});
}
function delay(t) {
return new Promise(resolve => { setTimeout(resolve, t); });
}