mirror of
https://github.com/documenso/documenso.git
synced 2025-11-13 08:13:56 +10:00
fix: improve lingui configuration (#1388)
## Description Currently merge conflicts arise due to the compiled JS and PO translation files. This PR is a rework on how we handle extracting and compiling translations to streamline PRs and merging branches. ## Changes Made - Remove compiled translation files from being committed - Extract and compile translations only on build - Extract will still occur when commits land on main to sync and pull new translations with Crowdin
This commit is contained in:
@ -7,9 +7,10 @@ import type { I18nLocaleData, SupportedLanguageCodes } from '../constants/i18n';
|
||||
import { APP_I18N_OPTIONS } from '../constants/i18n';
|
||||
|
||||
export async function dynamicActivate(i18nInstance: I18n, locale: string) {
|
||||
const { messages } = await import(
|
||||
`../translations/${locale}/${IS_APP_WEB ? 'web' : 'marketing'}.js`
|
||||
);
|
||||
const extension = process.env.NODE_ENV === 'development' ? 'po' : 'js';
|
||||
const context = IS_APP_WEB ? 'web' : 'marketing';
|
||||
|
||||
const { messages } = await import(`../translations/${locale}/${context}.${extension}`);
|
||||
|
||||
i18nInstance.loadAndActivate({ locale, messages });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user