Improve tree shaking and dynamic loading, fix translations in production build. Moved i18n settings to the application's side.
This commit is contained in:
@@ -3,15 +3,9 @@
|
||||
*
|
||||
*/
|
||||
export async function i18nResolver(language: string, namespace: string) {
|
||||
try {
|
||||
const { default: data } = await import(
|
||||
`../../public/locales/${language}/${namespace}.json`
|
||||
const data = await import(
|
||||
`../../public/locales/${language}/${namespace}.json`,
|
||||
);
|
||||
|
||||
return data as Record<string, string>;
|
||||
} catch (e) {
|
||||
console.error('Could not load translation file', e);
|
||||
|
||||
return {} as Record<string, string>;
|
||||
}
|
||||
return data as Record<string, string>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user