3 min. read
Dealing with YAML files and their Directory Structure
This article is about the way Translation.io deals with YAML files. Whether you prefer YAML over GetText or you use GetText but dealing with a few YAML keys is inevitable, this page is for you!
Since YAML doesn’t guarantee that only a language is contained in a single file, we unfortunately are not able to mirror your source YAML structure.
Init & sync
Initializing your project implies :
- All .yml files containing keys of your source language will be kept.
- All .yml files containing keys of your target languages will be grouped
into one named
- All localization keys will be separated into localization-specific files.
These files are named
Let’s see this in details.
translation.xx.yml files contain all the “textual” YAML keys from your
project. Once your translators translated them in Translation.io, you can
sync and they will be updated. You cannot edit them directly: they will be
overridden at each sync.
localization.xx.yml files contain all the non-textual (date formats, booleans,
variables) keys that your translators will not understand. We populate them
with the correct values for the target languages when initializing the project.
These files are not synced with Translation.io. So you can update them
manually if you need to. You can also
configure other keys to be treated as localization.
Adding new keys
When a new key is needed:
- Add it to one of your source files.
- The next sync will send this new key to Translation.io and the key will be
added to all target
- After the key is translated in Translation.io, one more sync and your application translations will be up-to-date.
Let’s say your project is in en and is translated to fr and es. And you have these files at the moment :
After an init, you will have these files :
Same file struture for source language and two files per target language for localization.