Markdown (MDX)
Languine supports Markdown (MDX) file localization, perfect for documentation, blog posts, and content-heavy sites. This format preserves Markdown syntax while translating content, including front matter support.
Setting Up
First, make sure you've got a babely.json config file in your project root. Here's an example:
typescript
{ "locale": { "source": "en", "targets": ["sv", "de", "fr"] }, "files": { "mdx": { "include": ["content/[locale]/**/*.mdx"] } } }
Translating
With your config set, run:
typescript
npx babely@latest translate
When you run this command, Languine will:
- ◇Load your source Markdown files (e.g., content/en/*.mdx)
- ◇Detect any new or modified content
- ◇Generate translations for your target languages
- ◇Create or update the target language files (e.g., content/sv/*.mdx)
- ◇Preserve Markdown formatting and structure
- ◇Handle front matter translations
- ◇Maintain links and references
- ◇Keep code blocks untranslated
- ◇Preserve HTML within Markdown