const path = require('path'); const fs = require('fs'); const loadTranslation = (languageCode) => { try { const filePath = path.join(__dirname, 'translations', `${languageCode}.json`); return JSON.parse(fs.readFileSync(filePath, 'utf8')); } catch (error) { console.error('Error loading translation:', error); if(languageCode !== 'en') { return loadTranslation('en'); // Fallback to English if the specific language file is missing } return {}; // Fallback to empty object if language file is missing } };