pagy 2.1.4 → 2.1.5

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: e12b109cdfa036177939e12f0252a8f80d8ff7212dda373285cbc617dd560354
4
- data.tar.gz: 43678554d764fa960ebae93ceee27adda79b35b304c4c6d90b1f2ac9e03406bb
3
+ metadata.gz: b070d610f896a8b61e0f100c733e83d8eed0bfce6976ff24ed6e533f329c1ad2
4
+ data.tar.gz: 6c3654d072aea0dede29f6bf15069cc82ee3d6869ef812db6b78b0dda401013d
5
5
  SHA512:
6
- metadata.gz: 750e5d774204787364b1e8a658c721e4a3a19349f50c06e6764fdb436550513128b5ab22f438a01c46576476f404b0953188c42345dc0c898ce025217acd76aa
7
- data.tar.gz: 16f9efe431559d358efe7532c896dafeedac33b468b18259f72a430258892d13cf313d864bd2a2bb38585b6eb2782d5655b05c67403b41e0e1475235adf3cf59
6
+ metadata.gz: c4172ff22491bc6506fe9041e71ef6e7abf92c3bee1dbf17f7f067e7a25fd9fa0124f3e5c54dbf30807f2d3df9b49fc432d8683cc8fde0d8434aa4c1686823a6
7
+ data.tar.gz: 87f78b815480fa7bd1392b4b2991d4af65783acf55ada2dea2724546a1b7c2e0e046e0c5ea838b6c200c8a655d3850f1db9360ae7ee514419e667980759d61f4
data/lib/config/pagy.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
  # frozen_string_literal: true
3
3
 
4
- # Pagy initializer file (v2.1.4)
4
+ # Pagy initializer file (2.1.5)
5
5
  # Customize only what you really need and notice that Pagy works also without any of the following lines.
6
6
  # Should you just cherry pick part of this file, please maintain the require-order of the extras
7
7
 
@@ -6,10 +6,10 @@ If you are using pagy with some language missing from the dictionary files, plea
6
6
 
7
7
  The `pagy.info.single_page`, `pagy.info.item_name` and `pagy.items` keys of the yaml file are pluralized according to the plural rules of the language.
8
8
 
