Class: Ixtlan::Gettext::TranslationKey

Inherits:
Object
  • Object
show all
Includes:
DataMapper::Resource
Defined in:
lib/ixtlan/gettext/models.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.available_localesObject



49
50
51
52
53
# File 'lib/ixtlan/gettext/models.rb', line 49

def self.available_locales
  Translation.all(:fields => [:locale_id], :unique => true).collect do |t|
    t.locale
  end
end

.storage_name(arg) ⇒ Object



28
29
30
# File 'lib/ixtlan/gettext/models.rb', line 28

def self.storage_name(arg)
  'gettext_keys'
end

.translation(key, locale) ⇒ Object



45
46
47
# File 'lib/ixtlan/gettext/models.rb', line 45

def self.translation(key, locale)
  Translation.first(TranslationKey.name => key, Locale.code => locale)
end

.update_all(keys) ⇒ Object



37
38
39
40
41
42
43
# File 'lib/ixtlan/gettext/models.rb', line 37

def self.update_all(keys)
  ids = keys.collect do |k|
    k.save
    k.id
  end
  all(:id.not => ids).destroy!
end

Instance Method Details

#set_timestamps_on_saveObject

do not record timestamps since they are set from outside



55
56
# File 'lib/ixtlan/gettext/models.rb', line 55

def set_timestamps_on_save
end