Sha256: 1afe28c3a98fac7a077405ab345ba59b547521cb6b908ce86ac470832a94ce0e

Contents?: true

Size: 515 Bytes

Versions: 2

Compression:

Stored size: 515 Bytes

Contents

class Interpreter::Translation
  attr_reader :locale, :key, :value

  def initialize locale, key, value
    @locale = locale
    @key = key
    @value = value
  end

  def self.all
    collection = []
    Interpreter.backend.keys.each do |key|
      collection << self.new(key.split('.')[0], key, Interpreter.backend[key])
    end
    return collection.sort{|a, b| a.key <=> b.key}
  end

  def self.create locale, key, value
    I18n.backend.store_translations(locale, { key => value }, :escape => false)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
interpreter-0.0.3 lib/interpreter/translation.rb
interpreter-0.0.2 lib/interpreter/translation.rb