YAML
Babely supports YAML files as a source format, which is commonly used in Ruby on Rails, Laravel, and other frameworks. This format supports nested structures, arrays, and complex data types.
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": { "yaml": { "include": ["config/locales/[locale].yml"] } } }
Translating
With your config set, run:
typescript
npx babely@latest translate
When you run this command, Babely will:
- ◇Load your source YAML file (e.g., config/locales/en.yml)
- ◇Detect any new or modified translation strings
- ◇Generate translations for your target languages
- ◇Create or update the target language YAML files (e.g., config/locales/sv.yml)
- ◇Preserve nested structures and formatting