Sha256: 3bd2ebe320f24793c5ef41bfb5fb067c1ebb5d6c5cdbd975fce6af5fd30b7975

Contents?: true

Size: 622 Bytes

Versions: 1

Compression:

Stored size: 622 Bytes

Contents

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 read_from_file
    Translate::File.new(file_path).read_raw()
  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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
translate-rails3-plus-0.0.15 lib/translate/storage.rb