Lingohub

CEO and founder of Lingohub. Envisioning a multilingual digital world. Email me if you have questions about how Lingohub can help you take your products global.

Helmut Development 1 Comment

SHARE

i18n Resource File Formats: YAML files

We are continuing our series on localization resource file formats, this time with a closer look at one of the most popular formats, especially since the rise of Ruby/Rails in web development. For those not so familiar with YAML I suggest the very good basic introduction that the Wikipedia article provides.

YAML is a human-readable data serialization format. Its syntax was designed to be easily mapped to data types common to most high-level languages (lists, associative arrays and scalars). YAML is what we use for localizing LingoHub in our Ruby on Rails application. It has proven to be a very efficient production environment, especially used in conjunction with Github integration that LingoHub supports natively.

Unlike some other formats, YAML has a well defined standard. Let me outline some key features below followed by an example. As always, feel free to send us questions on these file types or others that you want to use to localize your apps.

Key features of YAML resource file format:

  • key-value pairs are delimited with colon ( : )
  • values can be surrounded by quotes
  • correct and consistent line indentation is important
  • comments start with a hash sign ( # ), and are ignored by the parser
  • in the LingoHub context, all comment lines directly preceding a key-value pair (with no blank lines in between) are treated as translation descriptions or LingoCheck rules belonging to that line.
  • place-holder syntax is: %{name}, where “name” can consist of multiple non-white-space characters
  • we use UTF-8 encoding for YAML resource files exports by default, but we also support other encodings our users might prefer.

An example of a YAML localization resource file format:

[gist: id=5343942]

References:

We are continuing our series on localization resource file formats with with some other popular file types soon, stay tuned and feel free to post questions below.