rails-i18n 7.0.9 → 8.0.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: 0c91f58bb2ee548d21752bc153f3e4ca0d9538af37c8b88177a4ea8236d91697
4
- data.tar.gz: 1d2a78847cb3f13dd1408a516869c04f62c22524e007cd744b963831e679e2c1
3
+ metadata.gz: 641d4bcf65ad23bf092e18739381e15be37c35b4be8de8f01c49c2f6e14004c5
4
+ data.tar.gz: fede876f23dfce53ceb04fa7c897eef0e21142ce2b973eaeb0b4c0ecb1910c6d
5
5
  SHA512:
6
- metadata.gz: 37509516f9cf6398b348c3a9b548825a291fd6a764e581bbb746c74c27cba32e684b1aa11ec5e917f5a8641ff32d366d137d7d664eac3497b632dba21120fda5
7
- data.tar.gz: ae00ed5d33af32f25b84ef8d5ef856753fbe6e27ebcec3a68c020ac38cec09b6caa8cf2a339710390840977febcc0510ca073c43a8e80255e2bb6ba6123bdbae
6
+ metadata.gz: 05bb380dffe70a9975d50d5527ac5569fd8e92097879e01d566d98c22b9ce726348b4980e4b10efc237578db955a20b135764cb9408a00b932b508ba7ea30d4f
7
+ data.tar.gz: 86cb86473bbe5045af2deda68aa82697a4ce3e20e87bfe3ab9eec3b1e47c173a2c82789bffc0dc3a8a0b3a6ebd82bbd384cd336d173ae84d27fba0aba43b41fc
data/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  ## unreleased
2
2
 
3
+
4
+ ## 8.0.0 (2024-11-09)
5
+
6
+ - Update to Rails 8.0.x
7
+
8
+ ## 7.0.10 (2024-10-28)
9
+
10
+ - Update following locales:
11
+ - Lithuanian (lt): Add missing keys (`x_years`, `in`, `model_invalid`, `required`, `round_mode`, `eb`, `pb`)
12
+ - Portuguese (pt): Fixed `number.currency.format.format` and `helpers.submit.update` #1122
13
+ - Croatian (hr): use genitive case for month names and put a period after weekday and month abbreviations #1126
14
+ - Korean (ko): Add missing keys (Storage units) #1118
15
+ - Fix compatibility with frozen string literals. #1120
16
+ - Refactor translations implemented in Ruby to avoid method redefinition warnings on reload. #1128
17
+
3
18
  ## 7.0.9 (2024-03-13)
4
19
 
5
20
  - Add following locales:
data/README.md CHANGED
@@ -11,12 +11,14 @@ Centralization of locale data collection for Ruby on Rails.
11
11
  Include the gem to your Gemfile:
12
12
 
13
13
  ``` ruby
14
- gem 'rails-i18n', '~> 7.0.0' # For 7.0.0
14
+ gem 'rails-i18n', github: 'svenfuchs/rails-i18n', branch: 'master' # For bleeding edge unreleased versions
15
+ gem 'rails-i18n', '~> 8.0.0' # For Rails >= 8.0.0
16
+ gem 'rails-i18n', '~> 7.0.0' # For Rails >= 7.0.0
15
17
  gem 'rails-i18n', '~> 6.0' # For 6.x
16
18
  gem 'rails-i18n', '~> 5.1' # For 5.0.x, 5.1.x and 5.2.x
17
19
  gem 'rails-i18n', '~> 4.0' # For 4.0.x
18
20
  gem 'rails-i18n', '~> 3.0' # For 3.x
19
- gem 'rails-i18n', github: 'svenfuchs/rails-i18n', branch: 'master' # For 5.x
21
+ gem 'rails-i18n', github: 'svenfuchs/rails-i18n', branch: 'rails-5-x' # For 5.x
20
22
  gem 'rails-i18n', github: 'svenfuchs/rails-i18n', branch: 'rails-4-x' # For 4.x
21
23
  gem 'rails-i18n', github: 'svenfuchs/rails-i18n', branch: 'rails-3-x' # For 3.x
22
24
  ```
@@ -24,7 +26,8 @@ gem 'rails-i18n', github: 'svenfuchs/rails-i18n', branch: 'rails-3-x' # For 3.x
24
26
  Alternatively, execute the following command:
25
27
 
