YAML (Ruby, etc.)
- File extensions: .yaml, .yml
- i18n type: YAML
YAMl is used as an i18n format by some projects, like those build on top of Ruby on Rails.
YAML supports various datatypes (from simple to user defined datatypes). Of those, it makes sense to translate only string-like values. So, Transifex ignores int, float, symbols, variables and other non string and non-container (i.e. lists and mappings) datatypes during importing YAML files.
Regarding container datatypes, Transifex imports lists as a single segment, whereas for mappings Transifex will create a segment per element. Block literals in YAML are also supported.
When a YAML file is downloaded from Transifex for use, it only contains entries that have been translated in the specific language. Additionally, if the requested language is the source language of the resource, the original comments of the source file will also be included in the downloaded file. If the user asked for reviewed translations only, then only entries with reviewed translations will be included instead. However, files that are downloaded for offline translation include all entries, regardless of whether they have been translated or not. Comments from the original source file are also included.
It is recommended that the indentation used in a YAML file is uniform throughout the file.
Additionally, Transifex's YAML handler expects the source YAML file to have a single root element, which is the language code for the YAML file. The language code can have one of the forms xx, xx-XX and xx_XX (for instance, en, en_US or en-US).
Transifex also supports developer comments in YAML files. A valid YAML comment preceding any of the elements will be saved as comment for the source string extracted from the element. For instance, in the following case the comment will be associated with the entry:
en: nav: # This is a comment for Libraries. libraries: 'Libraries'
And there's also support for multiple-line comments
en: nav: # This is a comment for Libraries with # two lines. libraries: 'Libraries'