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)
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.  JRuby's 1.9 mode seems to only support psych.
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.
order: [ :year, :month, :day ]
is invalid YAML and needs to be replaced with
This was done in Rails' I18n in https://github.com/svenfuchs/rails-i18n/pull/78
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.
Pull request is at https://github.com/chiliproject/chiliproject/pull/41
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
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 ci.chiliproject.org and I do not know how to work around the fact, that psych is used instead of syck in that configuration.
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