l10n 2.0.1 → 2.2.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
2
  SHA256:
3
- metadata.gz: bd3f8a0bc047817f4a774f48cb0584f7179b7b9e5b9857fbe4b56aa8bd4ca6c2
4
- data.tar.gz: f1bbab93ef1b9553cfd81575d5f06fb51ac6334fb9437c2e2de1c8a43caf626a
3
+ metadata.gz: f7a06cb298ed3fcf7c6382968e1a73dcbc7e3ad34d5f35f365552792fef6a394
4
+ data.tar.gz: 8b1880dda37ecb77c241d7b04c5f5b89e98c6963df59ef9795aae0612e81ba1a
5
5
  SHA512:
6
- metadata.gz: 23839e9b5e634487d88f31831d5c418e5695beaf7885f3f313fafa3d1a7ccd4b666fd2b7baee8530411d0f7114ab99221cd183f33c03e06a6d8a6d17a45bd529
7
- data.tar.gz: fbc6874864dc62627c13d146137342cde276ef76b10bfe25a9549286c609c10c140830ebf971dac1076eb1fea492bdf9eab637a13d382d62254d7d740e078a9d
6
+ metadata.gz: 5e9b9fcab3bd5b84bf75d108cd01771ed3f6d712b9770d24864eaff8e8c8cf8bb7deb9231192a4694e3ac7c65f046beeaee4bbc108d0daa9b8e55b6ed2a36cf6
7
+ data.tar.gz: 76075e8bda8bc614c5d03c18e48524874bdc27614251a62941809375bdd13a58280e023b2310b8b27394ee0543f1c89ff7302209fb3ed0244ee082f3af2e8ffd
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## 2.2.0 - 2023-11-09
2
+
3
+ - Support Rails 7.1
4
+
5
+ ## 2.1.0 - 2023-05-25
6
+
7
+ - ActiveModel attribute delocalization
8
+
1
9
  ## 2.0.1 - 2023-05-09
2
10
 
3
11
  - Fix method delegation
data/README.md CHANGED
@@ -115,7 +115,7 @@ This also works with `BigDecimal`s.
115
115
  #### Localization of decimal separator and delimiter for numbers
116
116
 
117
117
  Localization converts decimal separators and delimiters between locales without
118
- re-formatting strings. `to_localized_s` can be called on any object.
118
+ re-formatting strings. `to_ls` can be called on any object.
119
119
 
120
120
  ```ruby
121
121
  I18n.as('de') { 1234.5.to_localized_s } => "1.234,5"
@@ -22,6 +22,7 @@ module L10n
22
22
  def to_localized_s
23
23
  Numeric.localize(self)
24
24
  end
25
+ alias_method :to_ls, :to_localized_s
25
26
  end
26
27
 
27
28
  module Formatting
@@ -1,18 +1,17 @@
1
- require 'active_record'
1
+ require 'active_model'
2
2
 
3
3
  module L10n
4
4
  module NumericColumnConversions
5
5
 
6
- def _write_attribute(attr_name, value)
7
- column = column_for_attribute(attr_name.to_s)
8
- if column && [:integer, :float, :decimal].include?(column.type) && value.is_a?(String)
6
+ def from_user(name, value, type, original_attribute = nil)
7
+ if [:integer, :float, :decimal].include?(type.try(:type)) && value.is_a?(String)
9
8
  value = Numeric.delocalize(value)
10
9
  end
11
- super(attr_name, value)
10
+ super(name, value, type, original_attribute)
12
11
  end
13
-
12
+
14
13
  end
15
-
14
+
16
15
  end
17
16
 
18
- ActiveRecord::Base.prepend L10n::NumericColumnConversions
17
+ ActiveModel::Attribute.singleton_class.prepend L10n::NumericColumnConversions
data/lib/l10n/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module L10n
2
- VERSION = '2.0.1'
2
+ VERSION = '2.2.0'
3
3
  end
data/lib/l10n.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require 'i18n'
2
2
  require 'date'
3
3
  require 'bigdecimal'
4
+ require 'active_record'
4
5
  require 'action_view'
5
6
  require 'action_dispatch'
6
7
  require 'active_support/all'
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: 2.0.1
4
+ version: 2.2.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: 2022-04-29 00:00:00.000000000 Z
11
+ date: 2023-11-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: i18n
@@ -33,7 +33,7 @@ dependencies:
33
33
  version: 7.0.0
34
34
  - - "<"
35
35
  - !ruby/object:Gem::Version
36
- version: '7.1'
36
+ version: '7.2'
37
37
  type: :runtime
38
38
  prerelease: false
39
39
  version_requirements: !ruby/object:Gem::Requirement
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: 7.0.0
44
44
  - - "<"
45
45
  - !ruby/object:Gem::Version
46
- version: '7.1'
46
+ version: '7.2'
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: activesupport
49
49
  requirement: !ruby/object:Gem::Requirement
@@ -53,7 +53,7 @@ dependencies:
53
53
  version: 7.0.0
54
54
  - - "<"
55
55
  - !ruby/object:Gem::Version
56
- version: '7.1'
56
+ version: '7.2'
57
57
  type: :runtime
58
58
  prerelease: false
59
59
  version_requirements: !ruby/object:Gem::Requirement
@@ -63,7 +63,7 @@ dependencies:
63
63
  version: 7.0.0
64
64
  - - "<"
65
65
  - !ruby/object:Gem::Version
66
- version: '7.1'
66
+ version: '7.2'
67
67
  - !ruby/object:Gem::Dependency
68
68
  name: actionpack
69
69
  requirement: !ruby/object:Gem::Requirement
@@ -73,7 +73,7 @@ dependencies:
73
73
  version: 7.0.0
74
74
  - - "<"
75
75
  - !ruby/object:Gem::Version
76
- version: '7.1'
76
+ version: '7.2'
77
77
  type: :runtime
78
78
  prerelease: false
79
79
  version_requirements: !ruby/object:Gem::Requirement
@@ -83,7 +83,7 @@ dependencies:
83
83
  version: 7.0.0
84
84
  - - "<"
85
85
  - !ruby/object:Gem::Version
86
- version: '7.1'
86
+ version: '7.2'
87
87
  - !ruby/object:Gem::Dependency
88
88
  name: railties
89
89
  requirement: !ruby/object:Gem::Requirement
@@ -93,7 +93,7 @@ dependencies:
93
93
  version: 7.0.0
94
94
  - - "<"
95
95
  - !ruby/object:Gem::Version
96
- version: '7.1'
96
+ version: '7.2'
97
97
  type: :runtime
98
98
  prerelease: false
99
99
  version_requirements: !ruby/object:Gem::Requirement
@@ -103,7 +103,7 @@ dependencies:
103
103
  version: 7.0.0
104
104
  - - "<"
105
105
  - !ruby/object:Gem::Version
106
- version: '7.1'
106
+ version: '7.2'
107
107
  description: Extensions for Rails I18n
108
108
  email: mtgrosser@gmx.net
109
109
  executables: []
@@ -151,7 +151,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
151
151
  - !ruby/object:Gem::Version
152
152
  version: '0'
153
153
  requirements: []
154
- rubygems_version: 3.1.4
154
+ rubygems_version: 3.4.10
155
155
  signing_key:
156
156
  specification_version: 4
157
157
  summary: Make I18n roar again