Created
October 10, 2012 12:56
-
-
Save giacomomacri/3865455 to your computer and use it in GitHub Desktop.
Add Models Attribute on LocaleApp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :localeapp do | |
desc "Usage: rake localeapp:add_models_keys['Model1 Model2 Model3']" | |
task :add_models_keys, [:models] => :environment do |task, args| | |
models = args[:models].split(' ') | |
models.each do |model| | |
model_attributes = model.constantize.attribute_names - %w(id) | |
I18n.available_locales.each do |locale| | |
model_attributes.each do |at| | |
key = "activerecord.attributes.#{model.downcase}.#{at}" | |
puts "Sending key: #{key} for #{locale}" | |
Localeapp.missing_translations.add(locale, key, nil) | |
end | |
end | |
end | |
Localeapp.sender.post_missing_translations | |
puts "Success!" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment