Sha256: 93e6ecfa7cf946b65cde3a1bc50bad7dc41b9630987cb1912586a0d4eb3f82de
Contents?: true
Size: 944 Bytes
Versions: 1
Compression:
Stored size: 944 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 [:default, :short, :long].include? format 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?(:with_parsi_digits) object.with_parsi_digits elsif [Date, DateTime, Time, Parsi::Date, Parsi::DateTime].include? object.class object.to_jalali.strftime(format).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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
parsi-localize-0.3 | lib/parsi-localize.rb |