Significant changes to the YAML File Handler

By Edouard on February 24, 2012

I pushed quite a few changes to the YAML Handler in the last few months. This post is fairly technical, but if you use WebTranslateIt to localize your YAML files, read on.

Yamler changes

The biggest change is that I updated the YAML handler to handle both files dumped by Syck and Psych. Syck is an old and buggy YAML parser, which is replaced by Psych in Ruby 1.9.3. The problem is, YAML files dumped with Syck are not always parseable with Psych.

Since some users still upload projects using Syck, WebTranslateIt recognize both: it first tries to read your file using Psych. If it fails, it tries to read it using Syck.

The YAML files generated by WebTranslateIt are made with ya2yaml, another ruby library, which is both Syck and Psych compatible.

String ordering

Until a few weeks ago, strings in YAML files were alphabetically sorted. It means that WebTranslateIt probably wasn’t keeping the strings in your file in the same order you uploaded them.

WebTranslateIt now saves the order of your strings, and exports them in the same exact order.

I hope you will find these two changes to how YAML files are handled useful. Thank you for localizing your app with WebTranslateIt!