Module: I18n::Transformers

Included in:
I18n
Defined in:
lib/i18n/transformers.rb,
lib/i18n/transformers/version.rb,
lib/i18n/transformers/collection.rb,
lib/i18n/transformers/collection/base.rb,
lib/i18n/transformers/collection/generic.rb,
lib/i18n/transformers/collection/markdown.rb

Defined Under Namespace

Classes: Collection

Constant Summary collapse

VERSION =
'0.1.0'

Instance Method Summary collapse

Instance Method Details

#transformersObject



13
14
15
# File 'lib/i18n/transformers.rb', line 13

def transformers
  @transformers ||= Collection.new
end

#translate(*args) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/i18n/transformers.rb', line 17

def translate(*args)
  result = super

  # TODO: Handle missing translations.
  # In theory we don't need to pass them to transformers, but there is no nice way to do that,
  # only with force raising and handling it again

  key = args.first
  transformers.all.inject(result) do |transformed, transformer|
    transformer.transform(key, transformed)
  end
end