README.markdown in parsi-localize-0.2.1 vs README.markdown in parsi-localize-0.3

- old
+ new

@@ -1,60 +1,47 @@ ParsiLocalize ============= -Change I18n localize to use parsi digits and jalaly dates in farsi (فارسی) locale. -This gem contains two sections +Enhance I18n localize to use Parsi digits and Jalaly dates in Farsi (فارسی) locale. -ParsiDigits ------------ -Simply change digits in a string/integer/float to unicode parsi digits: +For changing digits in string/integer/float with Unicode Parsi ones, we use +[`parsi-digits`](https://github.com/hzamani/parsi-digits): - require 'parsi_digits' - ‪"15,000 تومان".with_parsi_digits - => ‫"۱۵,۰۰۰ تومان" - 123.25.with_parsi_digits - => "۱۲۳/۲۵" + require 'parsi-localize' + I18n.l ‪‪"15,000 تومان" + => ‫‫"۱۵,۰۰۰ تومان" -It also dose the reverse action: +Another useful feature of `parsi-digits` is that you can parse strings with Unicode +digits to numerics: - "۱۲۳۴۵".with_western_digits - => "12345" - -And it undersanad parsi digits (which is useful especially for input forms): - "۱۲۳۴۵".to_i => 12345 "۱۹/۸".to_f => 19.8 -ParsiLocalize -------------- -Change behaivor of I18n#localize so that it localize digits and dates in 'farsi' locale. +To have a real localization of dates in I18n#localize, we uses [`parsi-date`](https://github.com/hzamani/parsi-date) to convert dates to Jalali. - require 'parsi_localize' - 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, wich you can set in your locale file. +As you know, date and time formats can be sored in the locale file. For example with fa: time: formats: default: "%y/%m/%d %H:%M:%S" - short: "%d %b، %H:%M" - long: "%A، %e %b %Y، ساعت %H:%M:%S (%Z)" + short: "%d %B، %H:%M" + long: "%A، %e %B %Y، ساعت %H:%M:%S" date: formats: default: "%y/%m/%d" - short: "%d %b" - long: "%A، %e %b %Y" - -in your locale file you will get: + short: "%d %B" + long: "%A، %e %B %Y" +in your locale file, you will get: + date = Date.today I18n.l date => ‫"۹۰/۱۱/۱۶" I18n.l date, format: :short => ‫"۱۶ بهمن" @@ -65,10 +52,10 @@ I18n.l time => "۹۰/۱۱/۱۶ ۱۵:۴۳:۳۰" I18n.l time, format: :short => ‫"۱۶ بهمن، ۱۵:۴۳" I18n.l time, format: :long - => ‫"یک‌شنبه، ۱۶ بهمن ۱۳۹۰، ساعت ۱۵:۴۳:۳۰ (IRST)" + => ‫"یک‌شنبه، ۱۶ بهمن ۱۳۹۰، ساعت ۱۵:۴۳:۳۰" -For more info on dateformating see 'jalalidate' docs +For more info on date formating see `parsi-date` and Ruby's built-in `date` docs. Copyright (c) 2012 Hassan Zamani, released under the MIT license.