tramway-core 1.6 → 1.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/config/initializers/plurals.rb +23 -0
- data/config/locales/ru/dates.yml +1 -0
- data/lib/string.rb +15 -0
- data/lib/tramway/core.rb +1 -0
- data/lib/tramway/core/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '038d11bab33834b37cee44fc2cfded45bf215d0847a0986fe62234b93885cfdb'
|
4
|
+
data.tar.gz: a208624475d9b43a3da6f45b266cf34be877a809d542d409a0c6e49dda2cb01d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 14d9cf11bde869129ac7cfb66f8b2f8a2b4768f7eedf988eba6d05591de5e17ed221ee8a98e2cda57a5b0db87f0eb78d800690fe472c27a8ec701dadfaf52634
|
7
|
+
data.tar.gz: 27c94491389de90ab0e3eb48ab76c6c45ff0f5b8588e4e14017a7e56da3fd8b8a2c1937373b8d924fdd440082224308f6716f44c8c50b71f5eea4188fb1ee1d8
|
@@ -0,0 +1,23 @@
|
|
1
|
+
{
|
2
|
+
ru: {
|
3
|
+
i18n: {
|
4
|
+
plural: {
|
5
|
+
keys: [:zero, :one, :few, :many],
|
6
|
+
rule: lambda do |n|
|
7
|
+
if n == 0
|
8
|
+
:zero
|
9
|
+
elsif n % 10 == 1 && n % 100 != 11
|
10
|
+
# 1, 21, 31, 41, 51, 61...
|
11
|
+
:one
|
12
|
+
elsif [2, 3, 4].include?(n % 10) && ![12, 13, 14].include?(n % 100)
|
13
|
+
# 2-4, 22-24, 32-34...
|
14
|
+
:few
|
15
|
+
elsif n % 10 == 0 || ![5, 6, 7, 8, 9].include?(n % 10) || ![11, 12, 13, 14].include?(n % 100)
|
16
|
+
# 0, 5-20, 25-30, 35-40...
|
17
|
+
:many
|
18
|
+
end
|
19
|
+
end
|
20
|
+
}
|
21
|
+
}
|
22
|
+
}
|
23
|
+
}
|
data/config/locales/ru/dates.yml
CHANGED
data/lib/string.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require "active_support/inflector/methods"
|
2
|
+
|
3
|
+
class String
|
4
|
+
def pluralize(count = nil, locale = :en)
|
5
|
+
if locale == :ru
|
6
|
+
case count
|
7
|
+
when :many
|
8
|
+
I18n.t("cases.#{}")
|
9
|
+
end
|
10
|
+
else
|
11
|
+
locale = count if count.is_a? Symbol
|
12
|
+
count == 1 ? dup : ActiveSupport::Inflector.pluralize(self, locale)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/lib/tramway/core.rb
CHANGED
data/lib/tramway/core/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tramway-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pavel Kalashnikov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-09-
|
11
|
+
date: 2018-09-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: reform-rails
|
@@ -237,11 +237,13 @@ files:
|
|
237
237
|
- app/views/tramway/core/shared/_input_extended.html.haml
|
238
238
|
- app/views/tramway/core/shared/_messages.html.haml
|
239
239
|
- config/initializers/assets.rb
|
240
|
+
- config/initializers/plurals.rb
|
240
241
|
- config/locales/ru/dates.yml
|
241
242
|
- config/locales/ru/helpers.yml
|
242
243
|
- config/locales/ru/models.yml
|
243
244
|
- config/locales/ru/state_machines.yml
|
244
245
|
- config/routes.rb
|
246
|
+
- lib/string.rb
|
245
247
|
- lib/tasks/tramway/core_tasks.rake
|
246
248
|
- lib/tramway/collection.rb
|
247
249
|
- lib/tramway/collections/helper.rb
|