README.markdown in parsi-localize-0.1.1 vs README.markdown in parsi-localize-0.1.2
- old
+ new
@@ -6,35 +6,58 @@
ParsiDigits
-----------
Simply change digits in a string/integer/float to unicode parsi digits.
-(In all the example below we have right to left issues to present output!)
-
Example:
require 'parsi_digits'
- "15,000 تومان".with_parsi_digits => "۱۵,۰۰۰ تومان"
+ "15,000 تومان".with_parsi_digits => "۱۵,۰۰۰ تومان"
123.25.with_parsi_digits => "۱۲۳/۲۵"
ParsiLocalize
-------------
Change behaivor of I18n#localize so that it localize digits and dates in 'farsi' locale.
require 'parsi_localize'
- I18n.l "15,000 تومان" => "۱۵,۰۰۰ تومان"
- I18n.l Time.now, fromat: "%y/%m/%d %H:%M:%S" => "۹۰/۱۰/۱۳ ۰۵:۴۳:۳۲"
+ I18n.l "15,000 تومان"
+ => "۱۵,۰۰۰ تومان"
+ I18n.l Time.now, fromat: "%y/%m/%d %H:%M:%S"
+ => "۹۰/۱۰/۱۳ ۰۵:۴۳:۳۲"
-If you don't set date format, it uses the default locale format (time.formats.default) wich you can set in your locale file. For more info on dateformating see 'jalalidate' docs
+If you don't set date format, it uses the default locale format, wich you can set in your locale file.
For example with
fa:
time:
formats:
- default: "%d %b %y"
+ default: "%y/%m/%d %H:%M:%S"
+ short: "%d %b، %H:%M"
+ long: "%A، %e %b %Y، ساعت %H:%M:%S (%Z)"
+ date:
+ formats:
+ default: "%y/%m/%d"
+ short: "%d %b"
+ long: "%A، %e %b %Y"
in your locale file you will get:
- I18n.l Time.now => "۱۳ دی ۹۰"
+ date = Date.today
+ I18n.l date
+ => "۹۰/۱۱/۱۶"
+ I18n.l date, format: :short
+ => "۱۶ بهمن"
+ I18n.l date, format: :long
+ => "یکشنبه، ۱۶ بهمن ۱۳۹۰"
+
+ time = Time.now
+ I18n.l time
+ => "۹۰/۱۱/۱۶ ۱۵:۴۳:۳۰"
+ I18n.l time, format: :short
+ => "۱۶ بهمن، ۱۵:۴۳"
+ I18n.l time, format: :long
+ => "یکشنبه، ۱۶ بهمن ۱۳۹۰، ساعت ۱۵:۴۳:۳۰ (IRST)"
+
+For more info on dateformating see 'jalalidate' docs
Copyright (c) 2012 Hassan Zamani, released under the MIT license.