parsi-localize 0.3 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +3 -2
- data/lib/parsi-localize.rb +3 -3
- data/lib/version.rb +1 -1
- metadata +2 -2
data/README.markdown
CHANGED
@@ -18,12 +18,13 @@ digits to numerics:
|
|
18
18
|
"۱۹/۸".to_f
|
19
19
|
=> 19.8
|
20
20
|
|
21
|
-
To have a real localization of dates in I18n#localize
|
21
|
+
To have a real localization of dates in I18n#localize (converting them to Jalali date),
|
22
|
+
we uses [`parsi-date`](https://github.com/hzamani/parsi-date):
|
22
23
|
|
23
24
|
I18n.l Time.now, fromat: "%y/%m/%d %H:%M:%S"
|
24
25
|
=> "۹۰/۱۰/۱۳ ۰۵:۴۳:۳۲"
|
25
26
|
|
26
|
-
As you know, date and time formats can be
|
27
|
+
As you know, date and time formats can be stored in the locale file.
|
27
28
|
For example with
|
28
29
|
|
29
30
|
fa:
|
data/lib/parsi-localize.rb
CHANGED
@@ -16,10 +16,10 @@ module I18n
|
|
16
16
|
end
|
17
17
|
|
18
18
|
if locale == :fa
|
19
|
-
if object.respond_to?(:
|
20
|
-
object.with_parsi_digits
|
21
|
-
elsif [Date, DateTime, Time, Parsi::Date, Parsi::DateTime].include? object.class
|
19
|
+
if object.respond_to?(:to_jalali)
|
22
20
|
object.to_jalali.strftime(format).with_parsi_digits
|
21
|
+
elsif object.respond_to?(:with_parsi_digits)
|
22
|
+
object.with_parsi_digits
|
23
23
|
else
|
24
24
|
config.backend.localize locale, object, format, options
|
25
25
|
end
|
data/lib/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: parsi-localize
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 0.3.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-10-
|
12
|
+
date: 2012-10-31 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|