Cleanup
This commit is contained in:
17
apps/web/lib/i18n/i18n.resolver.ts
Normal file
17
apps/web/lib/i18n/i18n.resolver.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
/**
|
||||
* Resolves the translation file for a given language and namespace.
|
||||
*
|
||||
*/
|
||||
export async function i18nResolver(language: string, namespace: string) {
|
||||
try {
|
||||
const { default: 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>;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user