l10n 1.2.1 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 4131f6df7e1ff12bbbd5d86e4584b9cc0fec5d8c
4
- data.tar.gz: 2e7def258acc2add39251868ba45c002976d17f2
2
+ SHA256:
3
+ metadata.gz: 6644cfaf6aea0f30feeec78e291d9f5e8aa14533e768e0dfceb79848ffe596a8
4
+ data.tar.gz: 515e0717bcd5fd57b9f564551f0f0a6e275d017713023385a7c36459ac87b95f
5
5
  SHA512:
6
- metadata.gz: 8b9252c4e0a79bca6147c27f89bd2a3516dc9b14a6922ee803a8a7ac10af420991f6f70773fb87494ec7c81906ffe6d6f511a804dc957c3ff5360a1e9ffd7ced
7
- data.tar.gz: 99dd2ab347d0f1faac4fafb68e9797f9aa5356fc6a175f1679e146cc117fbda919a41859c2e77b297326dad2380cdd4df555b70b11b5a449ff2706a39a2d4b35
6
+ metadata.gz: f1466c4890beff653f8614b0621095ce763c3512094086a61a1f38eb110e88d15661b3c4cc0c30b09db351b00d7a7f1824ef304c2f423af249425c87a542c82a
7
+ data.tar.gz: 97b95622153d130ecf0a36a2e7e7149ec31d45df3eb129170d037e9b612694c7c24400a267b9634614002a9da6350ed486ceb279ebbbb80d1a1a2eb7aa9a8aab
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ * 1.4.0 - 2018-06-21
2
+
3
+ - Removing jQuery dependency from i18n javascript
4
+
1
5
  * 1.1.0 - 2014-12-09
2
6
 
3
7
  - Adding Time#l
