Methods
- D
- F
- L
- R
Included Modules
- ::Cldr::Format
Instance Public methods
format_currency(locale, object, format = :default, options = {})
Link
# File activesupport/lib/active_support/vendor/i18n-0.4.1/i18n/backend/cldr.rb, line 21 def format_currency(locale, object, format = :default, options = {}) options.merge!(:currency => lookup_currency(locale, options[:currency], object)) if options[:currency].is_a?(Symbol) formatter(locale, :currency, format).apply(object, options) end
format_date(locale, object, format = :default, options = {})
Link
format_datetime(locale, object, format = :default, options = {})
Link
# File activesupport/lib/active_support/vendor/i18n-0.4.1/i18n/backend/cldr.rb, line 38 def format_datetime(locale, object, format = :default, options = {}) key = :"calendars.gregorian.formats.datetime.#{format}.pattern" date = I18n.l(object, :format => options[:date_format] || format, :locale => locale, :as => :date) time = I18n.l(object, :format => options[:time_format] || format, :locale => locale, :as => :time) I18n.t(key, :date => date, :time => time, :locale => locale, :raise => true) end
format_decimal(locale, object, format = :default, options = {})
Link
format_integer(locale, object, format = :default, options = {})
Link
format_percent(locale, object, format = :default, options = {})
Link
format_time(locale, object, format = :default, options = {})
Link
localize(locale, object, format = :default, options = {})
Link
Instance Protected methods
detect_type(object, options)
Link
# File activesupport/lib/active_support/vendor/i18n-0.4.1/i18n/backend/cldr.rb, line 47 def detect_type(object, options) options.has_key?(:currency) ? :currency : case object when ::Numeric :decimal when ::Date, ::DateTime, ::Time object.class.name.downcase.to_sym else raise_unspecified_format_type! end end
formatter(locale, type, format)
Link
# File activesupport/lib/active_support/vendor/i18n-0.4.1/i18n/backend/cldr.rb, line 58 def formatter(locale, type, format) (@formatters ||= {})[:"#{locale}.#{type}.#{format}"] ||= begin format = lookup_format(locale, type, format) data = lookup_format_data(locale, type) ::Cldr::Format.const_get(type.to_s.camelize).new(format, data) end end
lookup_currency(locale, currency, count)
Link
lookup_format(locale, type, format)
Link
# File activesupport/lib/active_support/vendor/i18n-0.4.1/i18n/backend/cldr.rb, line 66 def lookup_format(locale, type, format) key = case type when :date, :time, :datetime :"calendars.gregorian.formats.#{type}.#{format}.pattern" else :"numbers.formats.#{type}.patterns.#{format || :default}" end I18n.t(key, :locale => locale, :raise => true) end
lookup_format_data(locale, type)
Link
raise_unspecified_currency!()
Link