Sha256: afdd077d374ecc71fcd72049f6b86e904bdf6e27f9159901681833ac2b170be4

Contents?: true

Size: 797 Bytes

Versions: 4

Compression:

Stored size: 797 Bytes

Contents

require_relative "pseudolocalization/version"
require_relative "pseudolocalization/pseudolocalizer"

module Pseudolocalization
  module I18n
    class Backend
      attr_reader :original_backend

      def initialize(original_backend)
        @original_backend = original_backend
      end

      def method_missing(name, *args, &block)
        if respond_to_missing?(name)
          original_backend.public_send(name, *args, &block)
        else
          super
        end
      end

      def respond_to_missing?(name, include_private = false)
        original_backend.respond_to?(name) || super
      end

      def translate(locale, key, options)
        ::Pseudolocalization::I18n::Pseudolocalizer.pseudolocalize(original_backend.translate(locale, key, options))
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
pseudolocalization-0.8.4 lib/pseudolocalization.rb
pseudolocalization-0.8.3 lib/pseudolocalization.rb
pseudolocalization-0.8.2 lib/pseudolocalization.rb
pseudolocalization-0.8.1 lib/pseudolocalization.rb