feat(tools): Script to delete all translations of a language on Crowdin (#41380)

This commit is contained in:
Randell Dawson
2021-03-06 21:45:51 -07:00
committed by GitHub
parent 55dfa28359
commit 48981bf997
3 changed files with 48 additions and 1 deletions

View File

@@ -0,0 +1,30 @@
/*
This one-off script can be used to delete all existing translations for a specified language on Crowdin.
Specifying a projectId and lanaguageId in the .env file allows the script to accomplish this task.
*/
require('dotenv').config({ path: `${__dirname}/../.env` });
const {
getLanguageTranslations,
deleteLanguageTranslations
} = require('../utils/strings');
const projectId = process.env.CROWDIN_PROJECT_ID;
const languageId = process.env.CROWDIN_LANGUAGE_ID;
(async (projectId, languageId) => {
console.log('starting script...');
const translations = await getLanguageTranslations({
projectId,
languageId
});
if (translations && translations.length) {
for (let translation of translations) {
const { stringId } = translation.data;
await deleteLanguageTranslations(projectId, languageId, stringId);
}
}
console.log('complete');
})(projectId, languageId);