Skip to content

Commit

Permalink
Clean localization data files before pulling from Transifex
Browse files Browse the repository at this point in the history
The localization of the UI strings specific to the Arduino IDE application is done via the Transifex localization
platform. A scheduled workflow pulls the data from Transifex weekly and submits a pull request for the updates.

Previously, the script used to pull the data did not clean the data files before pulling. This meant that a vestigial
file would accumulate in the repository whenever a language was removed from the Transifex project.

The accumulation is avoided by deleting the data files for the locales managed on Transifex (all locales other than the
source English locale) before downloading the data from Transifex.
  • Loading branch information
per1234 committed Jul 26, 2023
1 parent f6a4325 commit a861cca
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions scripts/i18n/transifex-pull.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// @ts-check

const transifex = require('./transifex');
const path = require('path');
const util = require('util');
const shell = require('shelljs');
const fetch = require('node-fetch');
Expand Down Expand Up @@ -106,6 +107,9 @@ const getTranslationDownloadStatus = async (language, downloadRequestId) => {
const languages = await getLanguages(organization, project);
shell.echo('translations found:', languages.join(', '));

// Remove data managed on Transifex to avoid accumulation of vestigial files
shell.rm(path.join(translationsDirectory, '!(en).json'));

let downloadIds = [];
for (const language of languages) {
downloadIds.push({
Expand Down

0 comments on commit a861cca

Please sign in to comment.