pagy 0.11.0 → 0.11.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/lib/locales/plurals.rb +13 -15
- data/lib/pagy.rb +1 -1
- data/lib/pagy/extras/initializer_example.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fe753e045073fb8288a4d14f62484a4a940fb17ce18640655b33d9c353bec7ea
|
4
|
+
data.tar.gz: a0c3eab48bf5a0c0d47cd52448e7c11495e758ffbc6c033e6a68222eaf6d6a2b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: af246da4e7af45b15c67813e39634ff672b0bcbe18e049803652759ab6bfc7fe66f83de8dcbce5573b7793b429b91ad9485175bb480dcf458d4f8c335e7e2635
|
7
|
+
data.tar.gz: ce00e10c5c72ab2520dba027113b4d1adff0045d5a29e93feca3e5870fd6482fba4eba0d8cc7924cd15c2919e4b7fdf10c6f46efb87ef10c206126ca7d08339a
|
data/lib/locales/plurals.rb
CHANGED
@@ -1,25 +1,23 @@
|
|
1
|
-
# This file adds support for multiple built-in
|
2
|
-
# It defines the pluralization procs and gets eval(ed) at I18N.load time
|
1
|
+
# This file adds support for multiple built-in plualization types.
|
2
|
+
# It defines the pluralization procs and gets eval(ed) at I18N.load time.
|
3
3
|
# frozen_string_literal: true
|
4
4
|
|
5
5
|
# utility variables
|
6
6
|
zero_one = ['zero', 'one']
|
7
7
|
|
8
|
-
#
|
9
|
-
# A
|
10
|
-
# Each plural
|
11
|
-
|
8
|
+
# Plurals
|
9
|
+
# A plural proc returns a plural type string based on the passed count
|
10
|
+
# Each plural proc may apply to one or more languages below
|
11
|
+
plurals = {
|
12
12
|
zero_one_other: -> (count) {zero_one[count] || 'other'}
|
13
13
|
}
|
14
14
|
|
15
|
-
#
|
16
|
-
#
|
17
|
-
|
15
|
+
# Languages (language/plural pairs)
|
16
|
+
# Contain all the entries for all the languages defined in the pagy.yml dictionary
|
17
|
+
# The default plural for missing languages is the :zero_one_other plural (used for English)
|
18
|
+
Hash.new(plurals[:zero_one_other]).tap do |languages|
|
19
|
+
languages['en'] = plurals[:zero_one_other]
|
18
20
|
|
19
|
-
#
|
20
|
-
plurals['en'] = rules[:zero_one_other]
|
21
|
+
# PR for other languages and plurals are very welcome. Thanks!
|
21
22
|
|
22
|
-
|
23
|
-
|
24
|
-
# Return plurals
|
25
|
-
plurals
|
23
|
+
end
|
data/lib/pagy.rb
CHANGED
@@ -55,8 +55,8 @@
|
|
55
55
|
|
56
56
|
# Pagy::Frontend::I18N Constant
|
57
57
|
# See https://ddnexus.github.io/pagy/api/frontend#i18n
|
58
|
-
# Pagy::Frontend::I18N
|
59
|
-
# Pagy::Frontend::I18N
|
58
|
+
# Pagy::Frontend::I18N.load(file:'path/to/dictionary.yml', language:'en') # load a custom file
|
59
|
+
# Pagy::Frontend::I18N[:plural] = -> (count) {(['zero', 'one'][count] || 'other') # default
|
60
60
|
|
61
61
|
|
62
62
|
# Rails: extras assets path required by compact, items and responsive extras
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pagy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.11.
|
4
|
+
version: 0.11.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Domizio Demichelis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-07-01 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: 'Agnostic pagination in plain ruby: it works with any framework, ORM
|
14
14
|
and DB type, with all kinds of collections, even pre-paginated, scopes, Arrays,
|