0

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 which 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:

References:

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

Try lingohub 14 days for free. No credit card. No catch. Cancel anytime