Sha256: d5639953f0ef1a1b38883e1814ec5c1bb6666d6b61df91fb433caa3c88fbc0cf

Contents?: true

Size: 918 Bytes

Versions: 20

Compression:

Stored size: 918 Bytes

Contents

# encoding: UTF-8

# Copyright 2012 Twitter, Inc
# http://www.apache.org/licenses/LICENSE-2.0

module TwitterCldr
  module Localized

    class LocalizedObject

      attr_reader :locale, :base_obj, :formatter

      def initialize(obj, locale, options = {})
        @base_obj = obj
        @locale = TwitterCldr.convert_locale(locale)
        @locale = TwitterCldr::DEFAULT_LOCALE unless TwitterCldr.supported_locale?(@locale)

        options = options.dup
        options[:locale] = @locale

        # @formatter = formatter_const.new(options) if formatter_const
      end

      # def formatter_const
      #   raise NotImplementedError
      # end

      def self.localize(klass)
        klass.class_eval <<-LOCALIZE, __FILE__, __LINE__ + 1
          def localize(locale = TwitterCldr.locale, options = {})
            #{self}.new(self, locale, options)
          end
        LOCALIZE
      end
    end

  end
end

Version data entries

20 entries across 20 versions & 2 rubygems

Version Path
twitter_cldr-3.3.0 lib/twitter_cldr/localized/localized_object.rb
solidus_backend-1.0.0.pre3 vendor/bundle/gems/twitter_cldr-3.2.1/lib/twitter_cldr/localized/localized_object.rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/twitter_cldr-3.2.1/lib/twitter_cldr/localized/localized_object.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/twitter_cldr-3.1.2/lib/twitter_cldr/localized/localized_object.rb
twitter_cldr-3.2.1 lib/twitter_cldr/localized/localized_object.rb
twitter_cldr-3.2.0 lib/twitter_cldr/localized/localized_object.rb
twitter_cldr-3.1.2 lib/twitter_cldr/localized/localized_object.rb
twitter_cldr-3.1.1 lib/twitter_cldr/localized/localized_object.rb
twitter_cldr-3.1.0 lib/twitter_cldr/localized/localized_object.rb
twitter_cldr-3.0.10 lib/twitter_cldr/localized/localized_object.rb
twitter_cldr-3.0.9 lib/twitter_cldr/localized/localized_object.rb
twitter_cldr-3.0.8 lib/twitter_cldr/localized/localized_object.rb
twitter_cldr-3.0.7 lib/twitter_cldr/localized/localized_object.rb
twitter_cldr-3.0.6 lib/twitter_cldr/localized/localized_object.rb
twitter_cldr-3.0.5 lib/twitter_cldr/localized/localized_object.rb
twitter_cldr-3.0.4 lib/twitter_cldr/localized/localized_object.rb
twitter_cldr-3.0.3 lib/twitter_cldr/localized/localized_object.rb
twitter_cldr-3.0.2 lib/twitter_cldr/localized/localized_object.rb
twitter_cldr-3.0.1 lib/twitter_cldr/localized/localized_object.rb
twitter_cldr-3.0.0 lib/twitter_cldr/localized/localized_object.rb