tracks/vendor/plugins/translate/lib/translate/storage.rb
Reinier Balt 48d9e49482 install translate from https://github.com/newsdesk/translate for non-production use
access /translate to view and edit i18n translations
2011-02-13 13:06:10 +01:00

28 lines
548 B
Ruby

class Translate::Storage
attr_accessor :locale
def initialize(locale)
self.locale = locale.to_sym
end
def write_to_file
Translate::File.new(file_path).write(keys)
end
def self.file_paths(locale)
Dir.glob(File.join(root_dir, "config", "locales", "**","#{locale}.yml"))
end
def self.root_dir
Rails.root
end
private
def keys
{locale => I18n.backend.send(:translations)[locale]}
end
def file_path
File.join(Translate::Storage.root_dir, "config", "locales", "#{locale}.yml")
end
end