ChiliProject is not maintained anymore. Please be advised that there will be no more updates.

We do not recommend that you setup new ChiliProject instances and we urge all existing users to migrate their data to a maintained system, e.g. Redmine. We will provide a migration script later. In the meantime, you can use the instructions by Christian Daehn.

I18n YAML files not parsable with psych yaml library (Bug #346)

Added by Gregor Schmidt at 2011-04-21 08:37 am. Updated at 2011-04-22 09:26 pm.

Status:Closed Start date:2011-04-21
Priority:Normal Due date:
Assignee:Eric Davis % Done:


Target version:2.0.0
Remote issue URL: Affected version:unstable


While moving the 1.9.2 test from unstable_experimental to unstable on ci.cp.o, I was running into an issue, that I faced regularly when setting up tests for 1.9.2. I do not know, why it does not occur everytime, but only under certain conditions, I could not identify yet. The error looks like the following:

/var/lib/jenkins/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/psych.rb:148:in `parse': couldn't parse YAML at line 25 column 14 (Psych::SyntaxError)
    from /var/lib/jenkins/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/psych.rb:148:in `parse_stream'
    from /var/lib/jenkins/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/psych.rb:119:in `parse'
    from /var/lib/jenkins/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/psych.rb:106:in `load'
    from /var/lib/jenkins/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/psych.rb:205:in `load_file'
    from /var/lib/jenkins/.rvm/gems/ruby-1.9.2-p180@122111e57d93198a0f313f0a05f86083/gems/i18n-0.4.2/lib/i18n/backend/base.rb:205:in `load_yml'
    from /var/lib/jenkins/.rvm/gems/ruby-1.9.2-p180@122111e57d93198a0f313f0a05f86083/gems/i18n-0.4.2/lib/i18n/backend/base.rb:191:in `load_file'
    from /var/lib/jenkins/.rvm/gems/ruby-1.9.2-p180@122111e57d93198a0f313f0a05f86083/gems/i18n-0.4.2/lib/i18n/backend/base.rb:20:in `block in load_translations'
    from /var/lib/jenkins/.rvm/gems/ruby-1.9.2-p180@122111e57d93198a0f313f0a05f86083/gems/i18n-0.4.2/lib/i18n/backend/base.rb:20:in `each'
    from /var/lib/jenkins/.rvm/gems/ruby-1.9.2-p180@122111e57d93198a0f313f0a05f86083/gems/i18n-0.4.2/lib/i18n/backend/base.rb:20:in `load_translations'
    from /var/lib/jenkins/.rvm/gems/ruby-1.9.2-p180@122111e57d93198a0f313f0a05f86083/gems/i18n-0.4.2/lib/i18n/backend/simple.rb:57:in `init_translations'
    from /var/lib/jenkins/.rvm/gems/ruby-1.9.2-p180@122111e57d93198a0f313f0a05f86083/gems/i18n-0.4.2/lib/i18n/backend/simple.rb:40:in `available_locales'
    from /var/lib/jenkins/.rvm/gems/ruby-1.9.2-p180@122111e57d93198a0f313f0a05f86083/gems/i18n-0.4.2/lib/i18n/config.rb:39:in `available_locales'
    from /var/lib/jenkins/.rvm/gems/ruby-1.9.2-p180@122111e57d93198a0f313f0a05f86083/gems/i18n-0.4.2/lib/i18n.rb:36:in `available_locales'
    from /var/lib/jenkins/.rvm/gems/ruby-1.9.2-p180@122111e57d93198a0f313f0a05f86083/gems/actionpack-2.3.11/lib/action_view/template.rb:226:in `valid_locale?'


Anyways, I think there is a rather simple underlying problem, that can be easily fixed. Here is the background:

There are currently multiple libraries for parsing YAML files. While 1.8.x is using syck (made by _why) 1.9.2 seems to also ship with an alternative named psych. It seems, syck is still used as default unless configured differently. On the other hand, some sources claim, that RubyGems 1.5 explicitly loads psych if it is available. [1] JRuby's 1.9 mode seems to only support psych.[2]

Anyways, syck seems to be rather forgiving when parsing YAML files and also works with files, that are actually invalid YAML. This seems to be the case for all locale files in ChiliProject.

Proposed fix

The line

order: [ :year, :month, :day ]

is invalid YAML and needs to be replaced with

- :day
- :month
- :year

This was done in Rails' I18n in

By changing these lines in ChiliProject's i18n files, the files would be parsable by both syck and psych and whatever library might win in the future or on the local system, we will be safe. Also, this seems to be the only valid way write them in the first place.

A pull request including the proposed changes will be attached shortly.


Associated revisions

Revision 3b7ea67a
Added by Gregor Schmidt at 2011-04-21 11:47 am

[#346] changing i18n files to use valid yaml syntax that may be parsed by psych

Revision 50faef37
Added by Gregor Schmidt at 2011-04-21 12:04 pm

[#346] also fixing errornous string starting with %

Revision 31d292ce
Added by Gregor Schmidt at 2011-04-21 01:21 pm

[#346] Fixing hebrew translations to work with psyc

Revision 90987ca3
Added by Gregor Schmidt at 2011-04-21 01:24 pm

[#346] Fixing polish and swedish translations to work with psych


Updated by Gregor Schmidt at 2011-04-21 11:31 am

Pull request is at

After fixing the issue described above, there where also some other ambiguities, that needed to be fixed, to parse the files using psych.

I have tested loading them using 1.9.2 with psych and syck, as well as 1.8.7 using syck.

  • Status changed from Open to Ready for review

Updated by Gregor Schmidt at 2011-04-21 11:34 am

One more thing:

Sorry for being so bold, but I would be happy if this was reviewed rather sooner than later, since it currently breaks the tests of 1.9.2 on and I do not know how to work around the fact, that psych is used instead of syck in that configuration.

Updated by Eric Davis at 2011-04-21 08:10 pm

Merged in d02d8e7. Tests all pass in ruby 1.8.7 (2011-02-18 patchlevel 334) [i486-linux], let me know how it looks for 1.9/JRuby.

  • Assignee set to Eric Davis
  • Category set to Translations
  • (deleted custom field) set to unstable
  • Status changed from Ready for review to Closed

Updated by Gregor Schmidt at 2011-04-22 09:26 pm

The errors on ci.cp.o are gone. Now the build is running properly and we're getting some failures.


Also available in: Atom PDF