fix: resolve internal pdf translations

This commit is contained in:
David Nguyen
2025-02-19 14:43:35 +11:00
parent 5d86e84217
commit 5ce2bae39d
3 changed files with 25 additions and 14 deletions

View File

@ -5,11 +5,17 @@ import type { I18nLocaleData, SupportedLanguageCodes } from '../constants/i18n';
import { APP_I18N_OPTIONS } from '../constants/i18n';
import { env } from './env';
export async function dynamicActivate(locale: string) {
export async function getTranslations(locale: string) {
const extension = env('NODE_ENV') === 'development' ? 'po' : 'mjs';
const { messages } = await import(`../translations/${locale}/web.${extension}`);
return messages;
}
export async function dynamicActivate(locale: string) {
const messages = await getTranslations(locale);
i18n.loadAndActivate({ locale, messages });
}