mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
### What? 1. Rename [`app-dir-i18n-routing`](https://github.com/vercel/next.js/tree/canary/examples/app-dir-i18n-routing) example `i18n-routing`. 2. Rename [`i18n-routing`](https://github.com/vercel/next.js/tree/canary/examples/i18n-routing) example `i18n-routing-pages`. 3. Update the docs mentions i18n-routing examples. 4. Update the test includes i18n-routing examples. ### Why? The default has already been App Router anyways and a lot of examples have migrated over. x-ref: https://github.com/vercel/next.js/pull/72642#issuecomment-2474415343 ### How? Change them as in [reproduction-template](https://github.com/vercel/next.js/tree/canary/examples/reproduction-template) and [reproduction-template-pages](https://github.com/vercel/next.js/tree/canary/examples/reproduction-template-pages) examples. ### Improving Documentation - [x] Run `pnpm prettier-fix` to fix formatting issues before opening the PR. - [x] Read the Docs Contribution Guide to ensure your contribution follows the docs guidelines: https://nextjs.org/docs/community/contribution-guide ### Adding or Updating Examples - [x] The "examples guidelines" are followed from our contributing doc https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md - [x] Make sure the linting passes by running `pnpm build && pnpm lint`. See https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md Co-authored-by: Delba de Oliveira <[email protected]>
14 lines
568 B
TypeScript
14 lines
568 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("./dictionaries/en.json").then((module) => module.default),
|
|
de: () => import("./dictionaries/de.json").then((module) => module.default),
|
|
cs: () => import("./dictionaries/cs.json").then((module) => module.default),
|
|
};
|
|
|
|
export const getDictionary = async (locale: Locale) =>
|
|
dictionaries[locale]?.() ?? dictionaries.en();
|