Class: Ixtlan::Gettext::TranslationKey
- Inherits:
-
Object
- Object
- Ixtlan::Gettext::TranslationKey
- Includes:
- DataMapper::Resource
- Defined in:
- lib/ixtlan/gettext/models.rb
Class Method Summary collapse
- .available_locales ⇒ Object
- .storage_name(arg) ⇒ Object
- .translation(key, locale) ⇒ Object
- .update_all(keys) ⇒ Object
Instance Method Summary collapse
-
#set_timestamps_on_save ⇒ Object
do not record timestamps since they are set from outside.
Class Method Details
.available_locales ⇒ Object
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_save ⇒ Object
do not record timestamps since they are set from outside
55 56 |
# File 'lib/ixtlan/gettext/models.rb', line 55 def end |