MDX
Translate MDX prose and selected literal component properties while preserving expressions, imports, and component structure.
MDX lets an article include interactive components alongside its prose. The mdx file handler translates supported prose and component children while retaining their markup. Select literal component properties explicitly when they also contain words readers see; imports and expressions are not executed to discover text.
Separate prose from component data #
For example, a callout has both a visible title and a behavioral property:
import Callout from "./Callout";
## Delivery options {#delivery}
<Callout title="Delivery deadline" kind="warning">
Confirm your address before checkout.
</Callout>The heading and child prose are translation text. kind is component data that should remain fixed. title becomes translation work only when a component-property rule selects it. A rule limited to Callout and title is safer than translating every attribute with that name across unrelated components.
String-literal properties are supported. A property computed by an expression is not equivalent to a literal message. Imports, JavaScript expressions, and code blocks remain outside ordinary prose extraction. Component structure still needs to match the application's renderer.
Frontmatter and heading anchors #
The file handler selects frontmatter title and description by default. Supply an empty selection to leave frontmatter untranslated. Selecting a map or sequence includes its scalar descendants, so choose precise paths such as seo.title when neighboring routing fields must stay fixed. See CLI configuration for translateFrontmatterFields and translateComponentProps.
Docusaurus heading anchors such as {#delivery} are protected while heading text changes. Anchor handling recognizes heading-line syntax outside fenced code and leaves URL slugs unchanged. Verify the rendered heading ID and incoming links in your site.
Updates and alignment #
Existing wording can carry forward when the previous source and target have corresponding text units and protected inline structure. When that correspondence is ambiguous, the handler can reject reuse. Keep accepted targets paired with their source revision rather than silently supplying a structurally unrelated document.
Inspect selected properties after reconstruction, including visible labels outside the child prose, and build the result with your application's MDX processor.
Configure MDX translation #
The CLI infers mdx from .mdx; key scope is unavailable for this format. Use CLI configuration or GitHub for file options.
Check the rendered component #
Build the retrieved MDX with your actual processor and inspect component properties, anchors, variables, and code examples together. MDX file translation preserves a document containing JSX; React message extraction instead finds supported calls in application source and produces catalogs. Choose the workflow that matches where the message is authored.