9
- If you are going to submit a dictionary, please check wether the pluralization type of your language exists in the [plurals.rb](https://github.com/ddnexus/pagy/blob/master/lib/locales/plurals.rb) file. If it is missing, please, report it. Thanks.
9
+ If you are going to submit a dictionary, please check wether the pluralization type of your language exists in the [lib/locales/utils/p11n.rb](utils/p11n.rb) file. If it is missing, please, report it. Thanks.
10
10
 
11
11
  ### Useful Links
12
12
 
13
13
  * [Pagy I18n Documentation](https://ddnexus.github.io/pagy/api/frontend#i18n)
14
- * [i18n extra](https://ddnexus.github.io/pagy/extra/i18n)
14
+ * [I18n Extra](https://ddnexus.github.io/pagy/extras/i18n)
15
15
 
@@ -16,10 +16,17 @@ flatten = lambda do |hash, key=''|
16
16
  end
17
17
  end
18
18
 
19
+ normalized_locales = {'zh-cn'=>'zh-CN', 'zh-hk'=>'zh-HK'}
20
+
19
21
  # loader proc
20
22
  lambda do |i18n, *args|
21
23
  i18n.clear
22
24
  args.each do |arg|
25
+ if normalized_locales.key?(arg[:locale])
26
+ right_locale = normalized_locales[arg[:locale]]
27
+ Warning.warn("\n*** WARNING *** [Pagy::I18n.load] The '#{arg[:locale]}' locale is incorrect and deprecated, please use '#{right_locale}'\n\n")
28
+ arg[:locale] = right_locale
29
+ end
23
30
  arg[:filepath] ||= Pagy.root.join('locales', "#{arg[:locale]}.yml")
24
31
  arg[:pluralize] ||= p11n[arg[:locale]]
25
32
  hash = YAML.load(File.read(arg[:filepath], encoding: 'UTF-8')) #rubocop:disable Security/YAMLLoad
@@ -1,4 +1,4 @@
1
- zh-cn:
1
+ zh-CN:
2
2
  pagy:
3
3
  nav:
4
4
  prev: "‹ 上一页"
@@ -1,4 +1,4 @@
1
- zh-hk:
1
+ zh-HK:
2
2
  pagy:
3
3
  nav:
4
4
  prev: "‹ 上一頁"
@@ -17,4 +17,4 @@ zh-hk:
17
17
  compact: "第 %{page_input} / %{pages} 頁"
18
18
  items:
19
19
  one: "每頁顯示 %{items_input} 記錄"
20
- other: "每頁顯示 %{items_input} 記錄"
20
+ other: "每頁顯示 %{items_input} 記錄"
@@ -0,0 +1,20 @@
1
+ zh-TW:
2
+ pagy:
3
+ nav:
4
+ prev: "‹ 上一頁"
5
+ next: "下一頁 ›"
6
+ gap: "…"
7
+ info:
8
+ single_page:
9
+ zero: "沒找到 %{item_name}"
10
+ one: "顯示 <b>1</b> 項%{item_name}"
11
+ other: "顯示<b>所有 %{count}</b> 項%{item_name}"
12
+ multiple_pages: "共 <b>%{count}</b> 項%{item_name},顯示 <b>%{from}-%{to}</b>"
13
+ item_name:
14
+ zero: "項"
15
+ one: ""
16
+ other: ""
17
+ compact: "第 %{page_input} / %{pages} 頁"
18
+ items:
19
+ one: "每頁顯示 %{items_input} 項"
20
+ other: "每頁顯示 %{items_input} 項"
@@ -38,9 +38,10 @@ class Pagy
38
38
  module Frontend
39
39
 
40
40
  alias_method :pagy_url_for_without_items, :pagy_url_for
41
- def pagy_url_for_with_items(page, pagy)
42
- p_vars = pagy.vars; params = request.GET.merge(p_vars[:page_param] => page, p_vars[:items_param] => p_vars[:items]).merge!(p_vars[:params])
43
- "#{request.path}?#{Rack::Utils.build_nested_query(pagy_get_params(params))}#{p_vars[:anchor]}"
41
+ def pagy_url_for_with_items(page, pagy, url=false)
42
+ p_vars = pagy.vars; params = request.GET.merge(p_vars[:params]); params[p_vars[:page_param].to_s] = page
43
+ params[p_vars[:items_param].to_s] = p_vars[:items]
44
+ "#{request.base_url if url}#{request.path}?#{Rack::Utils.build_nested_query(pagy_get_params(params))}#{p_vars[:anchor]}"
44
45
  end
45
46
  alias_method :pagy_url_for, :pagy_url_for_with_items
46
47
 
data/lib/pagy/frontend.rb CHANGED
@@ -12,9 +12,9 @@ class Pagy
12
12
 
13
13
  module Helpers
14
14
  # This works with all Rack-based frameworks (Sinatra, Padrino, Rails, ...)
15
- def pagy_url_for(page, pagy, path_or_url=:path)
15
+ def pagy_url_for(page, pagy, url=false)
16
16
  p_vars = pagy.vars; params = request.GET.merge(p_vars[:params]); params[p_vars[:page_param].to_s] = page
17
- "#{request.send(path_or_url)}?#{Rack::Utils.build_nested_query(pagy_get_params(params))}#{p_vars[:anchor]}"
17
+ "#{request.base_url if url}#{request.path}?#{Rack::Utils.build_nested_query(pagy_get_params(params))}#{p_vars[:anchor]}"
18
18
  end
19
19
 
20
20
  # Sub-method called only by #pagy_url_for: here for easy customization of params by overriding
data/lib/pagy.rb CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  require 'pathname'
6
6
 
7
- class Pagy ; VERSION = '2.1.4'
7
+ class Pagy ; VERSION = '2.1.5'
8
8
 
9
9
  class OverflowError < StandardError; attr_reader :pagy; def initialize(pagy) @pagy = pagy end; end
10
10
 
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: 2.1.4
4
+ version: 2.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Domizio Demichelis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-03-25 00:00:00.000000000 Z
11
+ date: 2019-03-29 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,
@@ -37,8 +37,9 @@ files:
37
37
  - lib/locales/utils/i18n.rb
38
38
  - lib/locales/utils/loader.rb
39
39
  - lib/locales/utils/p11n.rb
40
- - lib/locales/zh-cn.yml
41
- - lib/locales/zh-hk.yml
40
+ - lib/locales/zh-CN.yml
41
+ - lib/locales/zh-HK.yml
42
+ - lib/locales/zh-TW.yml
42
43
  - lib/pagy.rb
43
44
  - lib/pagy/backend.rb
44
45
  - lib/pagy/countless.rb