    # File lib/active_support/vendor/i18n-0.1.3/lib/i18n/backend/simple.rb, line 48
          def localize(locale, object, format = :default)
            raise ArgumentError, "Object must be a Date, DateTime or Time object. #{object.inspect} given." unless object.respond_to?(:strftime)

            type = object.respond_to?(:sec) ? 'time' : 'date'
            # TODO only translate these if format is a String?
            formats = translate(locale, "#{type}.formats""#{type}.formats")
            format = formats[format.to_sym] if formats && formats[format.to_sym]
            # TODO raise exception unless format found?
            format = format.to_s.dup

            # TODO only translate these if the format string is actually present
            # TODO check which format strings are present, then bulk translate then, then replace them
            format.gsub!(/%a/, translate(locale, "date.abbr_day_names""date.abbr_day_names")[object.wday])
            format.gsub!(/%A/, translate(locale, "date.day_names""date.day_names")[object.wday])
            format.gsub!(/%b/, translate(locale, "date.abbr_month_names""date.abbr_month_names")[object.mon])
            format.gsub!(/%B/, translate(locale, "date.month_names""date.month_names")[object.mon])
            format.gsub!(/%p/, translate(locale, "time.#{object.hour < 12 ? :am : :pm}""time.#{object.hour < 12 ? :am : :pm}")) if object.respond_to? :hour
            object.strftime(format)
          end