rs_russian 0.10.1 → 0.10.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +3 -3
- data/lib/russian/rails_admin_datetime.rb +27 -19
- data/lib/russian/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d184d92dddb682ea8e49f43dbd53b8f31503d729
|
4
|
+
data.tar.gz: f0892bd4c0036321ae28f05f663488522c09ef55
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0df67e13d73a8bb5ee79b5e7709f0a9b063e0652c06d857f0deb05c3569f721afea6609134c4408ccc82a9562064b05b094114a69061bde93278cc7800af517b
|
7
|
+
data.tar.gz: bab88d5b77dfac18168d411a98b707edc2c9f21462458e0f2587bb21139ef3d7add0c354f9a6937b15032fbdb81d33f5d5d7997ce13a0d8c55277c7392411929
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rs_russian (0.10.
|
4
|
+
rs_russian (0.10.2)
|
5
5
|
activesupport (>= 3.0.0, < 6.0.0)
|
6
6
|
i18n (~> 0.8.0)
|
7
7
|
unicode (~> 0.4.4)
|
@@ -28,7 +28,7 @@ GEM
|
|
28
28
|
diff-lcs (>= 1.1.3, < 2.0)
|
29
29
|
rspec-mocks (2.99.4)
|
30
30
|
thread_safe (0.3.6)
|
31
|
-
tzinfo (1.2.
|
31
|
+
tzinfo (1.2.4)
|
32
32
|
thread_safe (~> 0.1)
|
33
33
|
unicode (0.4.4.4)
|
34
34
|
|
@@ -42,4 +42,4 @@ DEPENDENCIES
|
|
42
42
|
rspec (~> 2.14)
|
43
43
|
|
44
44
|
BUNDLED WITH
|
45
|
-
1.16.0
|
45
|
+
1.16.0
|
@@ -1,3 +1,30 @@
|
|
1
|
+
require 'rails_admin/support/datetime'
|
2
|
+
|
3
|
+
class RailsAdmin::Support::Datetime
|
4
|
+
class << self
|
5
|
+
alias_method :delocalize_without_russian, :delocalize
|
6
|
+
def delocalize(date_string, format)
|
7
|
+
ret = date_string
|
8
|
+
if I18n.locale == :ru
|
9
|
+
format.to_s.scan(/%[AaBbp]/) do |match|
|
10
|
+
case match
|
11
|
+
when '%B'
|
12
|
+
english = I18n.t('date.month_names', :locale => :en)[1..-1]
|
13
|
+
common_month_names = I18n.t('date.common_month_names')[1..-1]
|
14
|
+
common_month_names.each_with_index {|m, i| ret = ret.gsub(/#{m}/i, english[i]) } unless ret.blank?
|
15
|
+
when '%b'
|
16
|
+
english = I18n.t('date.abbr_month_names', :locale => :en)[1..-1]
|
17
|
+
common_abbr_month_names = I18n.t('date.common_abbr_month_names')[1..-1]
|
18
|
+
common_abbr_month_names.each_with_index {|m, i| ret = ret.gsub(/#{m}/i, english[i]) } unless ret.blank?
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
ret = delocalize_without_russian(ret, format)
|
23
|
+
ret
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
1
28
|
require 'rails_admin/config/fields/types/datetime'
|
2
29
|
|
3
30
|
module RailsAdmin
|
@@ -5,25 +32,6 @@ module RailsAdmin
|
|
5
32
|
module Fields
|
6
33
|
module Types
|
7
34
|
class Datetime < RailsAdmin::Config::Fields::Base
|
8
|
-
def parse_input(params)
|
9
|
-
str = params[name]
|
10
|
-
if I18n.locale == :ru
|
11
|
-
strftime_format.to_s.scan(/%[AaBbp]/) do |match|
|
12
|
-
case match
|
13
|
-
when '%B'
|
14
|
-
english = I18n.t('date.month_names', :locale => :en)[1..-1]
|
15
|
-
common_month_names = I18n.t('date.common_month_names')[1..-1]
|
16
|
-
common_month_names.each_with_index {|m, i| str = str.gsub(/#{m}/i, english[i]) } unless str.blank?
|
17
|
-
when '%b'
|
18
|
-
english = I18n.t('date.abbr_month_names', :locale => :en)[1..-1]
|
19
|
-
common_abbr_month_names = I18n.t('date.common_abbr_month_names')[1..-1]
|
20
|
-
common_abbr_month_names.each_with_index {|m, i| str = str.gsub(/#{m}/i, english[i]) } unless str.blank?
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
params[name] = parser.parse_string(str) if params[name]
|
25
|
-
end
|
26
|
-
|
27
35
|
register_instance_option :formatted_value do
|
28
36
|
ret = if time = (value || default_value)
|
29
37
|
opt = {format: strftime_format, standalone: true}
|
data/lib/russian/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rs_russian
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- glebtv
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-
|
12
|
+
date: 2017-12-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: i18n
|