pagy 0.19.4 → 0.20.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: 1ebd88dd8d6c3296619f85da10c32cbe324dcfc6fde4b05835fba59c347e8549
4
- data.tar.gz: 50830d329a8adb1cba1890524ce4b7f8309628b02189a2d0891d30f5f24374b2
3
+ metadata.gz: 575c195847961ea0480d52ab96a6a1cff02684261069c254979437596d443244
4
+ data.tar.gz: 52a796fa7f8c7323a5445082f24d0ebbd77ee7931870af203836ee3fe686ab36
5
5
  SHA512:
6
- metadata.gz: 01f5de145efd5ca482eb0c8e7f82ae62438ef7c4547d8492b0837b4de3b2d9baf02a0366281f447930a52d97b405a3587e6dd578e653f133f13e2e4ab55a3cec
7
- data.tar.gz: 454dba7421ee82dde42a71101a587f120120c0e2822863da805e61787baa47908fffb01aed574d91bf1a6bfc062222275f453c41805cd9b6c786e8ab329d6ca9
6
+ metadata.gz: f907980d15f3056b660ee7acf17fa2f414ad2b1e2b0eca4538aa1c79103ffe052a7b0fa47a31e11258f68f3d74d0042768bb19683edec6e273832cea2c5bf733
7
+ data.tar.gz: 444b734960e91e64fc1d115a71e50a2d729fd93f1c99da97cd6c8e364d0bfcae26bc1dd5f24b9d7c44e2aee0b19d21a0b39f3e18f7cc48554b0853f87ef9f3b1
@@ -101,8 +101,9 @@
101
101
  # I18n: faster internal pagy implementation (does not use the I18n gem)
102
102
  # Use only for single language apps that don't need dynamic translation between multiple languages
103
103
  # See https://ddnexus.github.io/pagy/api/frontend#i18n
104
- # Notice: Do not use the following 2 lines if you use the i18n extra below
105
- # Pagy::Frontend::I18N.load(file:'path/to/dictionary.yml', language:'en') # load a custom file
104
+ # Notice: Do not use any of the following lines if you use the i18n extra below
105
+ # Pagy::Frontend::I18N.load(file: Pagy.root.join('locale', 'es.yml'), language:'es') # load 'es' pagy language file
106
+ # Pagy::Frontend::I18N.load(file:'path/to/dictionary.yml', language:'en') # load a custom 'en' file
106
107
  # Pagy::Frontend::I18N[:plural] = -> (count) {(['zero', 'one'][count] || 'other')} # default
107
108
 
108
109
  # I18n: Use the `I18n` gem instead of the pagy implementation
@@ -0,0 +1,20 @@
1
+ en:
2
+ pagy:
3
+ nav:
4
+ prev: "‹ Prev"
5
+ next: "Next ›"
6
+ gap: "…"
7
+ info:
8
+ single_page:
9
+ zero: "No %{item_name} found"
10
+ one: "Displaying <b>1</b> %{item_name}"
11
+ other: "Displaying <b>all %{count}</b> %{item_name}"
12
+ multiple_pages: "Displaying %{item_name} <b>%{from}-%{to}</b> of <b>%{count}</b> in total"
13
+ item_name:
14
+ zero: "items"
15
+ one: "item"
16
+ other: "items"
17
+ compact: "Page %{page_input} of %{pages}"
18
+ items:
19
+ one: "Show %{items_input} item per page"
20
+ other: "Show %{items_input} items per page"
@@ -0,0 +1,20 @@
1
+ es:
2
+ pagy:
3
+ nav:
4
+ prev: "&lsaquo;&nbsp;Prev"
5
+ next: "Siguiente&nbsp;&rsaquo;"
6
+ gap: "&hellip;"
7
+ info:
8
+ single_page:
9
+ zero: "Sin resultados"
10
+ one: "Mostrando 1 %{item_name}"
11
+ other: "Mostrando %{count} %{item_name}"
12
+ multiple_pages: "Mostrando %{item_name} %{from}-%{to} de %{count} en total"
13
+ item_name:
14
+ zero: "ítems"
15
+ one: "ítem"
16
+ other: "ítems"
17
+ compact: "Página %{page_input} de %{pages}"
18
+ items:
19
+ one: "Mostrar %{items_input} ítem por página"
20
+ other: "Mostrar %{items_input} ítems por página"
@@ -0,0 +1,20 @@
1
+ id:
2
+ pagy:
3
+ nav:
4
+ prev: "&lsaquo;&nbsp;Balik"
5
+ next: "Lanjut&nbsp;&rsaquo;"
6
+ gap: "&hellip;"
7
+ info:
8
+ single_page:
9
+ zero: "Tidak ditemukan %{item_name}"
10
+ one: "Menampilkan <b>1</b> %{item_name}"
11
+ other: "Menampilkan <b>semua %{count}</b> %{item_name}"
12
+ multiple_pages: "Menampilkan %{item_name} <b>%{from}-%{to}</b> dari total <b>%{count}</b>"
13
+ item_name:
14
+ zero: "item"
15
+ one: "item"
16
+ other: "item"
17
+ compact: "Halaman %{page_input} dari %{pages}"
18
+ items:
19
+ one: "Tampilkan %{items_input} item per halaman"
20
+ other: "Tampilkan %{items_input} item per halaman"
@@ -0,0 +1,20 @@
1
+ ja:
2
+ pagy:
3
+ nav:
4
+ prev: "&lsaquo;&nbsp;前へ"
5
+ next: "次へ&nbsp;&rsaquo;"
6
+ gap: "&hellip;"
7
+ info:
8
+ single_page:
9
+ zero: "見つかりませんでした"
10
+ one: "<b>1</b> 件の%{item_name}"
11
+ other: "<b>%{count}</b> 件の%{item_name}"
12
+ multiple_pages: "<b>%{count}</b> 件中 <b>%{from}-%{to}</b> 件目の%{item_name}を表示中"
13
+ item_name:
14
+ zero: "結果"
15
+ one: "結果"
16
+ other: "結果"
17
+ compact: "%{page_input} / %{pages} ページ"
18
+ items:
19
+ one: "%{items_input} 件ずつ表示"
20
+ other: "%{items_input} 件ずつ表示"
@@ -3,13 +3,25 @@
3
3
  # frozen_string_literal: true
