From ba067df29d9edc86cd8a4b7cfe24554ffd753ff1 Mon Sep 17 00:00:00 2001 From: Jan Amann Date: Fri, 19 Jul 2024 13:05:15 +0200 Subject: [PATCH] docs: Improve phrasing for MDX docs --- docs/pages/docs/environments/mdx.mdx | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/docs/pages/docs/environments/mdx.mdx b/docs/pages/docs/environments/mdx.mdx index fe56bc988..f044a2965 100644 --- a/docs/pages/docs/environments/mdx.mdx +++ b/docs/pages/docs/environments/mdx.mdx @@ -21,9 +21,15 @@ src Now, in `page.tsx`, you can import the MDX content based on the user's locale: ```tsx filename="src/app/[locale]/page.tsx" +import {notFound} from 'next/navigation'; + export default async function HomePage({params}) { - const Content = (await import(`./${params.locale}.mdx`)).default; - return ; + try { + const Content = (await import(`./${params.locale}.mdx`)).default; + return ; + } catch (error) { + notFound(); + } } ``` @@ -44,7 +50,9 @@ Components that invoke hooks from `next-intl` like `useTranslations` can natural
Is MDX required to format rich text? -Not at all! Messages support [rich text syntax](/docs/usage/messages#rich-text), which can be used to provide formatting, structure and embedding of components. +Not at all! The built in message formatting of `next-intl` supports [rich text syntax](/docs/usage/messages#rich-text), which can be used to provide formatting, and to embed React components within messages. + +MDX is best suited for cases where content varies significantly by locale. If all you're looking for is rich text formatting, the built-in message formatting may be an easier choice.