data/README.md CHANGED
@@ -1,3 +1,4 @@
1
+ [![Gem Version](https://badge.fury.io/rb/l10n.png)](http://badge.fury.io/rb/l10n) [![Build Status](https://travis-ci.org/mtgrosser/l10n.svg)](https://travis-ci.org/mtgrosser/l10n)
1
2
  # L10n - I18n that roarrrs
2
3
 
3
4
  L10n provides some useful extensions for Rails I18n, including column translations, localization of numeric form fields and JavaScript translation support.
@@ -7,14 +7,23 @@ I18n.translate = function(str, options) {
7
7
  var count = options['count'];
8
8
  var keys = str.split('.');
9
9
  var obj = this.translations;
10
+
11
+ var isString = function(value) {
12
+ return typeof value === 'string' || value instanceof String;
13
+ };
14
+
15
+ var isObject = function(value) {
16
+ return value && typeof value === 'object' && value.constructor === Object;
17
+ };
18
+
10
19
  while(obj && keys.length) obj = obj[keys.shift()];
11
20
  if (obj) {
12
- if ($.type(obj) == 'object' && count !== undefined) {
21
+ if (isObject(obj) && count !== undefined) {
13
22
  translation = obj[1 == count ? 'one' : 'other'];
14
23
  } else {
15
24
  translation = obj;
16
25
  }
17
- if ($.type(translation) == 'string' && (matches = translation.match(/{\w+?}/g))) {
26
+ if (isString(translation) && (matches = translation.match(/{\w+?}/g))) {
18
27
  while(match = matches.shift()) {
19
28
  method = match.substr(1, match.length - 2);
20
29
  interpolation_value = options[method];
@@ -3,9 +3,7 @@ require 'active_record'
3
3
  module L10n
4
4
  module NumericColumnConversions
5
5
 
6
- private
7
-
8
- def write_attribute(attr_name, value)
6
+ def _write_attribute(attr_name, value)
9
7
  column = column_for_attribute(attr_name.to_s)
10
8
  if column && [:integer, :float, :decimal].include?(column.type) && value.is_a?(String)
11
9
  value = Numeric.delocalize(value)
@@ -1,20 +1,16 @@
1
1
  module L10n
2
2
  module NumericalityValidatorExt
3
3
 
4
- protected
4
+ private
5
5
 
6
- def parse_raw_value_as_a_number(raw_value)
7
- return if raw_value =~ /\A0[xX]/
8
- if raw_value.is_a?(String)
9
- return unless raw_value =~ numeric_exp_for_current_locale
10
- raw_value = Numeric.delocalize(raw_value)
11
- end
12
- Kernel.Float(raw_value)
13
- rescue ArgumentError, TypeError
14
- nil
6
+ def parse_as_number(raw_value)
7
+ raw_value = Numeric.delocalize(raw_value) if is_localized_number?(raw_value)
8
+ super(raw_value)
9
+ end
10
+
11
+ def is_localized_number?(value)
12
+ numeric_exp_for_current_locale === value
15
13
  end
16
-
17
- private
18
14
 
19
15
  def numeric_exp_for_current_locale
20
16
  separator = I18n.t(:'number.format.separator')
@@ -24,4 +24,4 @@ module L10n
24
24
  end
25
25
  end
26
26
 
27
- ActionDispatch::Request.class_eval { include L10n::Request }
27
+ ActionDispatch::Request.class_eval { include L10n::Request }
@@ -1,3 +1,3 @@
1
1
  module L10n
2
- VERSION = '1.2.1'
2
+ VERSION = '1.6.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: l10n
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthias Grosser
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-29 00:00:00.000000000 Z
11
+ date: 2020-12-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: i18n
@@ -28,72 +28,96 @@ dependencies:
28
28
  name: activerecord
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 6.0.0
34
+ - - "<"
32
35
  - !ruby/object:Gem::Version
33
- version: 5.1.1
36
+ version: '6.2'
34
37
  type: :runtime
35
38
  prerelease: false
36
39
  version_requirements: !ruby/object:Gem::Requirement
37
40
  requirements:
38
- - - "~>"
41
+ - - ">="
39
42
  - !ruby/object:Gem::Version
40
- version: 5.1.1
43
+ version: 6.0.0
44
+ - - "<"
45
+ - !ruby/object:Gem::Version
46
+ version: '6.2'
41
47
  - !ruby/object:Gem::Dependency
42
48
  name: activesupport
43
49
  requirement: !ruby/object:Gem::Requirement
44
50
  requirements:
45
- - - "~>"
51
+ - - ">="
46
52
  - !ruby/object:Gem::Version
47
- version: 5.1.1
53
+ version: 6.0.0
54
+ - - "<"
55
+ - !ruby/object:Gem::Version
56
+ version: '6.2'
48
57
  type: :runtime
49
58
  prerelease: false
50
59
  version_requirements: !ruby/object:Gem::Requirement
51
60
  requirements:
52
- - - "~>"
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: 6.0.0
64
+ - - "<"
53
65
  - !ruby/object:Gem::Version
54
- version: 5.1.1
66
+ version: '6.2'
55
67
  - !ruby/object:Gem::Dependency
56
68
  name: actionpack
57
69
  requirement: !ruby/object:Gem::Requirement
58
70
  requirements:
59
- - - "~>"
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ version: 6.0.0
74
+ - - "<"
60
75
  - !ruby/object:Gem::Version
61
- version: 5.1.1
76
+ version: '6.2'
62
77
  type: :runtime
63
78
  prerelease: false
64
79
  version_requirements: !ruby/object:Gem::Requirement
65
80
  requirements:
66
- - - "~>"
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ version: 6.0.0
84
+ - - "<"
67
85
  - !ruby/object:Gem::Version
68
- version: 5.1.1
86
+ version: '6.2'
69
87
  - !ruby/object:Gem::Dependency
70
88
  name: railties
71
89
  requirement: !ruby/object:Gem::Requirement
72
90
  requirements:
73
- - - "~>"
91
+ - - ">="
74
92
  - !ruby/object:Gem::Version
75
- version: 5.1.1
93
+ version: 6.0.0
94
+ - - "<"
95
+ - !ruby/object:Gem::Version
96
+ version: '6.2'
76
97
  type: :runtime
77
98
  prerelease: false
78
99
  version_requirements: !ruby/object:Gem::Requirement
79
100
  requirements:
80
- - - "~>"
101
+ - - ">="
81
102
  - !ruby/object:Gem::Version
82
- version: 5.1.1
103
+ version: 6.0.0
104
+ - - "<"
105
+ - !ruby/object:Gem::Version
106
+ version: '6.2'
83
107
  - !ruby/object:Gem::Dependency
84
108
  name: sqlite3
85
109
  requirement: !ruby/object:Gem::Requirement
86
110
  requirements:
87
- - - "~>"
111
+ - - ">="
88
112
  - !ruby/object:Gem::Version
89
- version: 1.3.10
113
+ version: '0'
90
114
  type: :development
91
115
  prerelease: false
92
116
  version_requirements: !ruby/object:Gem::Requirement
93
117
  requirements:
94
- - - "~>"
118
+ - - ">="
95
119
  - !ruby/object:Gem::Version
96
- version: 1.3.10
120
+ version: '0'
97
121
  - !ruby/object:Gem::Dependency
98
122
  name: byebug
99
123
  requirement: !ruby/object:Gem::Requirement
@@ -186,8 +210,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
186
210
  - !ruby/object:Gem::Version
187
211
  version: '0'
188
212
  requirements: []
189
- rubyforge_project:
190
- rubygems_version: 2.4.5
213
+ rubygems_version: 3.0.3
191
214
  signing_key:
192
215
  specification_version: 4
193
216
  summary: Make I18n roar again