4
4
 
5
5
  # utility variables
6
- zero_one = ['zero', 'one']
6
+ zero_one = ['zero', 'one']
7
+ from2to4 = (2..4)
8
+ from5to9 = (5..9)
9
+ from11to14 = (11..14)
10
+ from12to14 = (12..14)
7
11
 
8
12
  # Plurals
9
13
  # A plural proc returns a plural type string based on the passed count
10
14
  # Each plural proc may apply to one or more languages below
11
15
  plurals = {
12
- zero_one_other: -> (count) {zero_one[count] || 'other'}
16
+ zero_one_other: -> (count) {zero_one[count] || 'other'},
17
+ one_few_many_other: -> (count) do
18
+ mod10, mod100 = count % 10, count % 100
19
+ if mod10 == 1 && mod100 != 11 ; 'one'
20
+ elsif from2to4.cover?(mod10) && !from12to14.cover?(mod100) ; 'few'
21
+ elsif mod10 == 0 || from5to9.cover?(mod10) || from11to14.cover?(mod100) ; 'many'
22
+ else 'other'
23
+ end
24
+ end
13
25
  }
14
26
 
15
27
  # Languages (language/plural pairs)
@@ -17,7 +29,7 @@ plurals = {
17
29
  # The default plural for missing languages is the :zero_one_other plural (used for English)
18
30
  Hash.new(plurals[:zero_one_other]).tap do |languages|
19
31
  languages['en'] = plurals[:zero_one_other]
20
-
21
- # PR for other languages and plurals are very welcome. Thanks!
22
-
32
+ languages['ru'] = plurals[:one_few_many_other]
23
33
  end
34
+
35
+ # PR for other languages and plurals are very welcome. Thanks!
@@ -0,0 +1,20 @@
1
+ pt-br:
2
+ pagy:
3
+ nav:
4
+ prev: "&lsaquo;&nbsp;Anterior"
5
+ next: "Próximo&nbsp;&rsaquo;"
6
+ gap: "&hellip;"
7
+ info:
8
+ single_page:
9
+ zero: "Sem resultados"
10
+ one: "Mostrando 1 %{item_name}"
11
+ other: "Mostrando %{count} %{item_name}"
12
+ multiple_pages: "Mostrando %{item_name} %{from}-%{to} no total de %{count}"
13
+ item_name:
14
+ zero: "itens"
15
+ one: "item"
16
+ other: "itens"
17
+ compact: "Página %{page_input} de %{pages}"
18
+ items:
19
+ one: "Mostrar %{items_input} iten por página"
20
+ other: "Mostrar %{items_input} itens por página"
@@ -0,0 +1,25 @@
1
+ ru:
2
+ pagy:
3
+ nav:
4
+ prev: "&lsaquo;&nbsp;Назад"
5
+ next: "Вперёд&nbsp;&rsaquo;"
6
+ gap: "&hellip;"
7
+ info:
8
+ single_page:
9
+ zero: "Пока %{item_name} нет"
10
+ one: "<b>1</b> %{item_name}"
11
+ few: "<b>%{count}</b> %{item_name}"
12
+ many: "Всего <b>%{count}</b> %{item_name}"
13
+ other: "Всего <b>%{count}</b> %{item_name}"
14
+ multiple_pages: "Всего <b>%{count}</b> %{item_name}, показаны с <b>%{from}</b> по <b>%{to}</b>"
15
+ item_name:
16
+ one: "запись"
17
+ few: "записи"
18
+ many: "записей"
19
+ other: "записей"
20
+ compact: "Страница %{page_input} из %{pages}"
21
+ items:
22
+ one: "Показать %{items_input} записей на странице"
23
+ few: "Показать %{items_input} записей на странице"
24
+ many: "Показать %{items_input} записей на странице"
25
+ other: "Показать %{items_input} записей на странице"
@@ -0,0 +1,20 @@
1
+ tr:
2
+ pagy:
3
+ nav:
4
+ prev: "&lsaquo;&nbsp;Önceki"
5
+ next: "Sonraki&nbsp;&rsaquo;"
6
+ gap: "&hellip;"
7
+ info:
8
+ single_page:
9
+ zero: "Hiç %{item_name} bulunamadı."
10
+ one: "<b>1</b> %{item_name} gösteriliyor."
11
+ other: "Toplam <b>%{count}</b> %{item_name} gösteriliyor."
12
+ multiple_pages: "<b>%{count}</b> %{item_name} içerisinden <b>%{from}-%{to}</b> kadarı gösteriliyor."
13
+ item_name:
14
+ zero: "kayıt"
15
+ one: "kayıt"
16
+ other: "kayıt"
17
+ compact: "Sayfa %{page_input} / %{pages}"
18
+ items:
19
+ one: "Sayfada %{items_input} kayıt göster"
20
+ other: "Sayfada %{items_input} kayıt göster"
@@ -0,0 +1,20 @@
1
+ zh-cn:
2
+ pagy:
3
+ nav:
4
+ prev: "&lsaquo;&nbsp;上一页"
5
+ next: "下一页&nbsp;&rsaquo;"
6
+ gap: "&hellip;"
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} 条"
@@ -3,7 +3,7 @@
3
3
 
