Class: AwesomeTranslations::Handlers::RailsHandler

Inherits:
BaseHandler
  • Object
show all
Defined in:
lib/awesome_translations/handlers/rails_handler.rb

Instance Method Summary collapse

Methods inherited from BaseHandler

#add_translations_for_hash, #enabled?, #translations_for_hash_recursive

Instance Method Details

#groupsObject



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/awesome_translations/handlers/rails_handler.rb', line 2

def groups
  ArrayEnumerator.new do |yielder|
    groups = ["date_time", "errors", "helpers", "numbers", "support"]

    groups.each do |group|
      yielder << AwesomeTranslations::Group.new(
        id: group,
        handler: self,
        data: {
          name: group.humanize
        }
      )
    end
  end
end

#translations_for_group(group) ⇒ Object



18
19
20
21
22
23
# File 'lib/awesome_translations/handlers/rails_handler.rb', line 18

def translations_for_group(group)
  ArrayEnumerator.new do |yielder|
    dir = Rails.root.join("config", "locales", "awesome_translations", group.id).to_s
    __send__(:"translations_for_#{group.id}", dir, group, yielder)
  end
end