diff --git a/apps/dokploy/scripts/combine-translations.mjs b/apps/dokploy/scripts/combine-translations.mjs deleted file mode 100644 index 0af15e84..00000000 --- a/apps/dokploy/scripts/combine-translations.mjs +++ /dev/null @@ -1,54 +0,0 @@ -import fs from "node:fs"; -import path from "node:path"; -import { fileURLToPath } from "node:url"; - -const __dirname = path.dirname(fileURLToPath(import.meta.url)); -const LOCALES_DIR = path.join(__dirname, "../public/locales"); - -// Get all language directories -const languages = fs - .readdirSync(LOCALES_DIR) - .filter((file) => fs.statSync(path.join(LOCALES_DIR, file)).isDirectory()); - -// Process each language -for (const lang of languages) { - const langDir = path.join(LOCALES_DIR, lang); - const jsonFiles = fs - .readdirSync(langDir) - .filter((file) => file.endsWith(".json")); - - // Combine all JSON files for this language - const combinedTranslations = {}; - - for (const file of jsonFiles) { - const content = JSON.parse( - fs.readFileSync(path.join(langDir, file), "utf8") - ); - Object.assign(combinedTranslations, content); - } - - // Create a backup of the original directory - const backupDir = path.join(LOCALES_DIR, `${lang}_backup`); - if (!fs.existsSync(backupDir)) { - fs.mkdirSync(backupDir); - for (const file of jsonFiles) { - fs.copyFileSync(path.join(langDir, file), path.join(backupDir, file)); - } - } - - // Write the combined translations - const outputFile = path.join(LOCALES_DIR, `${lang}.json`); - fs.writeFileSync(outputFile, JSON.stringify(combinedTranslations, null, 2)); - - // Remove the original directory after backup - fs.rmSync(langDir, { recursive: true, force: true }); - - console.log( - `āœ… Processed ${lang}: Combined ${jsonFiles.length} files into ${lang}.json` - ); -} - -console.log("\nšŸŽ‰ All translations have been combined successfully!"); -console.log( - "šŸ“ Backups of the original files are stored in [language]_backup directories" -);