XML
Babely supports XML file localization, suitable for various XML-based configuration and content files. This format handles complex XML structures while preserving formatting and attributes.
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": { "xml": { "include": ["resources/[locale]/*.xml"] } } }
Translating
With your config set, run:
typescript
npx babely@latest translate
When you run this command, Babely will:
- ◇Load your source XML files (e.g., resources/en/*.xml)
- ◇Detect any new or modified content
- ◇Generate translations for your target languages
- ◇Create or update the target language files (e.g., resources/sv/*.xml)
- ◇Preserve XML structure and formatting
- ◇Handle attribute translations
- ◇Maintain CDATA sections
- ◇Keep XML comments
- ◇Support XML namespaces
- ◇Validate XML structure