diff --git a/packages/backend/src/i18n.ts b/packages/backend/src/i18n.ts index 25d5cf4..ab945dd 100644 --- a/packages/backend/src/i18n.ts +++ b/packages/backend/src/i18n.ts @@ -5,6 +5,9 @@ import fs from 'fs'; // --- 动态确定支持的语言 --- const localesDir = path.join(__dirname, 'locales'); +// --- 添加调试日志 --- +console.log(`[i18next-debug] Calculated locales directory path: ${localesDir}`); +// --- 结束调试日志 --- let dynamicSupportedLngs: string[] = []; try { const entries = fs.readdirSync(localesDir, { withFileTypes: true }); diff --git a/packages/backend/src/services/notification.service.ts b/packages/backend/src/services/notification.service.ts index a0ab41e..b39b40e 100644 --- a/packages/backend/src/services/notification.service.ts +++ b/packages/backend/src/services/notification.service.ts @@ -12,7 +12,7 @@ import { } from '../types/notification.types'; import * as nodemailer from 'nodemailer'; import Mail from 'nodemailer/lib/mailer'; -import i18next, { defaultLng, supportedLngs } from '../i18n'; +import i18next, { defaultLng, supportedLngs } from '../i18n'; // Import supportedLngs import { settingsService } from './settings.service'; @@ -274,6 +274,9 @@ export class NotificationService { // --- 添加调试日志 --- console.log(`[通知调试] 刚从数据库获取的 langSetting: ${langSetting}`); // --- 结束调试日志 --- + // --- 添加调试日志 --- + console.log(`[通知调试] Checking langSetting against supportedLngs:`, supportedLngs); + // --- 结束调试日志 --- if (langSetting && supportedLngs.includes(langSetting)) { userLang = langSetting; }