26
28
  ``` shell
27
- gem install rails-i18n -v '~> 7.0.0' # For 7.0.0
29
+ gem install rails-i18n -v '~> 8.0.0' # For Rails >= 8.0.0
30
+ gem install rails-i18n -v '~> 7.0.0' # For Rails >= 7.0.0
28
31
  gem install rails-i18n -v '~> 6.0' # For 6.x
29
32
  gem install rails-i18n -v '~> 5.1' # For For 5.0.x, 5.1.x and 5.2.x
30
33
  gem install rails-i18n -v '~> 4.0' # For 4.0.x
@@ -0,0 +1,143 @@
1
+ module RailsI18n
2
+ module Pluralization
3
+ module Arabic
4
+ def self.rule
5
+ lambda do |n|
6
+ return :other unless n.is_a?(Numeric)
7
+
8
+ mod100 = n % 100
9
+
10
+ if n == 0
11
+ :zero
12
+ elsif n == 1
13
+ :one
14
+ elsif n == 2
15
+ :two
16
+ elsif (3..10).to_a.include?(mod100)
17
+ :few
18
+ elsif (11..99).to_a.include?(mod100)
19
+ :many
20
+ else
21
+ :other
22
+ end
23
+ end
24
+ end
25
+ end
26
+
27
+ module ScottishGaelic
28
+ def self.rule
29
+ lambda do |n|
30
+ return :other unless n.is_a?(Numeric)
31
+
32
+ floorn = n.floor
33
+
34
+ if floorn == 1 || floorn == 11
35
+ :one
36
+ elsif floorn == 2 || floorn == 12
37
+ :two
38
+ elsif (3..19).member?(floorn)
39
+ :few
40
+ else
41
+ :other
42
+ end
43
+ end
44
+ end
45
+ end
46
+
47
+ module UpperSorbian
48
+ def self.rule
49
+ lambda do |n|
50
+ return :other unless n.is_a?(Numeric)
51
+
52
+ mod100 = n % 100
53
+
54
+ case mod100
55
+ when 1 then :one
56
+ when 2 then :two
57
+ when 3, 4 then :few
58
+ else :other
59
+ end
60
+ end
61
+ end
62
+ end
63
+
64
+ module Lithuanian
65
+ def self.rule
66
+ lambda do |n|
67
+ return :other unless n.is_a?(Numeric)
68
+
69
+ mod10 = n % 10
70
+ mod100 = n % 100
71
+
72
+ if mod10 == 1 && !(11..19).to_a.include?(mod100)
73
+ :one
74
+ elsif (2..9).to_a.include?(mod10) && !(11..19).to_a.include?(mod100)
75
+ :few
76
+ else
77
+ :other
78
+ end
79
+ end
80
+ end
81
+ end
82
+
83
+ module Latvian
84
+ def self.rule
85
+ lambda do |n|
86
+ if n.is_a?(Numeric) && n % 10 == 1 && n % 100 != 11
87
+ :one
88
+ else
89
+ :other
90
+ end
91
+ end
92
+ end
93
+ end
94
+
95
+ module Macedonian
96
+ def self.rule
97
+ lambda do |n|
98
+ if n.is_a?(Numeric) && n % 10 == 1 && n != 11
99
+ :one
100
+ else
101
+ :other
102
+ end
103
+ end
104
+ end
105
+ end
106
+
107
+ module Polish
108
+ def self.rule
109
+ lambda do |n|
110
+ return :other unless n.is_a?(Numeric)
111
+
112
+ mod10 = n % 10
113
+ mod100 = n % 100
114
+
115
+ if n == 1
116
+ :one
117
+ elsif [2, 3, 4].include?(mod10) && ![12, 13, 14].include?(mod100)
118
+ :few
119
+ elsif [0, 1, 5, 6, 7, 8, 9].include?(mod10) || [12, 13, 14].include?(mod100)
120
+ :many
121
+ else
122
+ :other
123
+ end
124
+ end
125
+ end
126
+ end
127
+
128
+ module Slovenian
129
+ def self.rule
130
+ lambda do |n|
131
+ return :other unless n.is_a?(Numeric)
132
+
133
+ case n % 100
134
+ when 1 then :one
135
+ when 2 then :two
136
+ when 3, 4 then :few
137
+ else :other
138
+ end
139
+ end
140
+ end
141
+ end
142
+ end
143
+ end
@@ -0,0 +1,191 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RailsI18n
4
+ module Transliteration
5
+ module Ukrainian
6
+ class << self
7
+ def rule
8
+ lambda do |string|
9
+ next '' unless string
10
+
11
+ string.gsub(/./) do |char|
12
+ # Regexp.last_match is local to the thread and method scope
13
+ # of the method that did the pattern match.
14
+ @pre_match, @post_match = $`, $'
15
+
16
+ case char
17
+ when 'Ж'
18
+ lookahead_upcase 'ZH'
19
+ when 'Х'
20
+ lookahead_upcase 'KH'
21
+ when 'Ц'
22
+ lookahead_upcase 'TS'
23
+ when 'Ч'
24
+ lookahead_upcase 'CH'
25
+ when 'Ш'
26
+ lookahead_upcase 'SH'
27
+ when 'Щ'
28
+ lookahead_upcase 'SHCH'
29
+ when 'г'
30
+ behind =~ /[зЗ]/ ? 'gh' : 'h'
31
+ when 'Г'
32
+ behind =~ /[зЗ]/ ? lookahead_upcase('GH') : 'H'
33
+ when 'є'
34
+ letter?(behind) ? 'ie' : 'ye'
35
+ when 'Є'
36
+ letter?(behind) ? lookahead_upcase('IE') : lookahead_upcase('YE')
37
+ when 'ї'
38
+ letter?(behind) ? 'i' : 'yi'
39
+ when 'Ї'
40
+ letter?(behind) ? 'I' : lookahead_upcase('YI')
41
+ when 'й'
42
+ letter?(behind) ? 'i' : 'y'
43
+ when 'Й'
44
+ letter?(behind) ? 'I' : 'Y'
45
+ when 'ю'
46
+ letter?(behind) ? 'iu' : 'yu'
47
+ when 'Ю'
48
+ letter?(behind) ? lookahead_upcase('IU') : lookahead_upcase('YU')
49
+ when 'я'
50
+ letter?(behind) ? 'ia' : 'ya'
51
+ when 'Я'
52
+ letter?(behind) ? lookahead_upcase('IA') : lookahead_upcase('YA')
53
+ when "'"
54
+ # remove apostrophe inside a word
55
+ letter?(behind) && letter?(ahead) ? '' : "'"
56
+ else
57
+ straight_lookup[char] || char
58
+ end
59
+ end
60
+ end
61
+ end
62
+
63
+ private
64
+
65
+ def behind
66
+ @pre_match && @pre_match[-1]
67
+ end
68
+
69
+ def ahead
70
+ @post_match && @post_match[0]
71
+ end
72
+
73
+ def downcased?(symbol)
74
+ symbol =~ downcased_regexp
75
+ end
76
+
77
+ def downcased_regexp
78
+ @downcased_regexp ||= /[а-яґєії]/
79
+ end
80
+
81
+ # apostrophe can be inside a word
82
+ def letter?(symbol)
83
+ symbol =~ letter_regexp
84
+ end
85
+
86
+ def letter_regexp
87
+ @letter_regexp ||= /[а-яґєіїА-ЯҐЄІЇ'’]/
88
+ end
89
+
90
+ def lookahead_upcase(word)
91
+ downcased?(ahead) ? word.capitalize : word.upcase
92
+ end
93
+
94
+ def straight_lookup
95
+ @straight_lookup ||= {
96
+ 'а'=>'a','б'=>'b','в'=>'v','ґ'=>'g','д'=>'d','е'=>'e','ж'=>'zh',
97
+ 'з'=>'z','и'=>'y','і'=>'i','к'=>'k','л'=>'l','м'=>'m','н'=>'n','о'=>'o',
98
+ 'п'=>'p','р'=>'r','с'=>'s','т'=>'t','у'=>'u','ф'=>'f','х'=>'kh','ц'=>'ts',
99
+ 'ч'=>'ch','ш'=>'sh','щ'=>'shch','ь'=>'','’'=>'',
100
+ 'А'=>'A','Б'=>'B','В'=>'V','Ґ'=>'G','Д'=>'D','Е'=>'E',
101
+ 'З'=>'Z','И'=>'Y','І'=>'I','К'=>'K','Л'=>'L','М'=>'M','Н'=>'N','О'=>'O',
102
+ 'П'=>'P','Р'=>'R','С'=>'S','Т'=>'T','У'=>'U','Ф'=>'F','Ь'=>''
103
+ }
104
+ end
105
+ end
106
+ end
107
+
108
+ # (c) Yaroslav Markin, Julian "julik" Tarkhanov and Co
109
+ # https://github.com/yaroslav/russian/blob/master/lib/russian/transliteration.rb
110
+ module Russian
111
+ class << self
112
+ def rule
113
+ lambda do |string|
114
+ next '' unless string
115
+
116
+ chars = string.scan(%r{#{multi_keys.join '|'}|\w|.})
117
+
118
+ result = +""
119
+
120
+ chars.each_with_index do |char, index|
121
+ if upper.has_key?(char) && lower.has_key?(chars[index+1])
122
+ # combined case
123
+ result << upper[char].downcase.capitalize
124
+ elsif upper.has_key?(char)
125
+ result << upper[char]
126
+ elsif lower.has_key?(char)
127
+ result << lower[char]
128
+ else
129
+ result << char
130
+ end
131
+ end
132
+
133
+ result
134
+ end
135
+ end
136
+
137
+ private
138
+
139
+ # use instance variables instead of constants to prevent warnings
140
+ # on re-evaling after I18n.reload!
141
+
142
+ def upper
143
+ @upper ||= begin
144
+ upper_single = {
145
+ "Ґ"=>"G","Ё"=>"YO","Є"=>"E","Ї"=>"YI","І"=>"I",
146
+ "А"=>"A","Б"=>"B","В"=>"V","Г"=>"G",
147
+ "Д"=>"D","Е"=>"E","Ж"=>"ZH","З"=>"Z","И"=>"I",
148
+ "Й"=>"Y","К"=>"K","Л"=>"L","М"=>"M","Н"=>"N",
149
+ "О"=>"O","П"=>"P","Р"=>"R","С"=>"S","Т"=>"T",
150
+ "У"=>"U","Ф"=>"F","Х"=>"H","Ц"=>"TS","Ч"=>"CH",
151
+ "Ш"=>"SH","Щ"=>"SCH","Ъ"=>"'","Ы"=>"Y","Ь"=>"",
152
+ "Э"=>"E","Ю"=>"YU","Я"=>"YA",
153
+ }
154
+
155
+ (upper_single.merge(upper_multi)).freeze
156
+ end
157
+ end
158
+
159
+ def lower
160
+ @lower ||= begin
161
+ lower_single = {
162
+ "і"=>"i","ґ"=>"g","ё"=>"yo","№"=>"#","є"=>"e",
163
+ "ї"=>"yi","а"=>"a","б"=>"b",
164
+ "в"=>"v","г"=>"g","д"=>"d","е"=>"e","ж"=>"zh",
165
+ "з"=>"z","и"=>"i","й"=>"y","к"=>"k","л"=>"l",
166
+ "м"=>"m","н"=>"n","о"=>"o","п"=>"p","р"=>"r",
167
+ "с"=>"s","т"=>"t","у"=>"u","ф"=>"f","х"=>"h",
168
+ "ц"=>"ts","ч"=>"ch","ш"=>"sh","щ"=>"sch","ъ"=>"'",
169
+ "ы"=>"y","ь"=>"","э"=>"e","ю"=>"yu","я"=>"ya",
170
+ }
171
+
172
+ (lower_single.merge(lower_multi)).freeze
173
+ end
174
+ end
175
+
176
+ def upper_multi
177
+ @upper_multi ||= { "ЬЕ"=>"IE", "ЬЁ"=>"IE" }
178
+ end
179
+
180
+ def lower_multi
181
+ @lower_multi ||= { "ье"=>"ie", "ьё"=>"ie" }
182
+ end
183
+
184
+ def multi_keys
185
+ @multi_keys ||= (lower_multi.merge(upper_multi)).keys.sort_by {|s| s.length}.reverse.freeze
186
+ end
187
+ end
188
+ end
189
+ end
190
+ end
191
+
data/rails/locale/en.yml CHANGED
@@ -17,7 +17,7 @@ en:
17
17
  - Fri
18
18
  - Sat
19
19
  abbr_month_names:
20
- -
20
+ -
21
21
  - Jan
22
22
  - Feb
23
23
  - Mar
@@ -43,7 +43,7 @@ en:
43
43
  long: "%B %d, %Y"
44
44
  short: "%b %d"
45
45
  month_names:
46
- -
46
+ -
47
47
  - January
48
48
  - February
49
49
  - March
@@ -57,9 +57,9 @@ en:
57
57
  - November
58
58
  - December
59
59
  order:
60
- - :year
61
- - :month
62
- - :day
60
+ - year
61
+ - month
62
+ - day
63
63
  datetime:
64
64
  distance_in_words:
65
65
  about_x_hours:
@@ -100,7 +100,7 @@ en:
100
100
  one: "%{count} year"
101
101
  other: "%{count} years"
102
102
  prompts:
103
- second: Second
103
+ second: Seconds
104
104
  minute: Minute
105
105
  hour: Hour
106
106
  day: Day
@@ -157,6 +157,7 @@ en:
157
157
  format:
158
158
  delimiter: ","
159
159
  format: "%u%n"
160
+ negative_format: "-%u%n"
160
161
  precision: 2
161
162
  separator: "."
162
163
  significant: false
@@ -196,6 +197,7 @@ en:
196
197
  mb: MB
197
198
  pb: PB
198
199
  tb: TB
200
+ zb: ZB
199
201
  percentage:
200
202
  format:
201
203
  delimiter: ''
data/rails/locale/hr.yml CHANGED
@@ -9,27 +9,27 @@ hr:
9
9
  has_many: Nije moguće izbrisati zapis jer postoje ovisni %{record}
10
10
  date:
11
11
  abbr_day_names:
12
- - ned
13
- - pon
14
- - uto
15
- - sri
16
- - čet
17
- - pet
18
- - sub
12
+ - ned.
13
+ - pon.
14
+ - uto.
15
+ - sri.
16
+ - čet.
17
+ - pet.
18
+ - sub.
19
19
  abbr_month_names:
20
20
  -
21
- - sij
22
- - velj
23
- - ožu
24
- - tra
25
- - svi
26
- - lip
27
- - srp
28
- - kol
29
- - ruj
30
- - lis
31
- - stu
32
- - pro
21
+ - sij.
22
+ - velj.
23
+ - ožu.
24
+ - tra.
25
+ - svi.
26
+ - lip.
27
+ - srp.
28
+ - kol.
29
+ - ruj.
30
+ - lis.
31
+ - stu.
32
+ - pro.
33
33
  day_names:
34
34
  - nedjelja
35
35
  - ponedjeljak
@@ -44,18 +44,18 @@ hr:
44
44
  short: "%e.%-m."
45
45
  month_names:
46
46
  -
47
- - siječanj
48
- - veljača
49
- - ožujak
50
- - travanj
51
- - svibanj
52
- - lipanj
53
- - srpanj
54
- - kolovoz
55
- - rujan
56
- - listopad
57
- - studeni
58
- - prosinac
47
+ - siječnja
48
+ - veljače
49
+ - ožujka
50
+ - travnja
51
+ - svibnja
52
+ - lipnja
53
+ - srpnja
54
+ - kolovoza
55
+ - rujna
56
+ - listopada
57
+ - studenoga
58
+ - prosinca
59
59
  order:
60
60
  - :day
61
61
  - :month
data/rails/locale/ko.yml CHANGED
@@ -156,9 +156,11 @@ ko:
156
156
  format: "%n%u"
157
157
  units:
158
158
  byte: 바이트
159
+ eb: EB
159
160
  gb: GB
160
161
  kb: KB
161
162
  mb: MB
163
+ pb: PB
162
164
  tb: TB
163
165
  percentage:
164
166
  format:
data/rails/locale/lt.yml CHANGED
@@ -107,6 +107,10 @@ lt:
107
107
  one: "%{count} mėnesis"
108
108
  few: "%{count} mėnesiai"
109
109
  other: "%{count} mėnesių"
110
+ x_years:
111
+ one: "%{count} metai"
112
+ few: "%{count} metai"
113
+ other: "%{count} metai"
110
114
  prompts:
111
115
  second: Sekundės
112
116
  minute: Minutė
@@ -126,15 +130,18 @@ lt:
126
130
  exclusion: yra rezervuotas
127
131
  greater_than: turi būti didesnis už %{count}
128
132
  greater_than_or_equal_to: turi būti didesnis arba lygus %{count}
133
+ in: turi būti skaičiuje %{count}
129
134
  inclusion: nenumatyta reikšmė
130
135
  invalid: neteisingas
131
136
  less_than: turi būti mažesnis už %{count}
132
137
  less_than_or_equal_to: turi būti mažesnis arba lygus %{count}
138
+ model_invalid: 'Tikrinimo klaida: %{errors}'
133
139
  not_a_number: ne skaičius
134
140
  not_an_integer: privalo būti sveikas skaičius
135
141
  odd: turi būti nelyginis skaičius
136
142
  other_than: privalo būti kitoks nei %{count}
137
143
  present: turi būti tuščias
144
+ required: turi egzistuoti
138
145
  taken: jau užimtas
139
146
  too_long:
140
147
  one: per ilgas (daugiausiai %{count} simbolis)
@@ -171,6 +178,7 @@ lt:
171
178
  format:
172
179
  delimiter: " "
173
180
  precision: 3
181
+ round_mode: default
174
182
  separator: ","
175
183
  significant: false
176
184
  strip_insignificant_zeros: false
@@ -196,9 +204,11 @@ lt:
196
204
  one: Baitas
197
205
  few: Baitai
198
206
  other: Baitų
207
+ eb: EB
199
208
  gb: GB
200
209
  kb: KB
201
210
  mb: MB
211
+ pb: PB
202
212
  tb: TB
203
213
  percentage:
204
214
  format:
data/rails/locale/pt.yml CHANGED
@@ -145,12 +145,12 @@ pt:
145
145
  submit:
146
146
  create: Criar %{model}
147
147
  submit: Gravar %{model}
148
- update: Actualizar %{model}
148
+ update: Atualizar %{model}
149
149
  number:
150
150
  currency:
151
151
  format:
152
152
  delimiter: "."
153
- format: "%u %n"
153
+ format: "%n %u"
154
154
  precision: 2
155
155
  separator: ","
156
156
  significant: false
data/rails/locale/tr.yml CHANGED
@@ -40,7 +40,7 @@ tr:
40
40
  - Cumartesi
41
41
  formats:
42
42
  default: "%d.%m.%Y"
43
- long: "%e %B %Y, %A"
43
+ long: "%e %B %Y %A"
44
44
  short: "%e %b"
45
45
  month_names:
46
46
  -
@@ -1,30 +1,4 @@
1
- module RailsI18n
2
- module Pluralization
3
- module Arabic
4
- def self.rule
5
- lambda do |n|
6
- return :other unless n.is_a?(Numeric)
7
-
8
- mod100 = n % 100
9
-
10
- if n == 0
11
- :zero
12
- elsif n == 1
13
- :one
14
- elsif n == 2
15
- :two
16
- elsif (3..10).to_a.include?(mod100)
17
- :few
18
- elsif (11..99).to_a.include?(mod100)
19
- :many
20
- else
21
- :other
22
- end
23
- end
24
- end
25
- end
26
- end
27
- end
1
+ require 'rails_i18n/pluralization'
28
2
 
29
3
  { :ar => {
30
4
  :'i18n' => {
@@ -1,26 +1,4 @@
1
- module RailsI18n
2
- module Pluralization
3
- module ScottishGaelic
4
- def self.rule
5
- lambda do |n|
6
- return :other unless n.is_a?(Numeric)
7
-
8
- floorn = n.floor
9
-
10
- if floorn == 1 || floorn == 11
11
- :one
12
- elsif floorn == 2 || floorn == 12
13
- :two
14
- elsif (3..19).member?(floorn)
15
- :few
16
- else
17
- :other
18
- end
19
- end
20
- end
21
- end
22
- end
23
- end
1
+ require 'rails_i18n/pluralization'
24
2
 
25
3
  { :gd => {
26
4
  :'i18n' => {
@@ -1,23 +1,4 @@
1
- module RailsI18n
2
- module Pluralization
3
- module UpperSorbian
4
- def self.rule
5
- lambda do |n|
6
- return :other unless n.is_a?(Numeric)
7
-
8
- mod100 = n % 100
9
-
10
- case mod100
11
- when 1 then :one
12
- when 2 then :two
13
- when 3, 4 then :few
14
- else :other
15
- end
16
- end
17
- end
18
- end
19
- end
20
- end
1
+ require 'rails_i18n/pluralization'
21
2
 
22
3
  { :hsb => {
23
4
  :'i18n' => {
@@ -1,25 +1,4 @@
1
- module RailsI18n
2
- module Pluralization
3
- module Lithuanian
4
- def self.rule
5
- lambda do |n|
6
- return :other unless n.is_a?(Numeric)
7
-
8
- mod10 = n % 10
9
- mod100 = n % 100
10
-
11
- if mod10 == 1 && !(11..19).to_a.include?(mod100)
12
- :one
13
- elsif (2..9).to_a.include?(mod10) && !(11..19).to_a.include?(mod100)
14
- :few
15
- else
16
- :other
17
- end
18
- end
19
- end
20
- end
21
- end
22
- end
1
+ require 'rails_i18n/pluralization'
23
2
 
24
3
  { :lt => {
25
4
  :'i18n' => {
@@ -1,18 +1,4 @@
1
- module RailsI18n
2
- module Pluralization
3
- module Latvian
4
- def self.rule
5
- lambda do |n|
6
- if n.is_a?(Numeric) && n % 10 == 1 && n % 100 != 11
7
- :one
8
- else
9
- :other
10
- end
11
- end
12
- end
13
- end
14
- end
15
- end
1
+ require 'rails_i18n/pluralization'
16
2
 
17
3
  { :lv => {
18
4
  :'i18n' => {
@@ -1,18 +1,4 @@
1
- module RailsI18n
2
- module Pluralization
3
- module Macedonian
4
- def self.rule
5
- lambda do |n|
6
- if n.is_a?(Numeric) && n % 10 == 1 && n != 11
7
- :one
8
- else
9
- :other
10
- end
11
- end
12
- end
13
- end
14
- end
15
- end
1
+ require 'rails_i18n/pluralization'
16
2
 
17
3
  { :mk => {
18
4
  :'i18n' => {
@@ -1,27 +1,4 @@
1
- module RailsI18n
2
- module Pluralization
3
- module Polish
4
- def self.rule
5
- lambda do |n|
6
- return :other unless n.is_a?(Numeric)
7
-
8
- mod10 = n % 10
9
- mod100 = n % 100
10
-
11
- if n == 1
12
- :one
13
- elsif [2, 3, 4].include?(mod10) && ![12, 13, 14].include?(mod100)
14
- :few
15
- elsif [0, 1, 5, 6, 7, 8, 9].include?(mod10) || [12, 13, 14].include?(mod100)
16
- :many
17
- else
18
- :other
19
- end
20
- end
21
- end
22
- end
23
- end
24
- end
1
+ require 'rails_i18n/pluralization'
25
2
 
26
3
  { :pl => {
27
4
  :'i18n' => {
@@ -1,21 +1,4 @@
1
- module RailsI18n
2
- module Pluralization
3
- module Slovenian
4
- def self.rule
5
- lambda do |n|
6
- return :other unless n.is_a?(Numeric)
7
-
8
- case n % 100
9
- when 1 then :one
10
- when 2 then :two
11
- when 3, 4 then :few
12
- else :other
13
- end
14
- end
15
- end
16
- end
17
- end
18
- end
1
+ require 'rails_i18n/pluralization'
19
2
 
20
3
  { :sl => {
21
4
  :'i18n' => {
@@ -1,91 +1,4 @@
1
- # encoding: utf-8
2
-
3
- # (c) Yaroslav Markin, Julian "julik" Tarkhanov and Co
4
- # https://github.com/yaroslav/russian/blob/master/lib/russian/transliteration.rb
5
-
6
- module RailsI18n
7
- module Transliteration
8
- module Russian
9
- class << self
10
- def rule
11
- lambda do |string|
12
- next '' unless string
13
-
14
- chars = string.scan(%r{#{multi_keys.join '|'}|\w|.})
15
-
16
- result = ""
17
-
18
- chars.each_with_index do |char, index|
19
- if upper.has_key?(char) && lower.has_key?(chars[index+1])
20
- # combined case
21
- result << upper[char].downcase.capitalize
22
- elsif upper.has_key?(char)
23
- result << upper[char]
24
- elsif lower.has_key?(char)
25
- result << lower[char]
26
- else
27
- result << char
28
- end
29
- end
30
-
31
- result
32
- end
33
- end
34
-
35
- private
36
-
37
- # use instance variables instead of constants to prevent warnings
38
- # on re-evaling after I18n.reload!
39
-
40
- def upper
41
- @upper ||= begin
42
- upper_single = {
43
- "Ґ"=>"G","Ё"=>"YO","Є"=>"E","Ї"=>"YI","І"=>"I",
44
- "А"=>"A","Б"=>"B","В"=>"V","Г"=>"G",
45
- "Д"=>"D","Е"=>"E","Ж"=>"ZH","З"=>"Z","И"=>"I",
46
- "Й"=>"Y","К"=>"K","Л"=>"L","М"=>"M","Н"=>"N",
47
- "О"=>"O","П"=>"P","Р"=>"R","С"=>"S","Т"=>"T",
48
- "У"=>"U","Ф"=>"F","Х"=>"H","Ц"=>"TS","Ч"=>"CH",
49
- "Ш"=>"SH","Щ"=>"SCH","Ъ"=>"'","Ы"=>"Y","Ь"=>"",
50
- "Э"=>"E","Ю"=>"YU","Я"=>"YA",
51
- }
52
-
53
- (upper_single.merge(upper_multi)).freeze
54
- end
55
- end
56
-
57
- def lower
58
- @lower ||= begin
59
- lower_single = {
60
- "і"=>"i","ґ"=>"g","ё"=>"yo","№"=>"#","є"=>"e",
61
- "ї"=>"yi","а"=>"a","б"=>"b",
62
- "в"=>"v","г"=>"g","д"=>"d","е"=>"e","ж"=>"zh",
63
- "з"=>"z","и"=>"i","й"=>"y","к"=>"k","л"=>"l",
64
- "м"=>"m","н"=>"n","о"=>"o","п"=>"p","р"=>"r",
65
- "с"=>"s","т"=>"t","у"=>"u","ф"=>"f","х"=>"h",
66
- "ц"=>"ts","ч"=>"ch","ш"=>"sh","щ"=>"sch","ъ"=>"'",
67
- "ы"=>"y","ь"=>"","э"=>"e","ю"=>"yu","я"=>"ya",
68
- }
69
-
70
- (lower_single.merge(lower_multi)).freeze
71
- end
72
- end
73
-
74
- def upper_multi
75
- @upper_multi ||= { "ЬЕ"=>"IE", "ЬЁ"=>"IE" }
76
- end
77
-
78
- def lower_multi
79
- @lower_multi ||= { "ье"=>"ie", "ьё"=>"ie" }
80
- end
81
-
82
- def multi_keys
83
- @multi_keys ||= (lower_multi.merge(upper_multi)).keys.sort_by {|s| s.length}.reverse.freeze
84
- end
85
- end
86
- end
87
- end
88
- end
1
+ require 'rails_i18n/transliteration'
89
2
 
90
3
  { :ru => {
91
4
  :i18n => {
@@ -1,111 +1,4 @@
1
- # encoding: utf-8
2
-
3
- module RailsI18n
4
- module Transliteration
5
- module Ukrainian
6
- class << self
7
- def rule
8
- lambda do |string|
9
- next '' unless string
10
-
11
- string.gsub(/./) do |char|
12
- # Regexp.last_match is local to the thread and method scope
13
- # of the method that did the pattern match.
14
- @pre_match, @post_match = $`, $'
15
-
16
- case char
17
- when 'Ж'
18
- lookahead_upcase 'ZH'
19
- when 'Х'
20
- lookahead_upcase 'KH'
21
- when 'Ц'
22
- lookahead_upcase 'TS'
23
- when 'Ч'
24
- lookahead_upcase 'CH'
25
- when 'Ш'
26
- lookahead_upcase 'SH'
27
- when 'Щ'
28
- lookahead_upcase 'SHCH'
29
- when 'г'
30
- behind =~ /[зЗ]/ ? 'gh' : 'h'
31
- when 'Г'
32
- behind =~ /[зЗ]/ ? lookahead_upcase('GH') : 'H'
33
- when 'є'
34
- letter?(behind) ? 'ie' : 'ye'
35
- when 'Є'
36
- letter?(behind) ? lookahead_upcase('IE') : lookahead_upcase('YE')
37
- when 'ї'
38
- letter?(behind) ? 'i' : 'yi'
39
- when 'Ї'
40
- letter?(behind) ? 'I' : lookahead_upcase('YI')
41
- when 'й'
42
- letter?(behind) ? 'i' : 'y'
43
- when 'Й'
44
- letter?(behind) ? 'I' : 'Y'
45
- when 'ю'
46
- letter?(behind) ? 'iu' : 'yu'
47
- when 'Ю'
48
- letter?(behind) ? lookahead_upcase('IU') : lookahead_upcase('YU')
49
- when 'я'
50
- letter?(behind) ? 'ia' : 'ya'
51
- when 'Я'
52
- letter?(behind) ? lookahead_upcase('IA') : lookahead_upcase('YA')
53
- when "'"
54
- # remove apostrophe inside a word
55
- letter?(behind) && letter?(ahead) ? '' : "'"
56
- else
57
- straight_lookup[char] || char
58
- end
59
- end
60
- end
61
- end
62
-
63
- private
64
-
65
- def behind
66
- @pre_match && @pre_match[-1]
67
- end
68
-
69
- def ahead
70
- @post_match && @post_match[0]
71
- end
72
-
73
- def downcased?(symbol)
74
- symbol =~ downcased_regexp
75
- end
76
-
77
- def downcased_regexp
78
- @downcased_regexp ||= /[а-яґєії]/
79
- end
80
-
81
- # apostrophe can be inside a word
82
- def letter?(symbol)
83
- symbol =~ letter_regexp
84
- end
85
-
86
- def letter_regexp
87
- @letter_regexp ||= /[а-яґєіїА-ЯҐЄІЇ'’]/
88
- end
89
-
90
- def lookahead_upcase(word)
91
- downcased?(ahead) ? word.capitalize : word.upcase
92
- end
93
-
94
- def straight_lookup
95
- @straight_lookup ||= {
96
- 'а'=>'a','б'=>'b','в'=>'v','ґ'=>'g','д'=>'d','е'=>'e','ж'=>'zh',
97
- 'з'=>'z','и'=>'y','і'=>'i','к'=>'k','л'=>'l','м'=>'m','н'=>'n','о'=>'o',
98
- 'п'=>'p','р'=>'r','с'=>'s','т'=>'t','у'=>'u','ф'=>'f','х'=>'kh','ц'=>'ts',
99
- 'ч'=>'ch','ш'=>'sh','щ'=>'shch','ь'=>'','’'=>'',
100
- 'А'=>'A','Б'=>'B','В'=>'V','Ґ'=>'G','Д'=>'D','Е'=>'E',
101
- 'З'=>'Z','И'=>'Y','І'=>'I','К'=>'K','Л'=>'L','М'=>'M','Н'=>'N','О'=>'O',
102
- 'П'=>'P','Р'=>'R','С'=>'S','Т'=>'T','У'=>'U','Ф'=>'F','Ь'=>''
103
- }
104
- end
105
- end
106
- end
107
- end
108
- end
1
+ require 'rails_i18n/transliteration'
109
2
 
110
3
  { :uk => {
111
4
  :i18n => {
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-i18n
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.0.9
4
+ version: 8.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rails I18n Group
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-03-13 00:00:00.000000000 Z
11
+ date: 2024-11-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: i18n
@@ -36,20 +36,20 @@ dependencies:
36
36
  requirements:
37
37
  - - ">="
38
38
  - !ruby/object:Gem::Version
39
- version: 6.0.0
39
+ version: 8.0.0
40
40
  - - "<"
41
41
  - !ruby/object:Gem::Version
42
- version: '8'
42
+ version: '9'
43
43
  type: :runtime
44
44
  prerelease: false
45
45
  version_requirements: !ruby/object:Gem::Requirement
46
46
  requirements:
47
47
  - - ">="
48
48
  - !ruby/object:Gem::Version
49
- version: 6.0.0
49
+ version: 8.0.0
50
50
  - - "<"
51
51
  - !ruby/object:Gem::Version
52
- version: '8'
52
+ version: '9'
53
53
  - !ruby/object:Gem::Dependency
54
54
  name: rspec-rails
55
55
  requirement: !ruby/object:Gem::Requirement
@@ -113,7 +113,9 @@ files:
113
113
  - lib/rails_i18n/common_pluralizations/other.rb
114
114
  - lib/rails_i18n/common_pluralizations/romanian.rb
115
115
  - lib/rails_i18n/common_pluralizations/west_slavic.rb
116
+ - lib/rails_i18n/pluralization.rb
116
117
  - lib/rails_i18n/railtie.rb
118
+ - lib/rails_i18n/transliteration.rb
117
119
  - rails/locale/af.yml
118
120
  - rails/locale/ar.yml
119
121
  - rails/locale/az.yml
@@ -403,7 +405,7 @@ homepage: https://github.com/svenfuchs/rails-i18n
403
405
  licenses:
404
406
  - MIT
405
407
  metadata: {}
406
- post_install_message:
408
+ post_install_message:
407
409
  rdoc_options: []
408
410
  require_paths:
409
411
  - lib
@@ -411,15 +413,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
411
413
  requirements:
412
414
  - - ">="
413
415
  - !ruby/object:Gem::Version
414
- version: '0'
416
+ version: 3.2.0
415
417
  required_rubygems_version: !ruby/object:Gem::Requirement
416
418
  requirements:
417
419
  - - ">="
418
420
  - !ruby/object:Gem::Version
419
421
  version: 1.8.11
420
422
  requirements: []
421
- rubygems_version: 3.0.3.1
422
- signing_key:
423
+ rubygems_version: 3.5.16
424
+ signing_key:
423
425
  specification_version: 4
424
426
  summary: Common locale data and translations for Rails i18n.
425
427
  test_files: []