Class: FastGettext::TranslationRepository::Logger

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

Overview

This should be used in a TranslationRepository::Chain, so tat untranslated keys can be found Responsibility:

- log every translation call

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#available_locales, #pluralisation_rule

Constructor Details

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

Returns a new instance of Logger.



11
12
13
14
# File 'lib/fast_gettext/translation_repository/logger.rb', line 11

def initialize(name,options={})
  super
  self.callback = options[:callback]
end

Instance Attribute Details

#callbackObject

Returns the value of attribute callback.



9
10
11
# File 'lib/fast_gettext/translation_repository/logger.rb', line 9

def callback
  @callback
end

Instance Method Details

#[](key) ⇒ Object



16
17
18
19
# File 'lib/fast_gettext/translation_repository/logger.rb', line 16

def [](key)
  callback.call(key)
  nil
end

#plural(*keys) ⇒ Object



21
22
23
24
# File 'lib/fast_gettext/translation_repository/logger.rb', line 21

def plural(*keys)
  callback.call(keys)
  []
end