Sindbad~EG File Manager
const fs = require('fs');
const filename = 'TranslateEnterPages.js'; // Make sure this is the correct file path
fs.readFile(filename, 'utf8', (err, data) => {
if (err) {
console.error(`Error reading file: ${err}`);
return;
}
try {
// Use a safer approach to extract the translations object
const translationsMatch = data.match(/const translations = ({[\s\S]*?});/);
if (!translationsMatch) {
throw new Error("Could not extract translations object from the file.");
}
const translationsCode = translationsMatch[1]; // Extract the object code
const translations = new Function(`return ${translationsCode};`)(); // Parse as JavaScript object
const languages = ["french", "german", "italian", "spanish", "dutch", "chinese"];
const englishKeys = Object.keys(translations.english);
let missingTranslations = {};
languages.forEach(language => {
if (!translations[language]) {
console.warn(`⚠️ Warning: No '${language}' section found in the file.`);
return;
}
missingTranslations[language] = englishKeys.filter(key => !(key in translations[language]));
});
console.log("🔍 Missing translations per language:\n");
languages.forEach(language => {
if (missingTranslations[language] && missingTranslations[language].length > 0) {
console.log(`❌ ${language.toUpperCase()} is missing translations for:`);
console.log(missingTranslations[language].join(", ") + "\n");
} else {
console.log(`✅ ${language.toUpperCase()} is fully translated!\n`);
}
});
} catch (error) {
console.error("❌ Error processing translations:", error);
}
});
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists