Sha256: e28600aa73f83577bac31bd22c8e239986cbde2e215c27d31a9d612432d3121c
Contents?: true
Size: 878 Bytes
Versions: 2
Compression:
Stored size: 878 Bytes
Contents
require 'parsi-digits' require 'parsi-date' require 'i18n' module I18n class << self def localize object, options={} return '' if object.nil? locale = options.delete(:locale) || config.locale format = options.delete(:format) || :default if format.is_a? Symbol format = I18n.t("date.formats.#{format}") if object.is_a? Date format = I18n.t("time.formats.#{format}") if object.is_a? Time end if locale == :fa if object.respond_to?(:to_jalali) object.to_jalali.strftime(format).with_parsi_digits elsif object.respond_to?(:with_parsi_digits) object.with_parsi_digits else config.backend.localize locale, object, format, options end else config.backend.localize locale, object, format, options end end alias :l :localize end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
parsi-localize-0.3.3 | lib/parsi-localize.rb |
parsi-localize-0.3.2 | lib/parsi-localize.rb |