Add i18n support with Next.js App Router and Dictionaries
This commit is contained in:
10
app/dictionaries.ts
Normal file
10
app/dictionaries.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import 'server-only'
|
||||
|
||||
const dictionaries = {
|
||||
en: () => import('./dictionaries/en.json').then((module) => module.default),
|
||||
tr: () => import('./dictionaries/tr.json').then((module) => module.default),
|
||||
}
|
||||
|
||||
export type Locale = keyof typeof dictionaries
|
||||
|
||||
export const getDictionary = async (locale: Locale) => dictionaries[locale]()
|
||||
Reference in New Issue
Block a user