pagy 3.7.3 → 3.7.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 94c03adb9b45ec8718cf2541a03bf7d24eeb4a50bd8ea904397f4414cf888a05
4
- data.tar.gz: 23502a3be34f3251ffde3a6ad0e4fb3bf896ed87c9945fee5c19d52ee95b1c01
3
+ metadata.gz: e979c20b3707bfa08719b0fca92c4af61815ef525a9473e73ca2ae7e90fb1edf
4
+ data.tar.gz: 70fbef96ca45c915f18f47a5e37ecd6c42c2721a808c07c6c7b4c295cc35e501
5
5
  SHA512:
6
- metadata.gz: e61129fb99a6eb80dad7e229b6e160d88b5ff44e64dca48b03e7419672df191f602fbd64a03ad600c05a282ce8b9fbced6a56526b092cf44e240e7b6fe5d1465
7
- data.tar.gz: 451e59f3750d2eca6f704b0643f2c5afe84a56af504fee65e214d897ed5c81e0f38e04206086eb26acdab6db76d9f4c639698687c596508c67ce68f18e210477
6
+ metadata.gz: f46df19bef1296acd3288e2bcc73dcc6824866ea6abb2ccb31629a4e511baad027dfbba4433cb768291d0c6268221e4e2f3ae32012edb3c0f28c4cbd21798115
7
+ data.tar.gz: f2b696abd64a438b605304c142c6dd37f2c2a8039cbb002d8959712784a6d072073165df64485250067f0a8b1b6df6ba1efccd3c02459e5e954b0902b9246cb1
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
  # frozen_string_literal: true
3
3
 
4
- # Pagy initializer file (3.7.3)
4
+ # Pagy initializer file (3.7.4)
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
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  function Pagy(){}
4
4
 
5
- Pagy.version = '3.7.3';
5
+ Pagy.version = '3.7.4';
6
6
 
