const path = require('path');
let i18n = {};
const languages = ['en', 'es', 'fr', 'eu', 'de', 'it', 'pt', 'zh', 'ar', 'hi', 'ru'];

languages.forEach(language => {
  try {
    const languagePath = path.join(__dirname, `oasis_${language}.js`);
    const languageData = require(languagePath);
    i18n[language] = languageData[language];
  } catch (error) {
    console.error(`Failed to load language file for ${language}:`, error);
  }
});

try {
  const overlay = require('./fork/i18n_fork.js');
  languages.forEach(l => Object.assign(i18n[l] = i18n[l] || {}, overlay[l] || overlay.en || {}));
} catch (e) {}

module.exports = i18n;
