Bike!Bike! Website!
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
667 B

namespace :translations do
desc "Migrates collected translations from the dev and testing environments"
task migrate: :environment do
#File.open('config/locales/.translations.yml', 'w')
#File.open('config/locales/.translation-cache.yml', 'w+')
10 years ago
translations = YAML.load(File.read('config/locales/translation-info.yml')) || Hash.new
translations.each { |k,t|
if t['data']
10 years ago
t['data'].each { |tt|
hash = ActiveSupport::JSON.decode(tt)
begin
translation = Translation.find(hash['id'])
10 years ago
translation.update_attributes(hash)
rescue
begin
Translation.new(hash).save
rescue; end
10 years ago
end
}
end
}
end
end