7
7
  Pagy.init = function(arg){
8
8
  var target = arg instanceof Event || arg === undefined ? document : arg,
@@ -1,6 +1,6 @@
1
1
  # :one_other pluralization (see https://github.com/ddnexus/pagy/blob/master/lib/locales/utils/p11n.rb)
2
2
 
3
- pt-br:
3
+ pt-BR:
4
4
  pagy:
5
5
 
6
6
  item_name:
@@ -0,0 +1,23 @@
1
+ # :one_two_other pluralization (see https://github.com/ddnexus/pagy/blob/master/lib/locales/utils/p11n.rb)
2
+
3
+ sv-SE:
4
+ pagy:
5
+
6
+ item_name:
7
+ one: "resultat"
8
+ two: "resultat"
9
+ other: "resultat"
10
+
11
+ nav:
12
+ prev: "‹ Föregående"
13
+ next: "Nästa ›"
14
+ gap: "…"
15
+
16
+ info:
17
+ no_items: "Inga %{item_name} hittade"
18
+ single_page: "Visar <b>%{count}</b> %{item_name}"
19
+ multiple_pages: "Visar %{item_name} <b>%{from}-%{to}</b> av <b>%{count}</b> totalt"
20
+
21
+ combo_nav_js: "Sida %{page_input} av %{pages}"
22
+
23
+ items_selector_js: "Visa %{items_input} %{item_name} per sida"
@@ -1,6 +1,6 @@
1
1
  # :one_two_other pluralization (see https://github.com/ddnexus/pagy/blob/master/lib/locales/utils/p11n.rb)
2
2
 
3
- se:
3
+ sv:
4
4
  pagy:
5
5
 
6
6
  item_name:
@@ -4,15 +4,22 @@
4
4
 
5
5
  # this file returns the I18n hash used as default alternative to the i18n gem
6
6
 
7
- Hash.new{|h,_| h.first[1]}.tap do |i18n| # first loaded locale used as default
8
- i18n.define_singleton_method(:load) do |*args|
7
+ Pagy::DEPRECATED_LOCALES = {'pt-br' =>'pt-BR', 'se' => 'sv-SE'}
8
+
9
+ Hash.new{|h,_| h.first[1]}.tap do |i18n_hash| # first loaded locale used as default
10
+ i18n_hash.define_singleton_method(:load) do |*load_args|
9
11
  # eval: we don't need to keep the loader proc in memory
10
- eval(Pagy.root.join('locales', 'utils', 'loader.rb').read).call(i18n, *args) #rubocop:disable Security/Eval
12
+ eval(Pagy.root.join('locales', 'utils', 'loader.rb').read).call(i18n_hash, *load_args) #rubocop:disable Security/Eval
11
13
  end
12
- i18n.define_singleton_method(:t) do |locale, path, vars={}|
14
+ i18n_hash.define_singleton_method(:t) do |locale, path, vars={}|
15
+ if Pagy::DEPRECATED_LOCALES.key?(locale)
16
+ new_locale = Pagy::DEPRECATED_LOCALES[locale]
17
+ $stderr.puts("WARNING: the Pagy locale '#{locale}' is deprecated; use '#{new_locale}' instead")
18
+ locale = new_locale
19
+ end
13
20
  data, pluralize = self[locale]
14
21
  translate = data[path] || vars[:count] && data[path+=".#{pluralize.call(vars[:count])}"] or return %([translation missing: "#{path}"])
15
22
  translate.call(vars)
16
23
  end
17
- i18n.load(locale: 'en')
24
+ i18n_hash.load(locale: 'en')
18
25
  end
@@ -20,6 +20,11 @@ flatten = lambda do |hash, key=''|
20
20
  lambda do |i18n, *args|
21
21
  i18n.clear
22
22
  args.each do |arg|
23
+ if Pagy::DEPRECATED_LOCALES.key?(arg[:locale])
24
+ new_locale = Pagy::DEPRECATED_LOCALES[arg[:locale]]
25
+ $stderr.puts("WARNING: the Pagy locale '#{arg[:locale]}' is deprecated; use '#{new_locale}' instead")
26
+ arg[:locale] = new_locale
27
+ end
23
28
  arg[:filepath] ||= Pagy.root.join('locales', "#{arg[:locale]}.yml")
24
29
  arg[:pluralize] ||= plurals[arg[:locale]]
25
30
  hash = YAML.load(File.read(arg[:filepath], encoding: 'UTF-8')) #rubocop:disable Security/YAMLLoad
@@ -60,14 +60,15 @@ p11n = {
60
60
  # The default pluralization for locales not explicitly listed here
61
61
  # is the :one_other pluralization proc (used for English)
62
62
  plurals = Hash.new(p11n[:one_other]).tap do |hash|
63
- hash['id'] = p11n[:other]
64
- hash['fr'] = p11n[:one_upto_two_other]
65
- hash['ja'] = p11n[:other]
66
- hash['ko'] = p11n[:other]
67
- hash['pl'] = p11n[:polish]
68
- hash['ru'] = p11n[:east_slavic]
69
- hash['se'] = p11n[:one_two_other]
70
- hash['tr'] = p11n[:other]
63
+ hash['id'] = p11n[:other]
64
+ hash['fr'] = p11n[:one_upto_two_other]
65
+ hash['ja'] = p11n[:other]
66
+ hash['ko'] = p11n[:other]
67
+ hash['pl'] = p11n[:polish]
68
+ hash['ru'] = p11n[:east_slavic]
69
+ hash['sv'] = p11n[:one_two_other]
70
+ hash['sv-SE'] = p11n[:one_two_other]
71
+ hash['tr'] = p11n[:other]
71
72
  hash['zh-CN'] = p11n[:other]
72
73
  hash['zh-HK'] = p11n[:other]
73
74
  hash['zh-TW'] = p11n[:other]
@@ -4,7 +4,7 @@
4
4
 
5
5
  require 'pathname'
6
6
 
7
- class Pagy ; VERSION = '3.7.3'
7
+ class Pagy ; VERSION = '3.7.4'
8
8
 
9
9
  # Root pathname to get the path of Pagy files like templates or dictionaries
10
10
  def self.root; @root ||= Pathname.new(__FILE__).dirname.freeze end
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: 3.7.3
4
+ version: 3.7.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Domizio Demichelis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-02-11 00:00:00.000000000 Z
11
+ date: 2020-03-23 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,
@@ -36,9 +36,10 @@ files:
36
36
  - lib/locales/nb.yml
37
37
  - lib/locales/nl.yml
38
38
  - lib/locales/pl.yml
39
- - lib/locales/pt-br.yml
39
+ - lib/locales/pt-BR.yml
40
40
  - lib/locales/ru.yml
41
- - lib/locales/se.yml
41
+ - lib/locales/sv-SE.yml
42
+ - lib/locales/sv.yml
42
43
  - lib/locales/tr.yml
43
44
  - lib/locales/utils/i18n.rb
44
45
  - lib/locales/utils/loader.rb