Class: FastGettext::TranslationRepository::Yaml
- Defined in:
- lib/fast_gettext/translation_repository/yaml.rb
Overview
Responsibility:
- find and store yaml files
- provide access to translations in yaml files
Instance Method Summary collapse
- #available_locales ⇒ Object
-
#initialize(name, options = {}) ⇒ Yaml
constructor
A new instance of Yaml.
- #plural(*keys) ⇒ Object
- #pluralisation_rule ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(name, options = {}) ⇒ Yaml
Returns a new instance of Yaml.
10 11 12 13 |
# File 'lib/fast_gettext/translation_repository/yaml.rb', line 10 def initialize(name,={}) find_and_store_files() super end |
Instance Method Details
#available_locales ⇒ Object
15 16 17 |
# File 'lib/fast_gettext/translation_repository/yaml.rb', line 15 def available_locales @files.keys end |
#plural(*keys) ⇒ Object
19 20 21 22 23 |
# File 'lib/fast_gettext/translation_repository/yaml.rb', line 19 def plural(*keys) ['one', 'other', 'plural2', 'plural3'].map do |name| self[yaml_dot_notation(keys.first, name)] end end |
#pluralisation_rule ⇒ Object
25 26 27 |
# File 'lib/fast_gettext/translation_repository/yaml.rb', line 25 def pluralisation_rule self['pluralisation_rule'] ? lambda{|n| eval(self['pluralisation_rule']) } : nil end |