Class: FastGettext::TranslationRepository::Ixtlan

Inherits:
Object
  • Object
show all
Defined in:
lib/fast_gettext/translation_repository/ixtlan.rb

Constant Summary collapse

@@seperator =

string that seperates multiple plurals

'||||'

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, options = {}) ⇒ Ixtlan

Returns a new instance of Ixtlan.



27
28
29
# File 'lib/fast_gettext/translation_repository/ixtlan.rb', line 27

def initialize( name, options={} )
  @name = name
end

Class Method Details

.seperatorObject



33
# File 'lib/fast_gettext/translation_repository/ixtlan.rb', line 33

def self.seperator;@@seperator;end

.seperator=(sep) ⇒ Object



32
# File 'lib/fast_gettext/translation_repository/ixtlan.rb', line 32

def self.seperator=(sep);@@seperator = sep;end

Instance Method Details

#[](key) ⇒ Object



43
44
45
46
47
48
# File 'lib/fast_gettext/translation_repository/ixtlan.rb', line 43

def [](key)
  r = ::Ixtlan::Gettext::Translation.first( ::Ixtlan::Gettext::Translation.translation_key.name => key, 
                                            ::Ixtlan::Gettext::Translation.locale.code => FastGettext.locale, 
                                            :domain => domain )
  r.text.to_s if r
end

#available_localesObject



35
36
37
# File 'lib/fast_gettext/translation_repository/ixtlan.rb', line 35

def available_locales
  []
end

#plural(*args) ⇒ Object



50
51
52
53
54
55
56
# File 'lib/fast_gettext/translation_repository/ixtlan.rb', line 50

def plural(*args)
  if translation = self[ args*self.class.seperator ]
    translation.to_s.split(self.class.seperator)
  else
    []
  end
end

#pluralisation_ruleObject



39
40
41
# File 'lib/fast_gettext/translation_repository/ixtlan.rb', line 39

def pluralisation_rule
  nil
end