Class: FastGettext::TranslationRepository::Ixtlan
- Inherits:
-
Object
- Object
- FastGettext::TranslationRepository::Ixtlan
- 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
- #[](key) ⇒ Object
- #available_locales ⇒ Object
-
#initialize(name, options = {}) ⇒ Ixtlan
constructor
A new instance of Ixtlan.
- #plural(*args) ⇒ Object
- #pluralisation_rule ⇒ Object
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, ={} ) @name = name end |
Class Method Details
.seperator ⇒ Object
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_locales ⇒ Object
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_rule ⇒ Object
39 40 41 |
# File 'lib/fast_gettext/translation_repository/ixtlan.rb', line 39 def pluralisation_rule nil end |