From 2319dba68d656d7aba7cc07a3a1cc88d4d1cb1cd Mon Sep 17 00:00:00 2001 From: devlikepro Date: Wed, 10 Sep 2025 14:44:40 +0700 Subject: [PATCH] [core] ChatWoot - load languages WAHA_APPS_CHATWOOT_LANGUAGES_FOLDER fix #1160 --- src/apps/chatwoot/i18n/i18n.ts | 2 +- src/apps/chatwoot/i18n/index.ts | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/apps/chatwoot/i18n/i18n.ts b/src/apps/chatwoot/i18n/i18n.ts index 68fa4530..8159562a 100644 --- a/src/apps/chatwoot/i18n/i18n.ts +++ b/src/apps/chatwoot/i18n/i18n.ts @@ -26,7 +26,7 @@ export class I18N { if (!this.locales[locale]) { this.locales[locale] = new Locale(strings); } else { - this.locales[locale].override(strings); + this.locales[locale] = this.locales[locale].override(strings); } } diff --git a/src/apps/chatwoot/i18n/index.ts b/src/apps/chatwoot/i18n/index.ts index 8a34a2ce..4546006a 100644 --- a/src/apps/chatwoot/i18n/index.ts +++ b/src/apps/chatwoot/i18n/index.ts @@ -7,4 +7,13 @@ const localesDir = path.join(__dirname, 'locales'); // Load both .yml and .yaml files from locales directory (non-recursive) i18n.load(new YamlLocaleLoader(localesDir, 'yml').load()); i18n.load(new YamlLocaleLoader(localesDir, 'yaml').load()); + +// Resolve env var (supports '.' and '~'); fallback to default +const additional = process.env.WAHA_APPS_CHATWOOT_LANGUAGES_FOLDER?.trim(); +if (additional) { + const resolved = path.resolve(additional); + i18n.load(new YamlLocaleLoader(resolved, 'yml').load()); + i18n.load(new YamlLocaleLoader(resolved, 'yaml').load()); +} + export { i18n };