commerce/messages/index.ts
2023-08-17 11:56:36 +09:00

13 lines
463 B
TypeScript

import 'server-only';
import type { Locale } from '../i18n-config';
// We enumerate all dictionaries here for better linting and typescript support
// We also get the default import for cleaner types
const dictionaries = {
en: () => import('./en.json').then((module) => module.default),
ja: () => import('./ja.json').then((module) => module.default)
};
export const getDictionary = async (locale: Locale) =>
dictionaries[locale]?.() ?? dictionaries.en();