Browse files

Add ya2yaml support

  • Loading branch information...
1 parent 0e96b0e commit c07597fd6a9b57757f7e55f818f47a98503eaf9b @lifo lifo committed Apr 11, 2010
Showing with 12 additions and 1 deletion.
  1. +2 −1 app/models/tolk/locale.rb
  2. +3 −0 config/environment.rb
  3. +7 −0 init.rb
View
3 app/models/tolk/locale.rb
@@ -46,7 +46,8 @@ def secondary_locales
def dump_all(to = self.locales_config_path)
secondary_locales.each do |locale|
File.open("#{to}/#{locale.name}.yml", "w+") do |file|
- YAML.dump(locale.to_hash, file)
+ data = locale.to_hash
+ data.respond_to?(:ya2yaml) ? file.write data.ya2yaml(:syck_compatible => true) : YAML.dump(locale.to_hash, file)
end
end
end
View
3 config/environment.rb
@@ -11,3 +11,6 @@
:secret => 'f2d72b63242db79df080031c60159a419981cc6c066e961405c1a86c5c38ba56c960d6de171dc4cf985f1544c00466400abf0aac2ce1cbdb726f6127d304fb07'
}
end
+
+$KCODE = 'UTF8'
+require 'ya2yaml'
View
7 init.rb
@@ -4,3 +4,10 @@
$: << File.join(will_paginate, 'lib')
require File.join(will_paginate, 'init')
+
+$KCODE = 'UTF8'
+begin
+ require 'ya2yaml'
+rescue LoadError => e
+ Rails.logger.debug "[Tolk] Could not load ya2yaml"
+end

0 comments on commit c07597f

Please sign in to comment.