4
4
  require 'pathname'
5
5
 
6
- class Pagy ; VERSION = '0.19.4'
6
+ class Pagy ; VERSION = '0.20.0'
7
7
 
8
8
  class OutOfRangeError < StandardError; attr_reader :pagy; def initialize(pagy) @pagy = pagy end; end
9
9
 
@@ -35,7 +35,7 @@ class Pagy
35
35
  html << (p_prev ? link.call(p_prev, pagy_t('pagy.nav.prev'), 'aria-label="previous" class="prev btn btn-primary"')
36
36
  : %(<a class="prev btn btn-primary disabled" href="#">#{pagy_t('pagy.nav.prev')}</a>))
37
37
  input = %(<input type="number" min="1" max="#{p_pages}" value="#{p_page}" class="text-primary" style="padding: 0; border: none; text-align: center; width: #{p_pages.to_s.length+1}rem;">)
38
- html << %(<div class="pagy-compact-input btn btn-primary disabled">#{pagy_t('pagy.compact.page')} #{input} #{pagy_t('pagy.compact.of')} #{p_pages}</div>)
38
+ html << %(<div class="pagy-compact-input btn btn-primary disabled">#{pagy_t('pagy.compact', page_input: input, count: p_page, pages: p_pages)}</div>)
39
39
  html << (p_next ? link.call(p_next, pagy_t('pagy.nav.next'), 'aria-label="next" class="next btn btn-primary"')
40
40
  : %(<a class="next btn btn-primary disabled" href="#">#{pagy_t('pagy.nav.next')}</a>))
41
41
  html << %(</div></nav><script type="application/json" class="pagy-compact-json">["#{id}", "#{MARKER}", "#{p_page}", #{!!defined?(TRIM)}]</script>)
@@ -36,8 +36,8 @@ class Pagy
36
36
  html << %(<div class="field is-grouped is-grouped-centered" role="group">)
37
37
  html << (p_prev ? %(<p class="control">#{link.call(p_prev, pagy_t('pagy.nav.prev'), 'class="button" aria-label="previous page"')}</p>)
38
38
  : %(<p class="control"><a class="button" disabled>#{pagy_t('pagy.nav.prev')}</a></p>))
39
- input = %(<input class="input" type="number" min="1" max="#{p_pages}" value="#{p_page}" style="padding: 0; text-align: center; width: #{p_pages.to_s.length+1}rem;">)
40
- html << %(<div class="pagy-compact-input control level is-mobile">#{pagy_t('pagy.compact.page')}&nbsp;#{input}&nbsp;#{pagy_t('pagy.compact.of')} #{p_pages}</div>)
39
+ input = %(<input class="input" type="number" min="1" max="#{p_pages}" value="#{p_page}" style="padding: 0; text-align: center; width: #{p_pages.to_s.length+1}rem; margin:0 0.3rem;">)
40
+ html << %(<div class="pagy-compact-input control level is-mobile">#{pagy_t('pagy.compact', page_input: input, count: p_page, pages: p_pages)}</div>)
41
41
  html << (p_next ? %(<p class="control">#{link.call(p_next, pagy_t('pagy.nav.next'), 'class="button" aria-label="next page"')}</p>)
42
42
  : %(<p class="control"><a class="button" disabled>#{pagy_t('pagy.nav.next')}</a></p>))
43
43
  html << %(</div></nav><script type="application/json" class="pagy-compact-json">["#{id}", "#{MARKER}", "#{p_page}", #{!!defined?(TRIM)}]</script>)
@@ -13,9 +13,9 @@ class Pagy
13
13
  html << (p_prev ? %(<li class="prev">#{link.call p_prev, pagy_t('pagy.nav.prev'), 'aria-label="previous"'}</li>)
14
14
  : %(<li class="prev disabled">#{pagy_t('pagy.nav.prev')}</li>))
15
15
  pagy.series.each do |item| # series example: [1, :gap, 7, 8, "9", 10, 11, :gap, 36]
16
- html << if item.is_a?(Integer); %(<li>#{link.call item}</li>) # page link
17
- elsif item.is_a?(String) ; %(<li class="current"><span class="show-for-sr">#{pagy_t('pagy.nav.current')}</span> #{item}</li>) # active page
18
- elsif item == :gap ; %(<li class="ellipsis" aria-hidden="true"></li>) # page gap
16
+ html << if item.is_a?(Integer); %(<li>#{link.call item}</li>) # page link
17
+ elsif item.is_a?(String) ; %(<li class="current">#{item}</li>) # active page
18
+ elsif item == :gap ; %(<li class="ellipsis gap" aria-hidden="true"></li>) # page gap
19
19
  end
20
20
  end
21
21
  html << (p_next ? %(<li class="next">#{link.call p_next, pagy_t('pagy.nav.next'), 'aria-label="next"'}</li>)
@@ -34,8 +34,8 @@ class Pagy
34
34
  html << %(<div class="input-group">)
35
35
  html << (p_prev ? link.call(p_prev, pagy_t('pagy.nav.prev'), 'style="margin-bottom: 0px;" aria-label="previous" class="prev button primary"')
36
36
  : %(<a style="margin-bottom: 0px;" class="prev button primary disabled" href="#">#{pagy_t('pagy.nav.prev')}</a>))
37
- input = %(<input class="input-group-field cell shrink" type="number" min="1" max="#{p_pages}" value="#{p_page}" style="width: #{p_pages.to_s.length+1.5}rem;">)
38
- html << %(<span class="input-group-label">#{pagy_t('pagy.compact.page')}</span> #{input} <span class="input-group-label">#{pagy_t('pagy.compact.of')} #{p_pages}</span>)
37
+ input = %(<input class="input-group-field cell shrink" type="number" min="1" max="#{p_pages}" value="#{p_page}" style="width: #{p_pages.to_s.length+1}rem; padding: 0 0.3rem; margin: 0 0.3rem;">)
38
+ html << %(<span class="input-group-label">#{pagy_t('pagy.compact', page_input: input, count: p_page, pages: p_pages)}</span>)
39
39
  html << (p_next ? link.call(p_next, pagy_t('pagy.nav.next'), 'style="margin-bottom: 0px;" aria-label="next" class="next button primary"')
40
40
  : %(<a style="margin-bottom: 0px;" class="next button primary disabled" href="#">#{pagy_t('pagy.nav.next')}</a>))
41
41
  html << %(</div></nav><script type="application/json" class="pagy-compact-json">["#{id}", "#{MARKER}", "#{p_page}", #{!!defined?(TRIM)}]</script>)
@@ -50,9 +50,9 @@ class Pagy
50
50
  tags['before'] << (p_prev ? %(<li class="prev">#{link.call p_prev, pagy_t('pagy.nav.prev'), 'aria-label="previous"'}</li>)
51
51
  : %(<li class="prev disabled">#{pagy_t('pagy.nav.prev')}</li>))
52
52
  responsive[:items].each do |item| # series example: [1, :gap, 7, 8, "9", 10, 11, :gap, 36]
53
- tags[item.to_s] = if item.is_a?(Integer); %(<li>#{link.call item}</li>) # page link
54
- elsif item.is_a?(String) ; %(<li class="current"><span class="show-for-sr">#{pagy_t('pagy.nav.current')}</span> #{item}</li>) # active page
55
- elsif item == :gap ; %(<li class="gap disabled">#{pagy_t('pagy.nav.gap')}</li>) # page gap
53
+ tags[item.to_s] = if item.is_a?(Integer); %(<li>#{link.call item}</li>) # page link
54
+ elsif item.is_a?(String) ; %(<li class="current">#{item}</li>) # active page
55
+ elsif item == :gap ; %(<li class="ellipsis gap" aria-hidden="true"></li>) # page gap
56
56
  end
57
57
  end
58
58
  tags['after'] = +(p_next ? %(<li class="next">#{link.call p_next, pagy_t('pagy.nav.next'), 'aria-label="next"'}</li>)
@@ -4,7 +4,7 @@ class Pagy
4
4
  # Use ::I18n gem
5
5
  module Frontend
6
6
 
7
- ::I18n.load_path << Pagy.root.join('locales', 'pagy.yml')
7
+ ::I18n.load_path += Dir[Pagy.root.join('locales', '*.yml')]
8
8
 
9
9
  # Override the built-in pagy_t
10
10
  def pagy_t(*args)
@@ -36,7 +36,7 @@ class Pagy
36
36
  html = +%(<span id="pagy-items-#{id}">)
37
37
  html << %(<a href="#{pagy_url_for("#{MARKER}-page-", pagy)}"></a>)
38
38
  input = %(<input type="number" min="1" max="#{p_vars[:max_items]}" value="#{p_items}" style="padding: 0; text-align: center; width: #{p_items.to_s.length+1}rem;">)
39
- html << %(#{pagy_t('pagy.items.show')} #{input} #{pagy_t('pagy.items.items')})
39
+ html << %(#{pagy_t('pagy.items', items_input: input, count: p_items)})
40
40
  html << %(</span><script type="application/json" class="pagy-items-json">["#{id}", "#{MARKER}", #{pagy.from}]</script>)
41
41
  end
42
42
 
@@ -36,7 +36,7 @@ class Pagy
36
36
  html << (p_prev ? %(<li class="waves-effect prev" #{li_style}>#{link.call p_prev, '<i class="material-icons">chevron_left</i>', 'aria-label="previous"'}</li>)
37
37
  : %(<li class="prev disabled" #{li_style}><a href="#"><i class="material-icons">chevron_left</i></a></li>))
38
38
  input = %(<input type="number" class="browser-default" min="1" max="#{p_pages}" value="#{p_page}" style="padding: 2px; border: none; border-radius: 2px; text-align: center; width: #{p_pages.to_s.length+1}rem;">)
39
- html << %(<div class="pagy-compact-input btn-flat" style="cursor: default; padding: 0px">#{pagy_t('pagy.compact.page')} #{input} #{pagy_t('pagy.compact.of')} #{p_pages}</div>)
39
+ html << %(<div class="pagy-compact-input btn-flat" style="cursor: default; padding: 0px">#{pagy_t('pagy.compact', page_input: input, count: p_page, pages: p_pages)}</div>)
40
40
  html << (p_next ? %(<li class="waves-effect next" #{li_style}>#{link.call p_next, '<i class="material-icons">chevron_right</i>', 'aria-label="next"'}</li>)
41
41
  : %(<li class="next disabled" #{li_style}><a href="#"><i class="material-icons">chevron_right</i></a></li>))
42
42
  html << %(</ul></div><script type="application/json" class="pagy-compact-json">["#{id}", "#{MARKER}", "#{p_page}", #{!!defined?(TRIM)}]</script>)
@@ -17,7 +17,7 @@ class Pagy
17
17
  html << (p_prev ? %(<span class="page prev">#{link.call p_prev, pagy_t('pagy.nav.prev'), 'aria-label="previous"'}</span> )
18
18
  : %(<span class="page prev disabled">#{pagy_t('pagy.nav.prev')}</span> ))
19
19
  input = %(<input type="number" min="1" max="#{p_pages}" value="#{p_page}" style="padding: 0; text-align: center; width: #{p_pages.to_s.length+1}rem;">)
20
- html << %(<span class="pagy-compact-input" style="margin: 0 0.6rem;">#{pagy_t('pagy.compact.page')} #{input} #{pagy_t('pagy.compact.of')} #{p_pages}</span> )
20
+ html << %(<span class="pagy-compact-input" style="margin: 0 0.6rem;">#{pagy_t('pagy.compact', page_input: input, count: p_page, pages: p_pages)}</span> )
21
21
  html << (p_next ? %(<span class="page next">#{link.call p_next, pagy_t('pagy.nav.next'), 'aria-label="next"'}</span>)
22
22
  : %(<span class="page next disabled">#{pagy_t('pagy.nav.next')}</span>))
23
23
  html << %(</nav><script type="application/json" class="pagy-compact-json">["#{id}", "#{MARKER}", "#{p_page}", #{!!defined?(TRIM)}]</script>)
@@ -33,8 +33,8 @@ class Pagy
33
33
  (html << link.call(1, '', %(style="display: none;" ))) if defined?(TRIM)
34
34
  html << (p_prev ? %(#{link.call p_prev, '<i class="left small chevron icon"></i>', 'aria-label="previous"'})
35
35
  : %(<div class="item disabled"><i class="left small chevron icon"></i></div>))
36
- input = %(<input type="number" min="1" max="#{p_pages}" value="#{p_page}" style="padding: 0; text-align: center; width: #{p_pages.to_s.length+1}rem;">)
37
- html << %(<div class="pagy-compact-input item">#{pagy_t('pagy.compact.page')}&nbsp;#{input}&nbsp;#{pagy_t('pagy.compact.of')} #{p_pages}</div> )
36
+ input = %(<input type="number" min="1" max="#{p_pages}" value="#{p_page}" style="padding: 0; text-align: center; width: #{p_pages.to_s.length+1}rem; margin: 0 0.3rem">)
37
+ html << %(<div class="pagy-compact-input item">#{pagy_t('pagy.compact', page_input: input, count: p_page, pages: p_pages)}</div> )
38
38
  html << (p_next ? %(#{link.call p_next, '<i class="right small chevron icon"></i>', 'aria-label="next"'})
39
39
  : %(<div class="item disabled"><i class="right small chevron icon"></i></div>))
40
40
  html << %(</div><script type="application/json" class="pagy-compact-json">["#{id}", "#{MARKER}", "#{p_page}", #{!!defined?(TRIM)}]</script>)
@@ -55,7 +55,7 @@ class Pagy
55
55
  end
56
56
 
57
57
  # Pagy::Frontend::I18N
58
- def (I18N = {data:{}}).load(file:Pagy.root.join('locales', 'pagy.yml'), language: 'en')
58
+ def (I18N = {data:{}}).load(file:Pagy.root.join('locales', 'en.yml'), language: 'en')
59
59
  self[:data] = YAML.load_file(file)[language]
60
60
  self[:plural] = eval(Pagy.root.join('locales', 'plurals.rb').read)[language] #rubocop:disable Security/Eval
61
61
  end; I18N.load
@@ -13,8 +13,8 @@
13
13
  <% end -%>
14
14
  <% pagy.series.each do |item| # series example: [1, :gap, 7, 8, "9", 10, 11, :gap, 36] -%>
15
15
  <% if item.is_a?(Integer) -%> <li><%== link.call(item) %></li>
16
- <% elsif item.is_a?(String) -%> <li class="current"><span class="show-for-sr"><%== pagy_t('pagy.nav.current')%></span> <%= item %></li>
17
- <% elsif item == :gap -%> <li class="disabled gap"><%== pagy_t('pagy.nav.gap') %></li>
16
+ <% elsif item.is_a?(String) -%> <li class="current"><%= item %></li>
17
+ <% elsif item == :gap -%> <li class="ellipsis gap" aria-hidden="true"></li>
18
18
  <% end -%>
19
19
  <% end -%>
20
20
  <% if pagy.next -%> <li class="next"><%== link.call(pagy.next, pagy_t('pagy.nav.next'), 'aria-label="next"') %></li>
@@ -22,13 +22,10 @@
22
22
 
23
23
  - elsif item.is_a?(String) # current page
24
24
  %li.current
25
- %span.show-for-sr
26
- != pagy_t('pagy.nav.current')
27
- != item
25
+ = item
28
26
 
29
27
  - elsif item == :gap # page gap
30
- %li.disabled.gap
31
- != pagy_t('pagy.nav.gap')
28
+ %li.ellipsis.gap{"aria-hidden" => true}
32
29
 
33
30
  - if pagy.next
34
31
  %li.next!= link.call(pagy.next, pagy_t('pagy.nav.next'), 'aria-label="next"')
@@ -22,13 +22,10 @@ nav.pagy-nav-foundation role="navigation" aria-label="Pagination"
22
22
 
23
23
  - elsif item.is_a?(String) # current page
24
24
  li.current
25
- span.show-for-sr
26
- == pagy_t('pagy.nav.current')
27
25
  = item
28
26
 
29
27
  - elsif item == :gap # page gap
30
- li.disabled.gap
31
- == pagy_t('pagy.nav.gap')
28
+ li.ellipsis.gap aria-hidden="true"
32
29
 
33
30
  - if pagy.next
34
31
  li.next == link.call(pagy.next, pagy_t('pagy.nav.next'), 'aria-label="next"')
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.19.4
4
+ version: 0.20.0
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-09-29 00:00:00.000000000 Z
11
+ date: 2018-10-02 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,
@@ -23,8 +23,15 @@ files:
23
23
  - LICENSE.txt
24
24
  - lib/config/pagy.rb
25
25
  - lib/javascripts/pagy.js
26
- - lib/locales/pagy.yml
26
+ - lib/locales/en.yml
27
+ - lib/locales/es.yml
28
+ - lib/locales/id.yml
29
+ - lib/locales/ja.yml
27
30
  - lib/locales/plurals.rb
31
+ - lib/locales/pt-br.yml
32
+ - lib/locales/ru.yml
33
+ - lib/locales/tr.yml
34
+ - lib/locales/zh-cn.yml
28
35
  - lib/pagy.rb
29
36
  - lib/pagy/backend.rb
30
37
  - lib/pagy/extras/array.rb
@@ -1,188 +0,0 @@
1
- # Standard pagy dictionary
2
-
3
- en:
4
- pagy:
5
- nav:
6
- prev: "&lsaquo;&nbsp;Prev"
7
- next: "Next&nbsp;&rsaquo;"
8
- gap: "&hellip;"
9
- current: "You're on page"
10
- info:
11
- single_page:
12
- zero: "No %{item_name} found"
13
- one: "Displaying <b>1</b> %{item_name}"
14
- other: "Displaying <b>all %{count}</b> %{item_name}"
15
- multiple_pages: "Displaying %{item_name} <b>%{from}-%{to}</b> of <b>%{count}</b> in total"
16
- item_name:
17
- zero: "items"
18
- one: "item"
19
- other: "items"
20
- compact:
21
- page: "Page"
22
- of: "of"
23
- items:
24
- show: "Show"
25
- items: "items per page"
26
- es:
27
- pagy:
28
- nav:
29
- prev: "&lsaquo;&nbsp;Prev"
30
- next: "Siguiente&nbsp;&rsaquo;"
31
- gap: "&hellip;"
32
- current: "Estás en la página"
33
- info:
34
- single_page:
35
- zero: "Sin resultados"
36
- one: "Mostrando 1 %{item_name}"
37
- other: "Mostrando %{count} %{item_name}"
38
- multiple_pages: "Mostrando %{item_name} %{from}-%{to} de %{count} en total"
39
- item_name:
40
- zero: "ítems"
41
- one: "ítem"
42
- other: "ítems"
43
- compact:
44
- page: "Página"
45
- of: "de"
46
- items:
47
- show: "Mostrar"
48
- items: "ítems por página"
49
- id:
50
- pagy:
51
- nav:
52
- prev: "&lsaquo;&nbsp;Balik"
53
- next: "Lanjut&nbsp;&rsaquo;"
54
- gap: "&hellip;"
55
- current: "Anda di halaman"
56
- info:
57
- single_page:
58
- zero: "Tidak ditemukan %{item_name}"
59
- one: "Menampilkan <b>1</b> %{item_name}"
60
- other: "Menampilkan <b>semua %{count}</b> %{item_name}"
61
- multiple_pages: "Menampilkan %{item_name} <b>%{from}-%{to}</b> dari total <b>%{count}</b>"
62
- item_name:
63
- zero: "item"
64
- one: "item"
65
- other: "item"
66
- compact:
67
- page: "Halaman"
68
- of: "dari"
69
- items:
70
- show: "Tampilkan"
71
- items: "item per halaman"
72
- ja:
73
- pagy:
74
- nav:
75
- prev: "&lsaquo;&nbsp;前へ"
76
- next: "次へ&nbsp;&rsaquo;"
77
- gap: "&hellip;"
78
- info:
79
- single_page:
80
- zero: "見つかりませんでした"
81
- one: "<b>1</b> 件の%{item_name}"
82
- other: "<b>%{count}</b> 件の%{item_name}"
83
- multiple_pages: "<b>%{count}</b> 件中 <b>%{from}-%{to}</b> 件目の%{item_name}を表示中"
84
- item_name:
85
- zero: "結果"
86
- one: "結果"
87
- other: "結果"
88
- compact:
89
- page: "ページ"
90
- of: "/"
91
- items:
92
- show: ""
93
- items: "件ずつ表示"
94
- pt-br:
95
- pagy:
96
- nav:
97
- prev: "&lsaquo;&nbsp;Anterior"
98
- next: "Próximo&nbsp;&rsaquo;"
99
- gap: "&hellip;"
100
- current: "Está na página"
101
- info:
102
- single_page:
103
- zero: "Sem resultados"
104
- one: "Mostrando 1 %{item_name}"
105
- other: "Mostrando %{count} %{item_name}"
106
- multiple_pages: "Mostrando %{item_name} %{from}-%{to} no total de %{count}"
107
- item_name:
108
- zero: "itens"
109
- one: "item"
110
- other: "itens"
111
- compact:
112
- page: "Página"
113
- of: "de"
114
- items:
115
- show: "Mostrar"
116
- items: "itens por página"
117
- ru:
118
- pagy:
119
- nav:
120
- prev: "&lsaquo;&nbsp;Назад"
121
- next: "Вперёд&nbsp;&rsaquo;"
122
- gap: "&hellip;"
123
- current: "Вы на странице"
124
- info:
125
- single_page:
126
- zero: "Пока %{item_name} нет"
127
- one: "<b>1</b> %{item_name}"
128
- few: "<b>%{count}</b> %{item_name}"
129
- many: "Всего <b>%{count}</b> %{item_name}"
130
- other: "Всего <b>%{count}</b> %{item_name}"
131
- multiple_pages: "Всего <b>%{count}</b> %{item_name}, показаны с <b>%{from}</b> по <b>%{to}</b>"
132
- item_name:
133
- one: "запись"
134
- few: "записи"
135
- many: "записей"
136
- other: "записей"
137
- compact:
138
- page: "Страница"
139
- of: "из"
140
- items:
141
- show: "Показать"
142
- items: "записей на странице"
143
- tr:
144
- pagy:
145
- nav:
146
- prev: "&lsaquo;&nbsp;Önceki"
147
- next: "Sonraki&nbsp;&rsaquo;"
148
- gap: "&hellip;"
149
- info:
150
- single_page:
151
- zero: "Hiç %{item_name} bulunamadı."
152
- one: "<b>1</b> %{item_name} gösteriliyor."
153
- other: "Toplam <b>%{count}</b> %{item_name} gösteriliyor."
154
- multiple_pages: "<b>%{count}</b> %{item_name} içerisinden <b>%{from}-%{to}</b> kadarı gösteriliyor."
155
- item_name:
156
- zero: "kayıt"
157
- one: "kayıt"
158
- other: "kayıt"
159
- compact:
160
- page: "Sayfa"
161
- of: "/"
162
- items:
163
- show: "Göster"
164
- items: "sayfa başı"
165
- zh-cn:
166
- pagy:
167
- nav:
168
- prev: "&lsaquo;&nbsp;上一页"
169
- next: "下一页&nbsp;&rsaquo;"
170
- gap: "&hellip;"
171
- info:
172
- single_page:
173
- zero: " %{item_name}未找到"
174
- one: "显示 <b>1</b> 条%{item_name}"
175
- other: "显示<b>所有 %{count}</b> 条%{item_name}"
176
- multiple_pages: "共 <b>%{count}</b> 条%{item_name},显示 <b>%{from}-%{to}</b>"
177
- item_name:
178
- zero: "项目"
179
- one: ""
180
- other: ""
181
- compact:
182
- page: "页面"
183
- of: "/"
184
- items:
185
- show: "每页显示"
186
- items: "条"
187
-
188
- # PR for other languages are very welcome. Thanks!