Sha256: 3c99b2f903af0f91144c3c15ad3987279879eb30768e0064ea7a7dbb7aa653ce

Contents?: true

Size: 582 Bytes

Versions: 7

Compression:

Stored size: 582 Bytes

Contents

require 'fast_gettext/translation_repository/base'

module FastGettext
  module TranslationRepository
    # This should be used in a TranslationRepository::Chain, so tat untranslated keys can be found
    # Responsibility:
    #  - log every translation call
    class Logger < Base
      attr_accessor :callback

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

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

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

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
grosser-fast_gettext-0.4.0 lib/fast_gettext/translation_repository/logger.rb
grosser-fast_gettext-0.4.2 lib/fast_gettext/translation_repository/logger.rb
grosser-fast_gettext-0.4.3 lib/fast_gettext/translation_repository/logger.rb
grosser-fast_gettext-0.4.4 lib/fast_gettext/translation_repository/logger.rb
grosser-fast_gettext-0.4.5 lib/fast_gettext/translation_repository/logger.rb
grosser-fast_gettext-0.4.7 lib/fast_gettext/translation_repository/logger.rb
grosser-fast_gettext-0.4.8 lib/fast_gettext/translation_repository/logger.rb