pagy 3.8.2 → 9.4.0

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.
Files changed (152) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.txt +1 -1
  3. data/apps/calendar.ru +737 -0
  4. data/apps/demo.ru +449 -0
  5. data/apps/index.rb +7 -0
  6. data/apps/keyset_ar.ru +228 -0
  7. data/apps/keyset_s.ru +220 -0
  8. data/apps/rails.ru +217 -0
  9. data/apps/repro.ru +182 -0
  10. data/bin/pagy +98 -0
  11. data/config/pagy.rb +220 -0
  12. data/javascripts/pagy.d.ts +5 -0
  13. data/javascripts/pagy.min.js +4 -0
  14. data/javascripts/pagy.min.js.map +10 -0
  15. data/javascripts/pagy.mjs +100 -0
  16. data/lib/optimist.rb +1022 -0
  17. data/lib/pagy/b64.rb +33 -0
  18. data/lib/pagy/backend.rb +30 -19
  19. data/lib/pagy/calendar/day.rb +41 -0
  20. data/lib/pagy/calendar/month.rb +42 -0
  21. data/lib/pagy/calendar/quarter.rb +49 -0
  22. data/lib/pagy/calendar/unit.rb +103 -0
  23. data/lib/pagy/calendar/week.rb +39 -0
  24. data/lib/pagy/calendar/year.rb +35 -0
  25. data/lib/pagy/calendar.rb +84 -0
  26. data/lib/pagy/console.rb +23 -0
  27. data/lib/pagy/countless.rb +27 -22
  28. data/lib/pagy/exceptions.rb +16 -13
  29. data/lib/pagy/extras/arel.rb +11 -14
  30. data/lib/pagy/extras/array.rb +12 -16
  31. data/lib/pagy/extras/bootstrap.rb +83 -41
  32. data/lib/pagy/extras/bulma.rb +79 -46
  33. data/lib/pagy/extras/calendar.rb +79 -0
  34. data/lib/pagy/extras/countless.rb +20 -25
  35. data/lib/pagy/extras/elasticsearch_rails.rb +59 -38
  36. data/lib/pagy/extras/gearbox.rb +55 -0
  37. data/lib/pagy/extras/headers.rb +38 -23
  38. data/lib/pagy/extras/i18n.rb +19 -18
  39. data/lib/pagy/extras/js_tools.rb +70 -0
  40. data/lib/pagy/extras/jsonapi.rb +88 -0
  41. data/lib/pagy/extras/keyset.rb +30 -0
  42. data/lib/pagy/extras/limit.rb +63 -0
  43. data/lib/pagy/extras/meilisearch.rb +57 -0
  44. data/lib/pagy/extras/metadata.rb +32 -27
  45. data/lib/pagy/extras/overflow.rb +61 -53
  46. data/lib/pagy/extras/pagy.rb +82 -0
  47. data/lib/pagy/extras/searchkick.rb +52 -41
  48. data/lib/pagy/extras/size.rb +40 -0
  49. data/lib/pagy/extras/standalone.rb +60 -0
  50. data/lib/pagy/extras/trim.rb +19 -13
  51. data/lib/pagy/frontend.rb +76 -51
  52. data/lib/pagy/i18n.rb +167 -0
  53. data/lib/pagy/keyset/active_record.rb +44 -0
  54. data/lib/pagy/keyset/sequel.rb +57 -0
  55. data/lib/pagy/keyset.rb +118 -0
  56. data/lib/pagy/shared_methods.rb +26 -0
  57. data/lib/pagy/url_helpers.rb +26 -0
  58. data/lib/pagy.rb +91 -37
  59. data/locales/ar.yml +29 -0
  60. data/locales/be.yml +25 -0
  61. data/locales/bg.yml +21 -0
  62. data/locales/bs.yml +25 -0
  63. data/locales/ca.yml +21 -0
  64. data/locales/ckb.yml +18 -0
  65. data/locales/cs.yml +23 -0
  66. data/locales/da.yml +21 -0
  67. data/locales/de.yml +21 -0
  68. data/locales/dz.yml +17 -0
  69. data/locales/en.yml +21 -0
  70. data/{lib/locales → locales}/es.yml +11 -12
  71. data/locales/fr.yml +21 -0
  72. data/locales/hr.yml +25 -0
  73. data/locales/id.yml +19 -0
  74. data/locales/it.yml +21 -0
  75. data/locales/ja.yml +19 -0
  76. data/locales/km.yml +19 -0
  77. data/locales/ko.yml +17 -0
  78. data/locales/nb.yml +21 -0
  79. data/locales/nl.yml +21 -0
  80. data/locales/nn.yml +21 -0
  81. data/locales/pl.yml +25 -0
  82. data/{lib/locales → locales}/pt-BR.yml +11 -12
  83. data/locales/pt.yml +21 -0
  84. data/locales/ru.yml +25 -0
  85. data/locales/sk.yml +23 -0
  86. data/locales/sr.yml +25 -0
  87. data/locales/sv-SE.yml +21 -0
  88. data/locales/sv.yml +21 -0
  89. data/locales/sw.yml +25 -0
  90. data/locales/ta.yml +21 -0
  91. data/locales/tr.yml +19 -0
  92. data/locales/uk.yml +25 -0
  93. data/locales/vi.yml +17 -0
  94. data/locales/zh-CN.yml +17 -0
  95. data/locales/zh-HK.yml +17 -0
  96. data/locales/zh-TW.yml +17 -0
  97. data/stylesheets/pagy.css +46 -0
  98. data/stylesheets/pagy.scss +48 -0
  99. data/stylesheets/pagy.tailwind.css +21 -0
  100. metadata +95 -67
  101. data/lib/config/pagy.rb +0 -170
  102. data/lib/javascripts/pagy.js +0 -106
  103. data/lib/locales/README.md +0 -35
  104. data/lib/locales/bg.yml +0 -22
  105. data/lib/locales/ca.yml +0 -22
  106. data/lib/locales/da.yml +0 -22
  107. data/lib/locales/de.yml +0 -22
  108. data/lib/locales/en.yml +0 -22
  109. data/lib/locales/fr.yml +0 -22
  110. data/lib/locales/id.yml +0 -20
  111. data/lib/locales/it.yml +0 -22
  112. data/lib/locales/ja.yml +0 -20
  113. data/lib/locales/km.yml +0 -19
  114. data/lib/locales/ko.yml +0 -20
  115. data/lib/locales/nb.yml +0 -22
  116. data/lib/locales/nl.yml +0 -22
  117. data/lib/locales/pl.yml +0 -24
  118. data/lib/locales/ru.yml +0 -24
  119. data/lib/locales/sv-SE.yml +0 -23
  120. data/lib/locales/sv.yml +0 -23
  121. data/lib/locales/tr.yml +0 -20
  122. data/lib/locales/utils/i18n.rb +0 -25
  123. data/lib/locales/utils/loader.rb +0 -34
  124. data/lib/locales/utils/p11n.rb +0 -80
  125. data/lib/locales/zh-CN.yml +0 -20
  126. data/lib/locales/zh-HK.yml +0 -20
  127. data/lib/locales/zh-TW.yml +0 -20
  128. data/lib/pagy/extras/foundation.rb +0 -57
  129. data/lib/pagy/extras/items.rb +0 -65
  130. data/lib/pagy/extras/materialize.rb +0 -59
  131. data/lib/pagy/extras/navs.rb +0 -38
  132. data/lib/pagy/extras/pagy_search.rb +0 -18
  133. data/lib/pagy/extras/semantic.rb +0 -55
  134. data/lib/pagy/extras/shared.rb +0 -53
  135. data/lib/pagy/extras/support.rb +0 -29
  136. data/lib/pagy/extras/uikit.rb +0 -62
  137. data/lib/templates/bootstrap_nav.html.erb +0 -24
  138. data/lib/templates/bootstrap_nav.html.haml +0 -34
  139. data/lib/templates/bootstrap_nav.html.slim +0 -34
  140. data/lib/templates/bulma_nav.html.erb +0 -24
  141. data/lib/templates/bulma_nav.html.haml +0 -32
  142. data/lib/templates/bulma_nav.html.slim +0 -32
  143. data/lib/templates/foundation_nav.html.erb +0 -24
  144. data/lib/templates/foundation_nav.html.haml +0 -34
  145. data/lib/templates/foundation_nav.html.slim +0 -34
  146. data/lib/templates/nav.html.erb +0 -22
  147. data/lib/templates/nav.html.haml +0 -30
  148. data/lib/templates/nav.html.slim +0 -29
  149. data/lib/templates/uikit_nav.html.erb +0 -15
  150. data/lib/templates/uikit_nav.html.haml +0 -28
  151. data/lib/templates/uikit_nav.html.slim +0 -28
  152. data/pagy.gemspec +0 -16
@@ -1,106 +0,0 @@
1
- // See the Pagy documentation: https://ddnexus.github.io/pagy/extras#javascript
2
-
3
- function Pagy(){}
4
-
5
- Pagy.version = '3.8.2';
6
-
7
- Pagy.init = function(arg){
8
- var target = arg instanceof Event || arg === undefined ? document : arg,
9
- jsonTags = target.getElementsByClassName('pagy-json');
10
- if (target === document) { // reset resize-listeners on page load (#163)
11
- for (var id in Pagy.navResizeListeners) { window.removeEventListener('resize', Pagy.navResizeListeners[id], true) }
12
- Pagy.navResizeListeners = {};
13
- }
14
- for (var i = 0, len = jsonTags.length; i < len; i++) {
15
- var args = JSON.parse(jsonTags[i].innerHTML);
16
- Pagy[args.shift()].apply(null, args);
17
- }
18
- };
19
-
20
- Pagy.nav = function(id, tags, sequels, param){
21
- var pagyEl = document.getElementById(id),
22
- lastWidth = undefined,
23
- timeoutId = 0,
24
- pageREg = new RegExp(/__pagy_page__/g),
25
- widths = [],
26
- rendering = function(){ clearTimeout(timeoutId); timeoutId = setTimeout(pagyEl.render, 150) }; // suppress rapid firing rendering
27
-
28
- for (var width in sequels) { widths.push(parseInt(width)) } // fine with sequels structure
29
- widths.sort(function(a, b){return b-a});
30
-
31
- pagyEl.render = function(){
32
- if (this.parentElement.clientWidth === 0) { rendering() }
33
- var width, i, len;
34
- for (i = 0, len = widths.length; i < len; i++) {
35
- if (this.parentElement.clientWidth > widths[i]) { width = widths[i]; break }
36
- }
37
- if (width !== lastWidth) {
38
- var html = tags.before,
39
- series = sequels[width];
40
- for (i = 0, len = series.length; i < len; i++) {
41
- var item = series[i];
42
- if (typeof(param) === 'string' && item === 1) { html += Pagy.trim(tags.link.replace(pageREg, item), param) }
43
- else if (typeof(item) === 'number') { html += tags.link.replace(pageREg, item) }
44
- else if (item === 'gap') { html += tags.gap }
45
- else if (typeof(item) === 'string') { html += tags.active.replace(pageREg, item) }
46
- }
47
- html += tags.after;
48
- this.innerHTML = '';
49
- this.insertAdjacentHTML('afterbegin', html);
50
- lastWidth = width;
51
- }
52
- }.bind(pagyEl);
53
-
54
- if (widths.length > 1) {
55
- // refresh the window resize listener (avoiding rendering multiple times)
56
- window.removeEventListener('resize', Pagy.navResizeListeners[id], true); // needed for AJAX init
57
- window.addEventListener('resize', rendering, true);
58
- Pagy.navResizeListeners[id] = rendering;
59
- }
60
- pagyEl.render();
61
- };
62
-
63
- Pagy.combo_nav = function(id, page, link, param){
64
- var pagyEl = document.getElementById(id),
65
- input = pagyEl.getElementsByTagName('input')[0],
66
- go = function(){
67
- if (page !== input.value) {
68
- var html = link.replace(/__pagy_page__/, input.value);
69
- if (typeof(param) === 'string' && input.value === '1') { html = Pagy.trim(html, param) }
70
- pagyEl.insertAdjacentHTML('afterbegin', html);
71
- pagyEl.getElementsByTagName('a')[0].click();
72
- }
73
- };
74
- Pagy.addInputEventListeners(input, go);
75
- };
76
-
77
- Pagy.items_selector = function(id, from, link, param){
78
- var pagyEl = document.getElementById(id),
79
- input = pagyEl.getElementsByTagName('input')[0],
80
- current = input.value,
81
- go = function(){
82
- var items = input.value;
83
- if (current !== items) {
84
- var page = Math.max(Math.ceil(from / items),1),
85
- html = link.replace(/__pagy_page__/, page).replace(/__pagy_items__/, items);
86
- if (typeof(param) === 'string' && page === 1){ html = Pagy.trim(html, param) }
87
- pagyEl.insertAdjacentHTML('afterbegin', html);
88
- pagyEl.getElementsByTagName('a')[0].click();
89
- }
90
- };
91
- Pagy.addInputEventListeners(input, go);
92
- };
93
-
94
- Pagy.addInputEventListeners = function(input, handler){
95
- // select the content on click: easier for typing a number
96
- input.addEventListener('click', function(){ this.select() });
97
- // go when the input looses focus
98
- input.addEventListener('focusout', handler);
99
- // … and when pressing enter inside the input
100
- input.addEventListener('keyup', function(e){ if (e.which === 13) handler() }.bind(this));
101
- };
102
-
103
- Pagy.trim = function(html, param){
104
- var re = new RegExp('[?&]' + param + '=1\\b(?!&)|\\b' + param + '=1&');
105
- return html.replace(re, '');
106
- };
@@ -1,35 +0,0 @@
1
- # Pagy locales
2
-
3
- ### Please, submit your translation!
4
-
5
- If you find that some translation could be improved, please, create an issue.
6
-
7
- If you are using pagy with some language missing from the dictionary files, please, submit your translation!
8
-
9
- You can create a Pull Request for your language, and get all the help you need to correctly complete it. Here is a check list.
10
-
11
- ### Check list for a new dictionary file:
12
-
13
- - [ ] Find the pluralization rule for your language
14
-
15
- - [ ] Find the locale file you need in the [list of pluralizations](https://github.com/svenfuchs/rails-i18n/tree/master/rails/pluralization) and check the pluralization rule in it. For example it is `::RailsI18n::Pluralization::OneOther.with_locale(:en)` for `en.rb`. Note the rule part i.e. `OneOther`. In pagy that translates to the symbol `:one_other`.
16
-
17
- - [ ] If the pluralization rule of your language is not the `:one_other` default, confirm that the [p11n.rb](https://github.com/ddnexus/pagy/blob/master/lib/locales/utils/p11n.rb) file already defines the pluralization rule of your dictionary file:
18
-
19
- - [ ] If the rule is not defined, you can either: a) Add the rule as a new rule/lambda entry in the `p11n` variable hash and relative tests or b) Just create an issue requesting the addition to the rule/lambda entry and tests.
20
-
21
- - [ ] Add your language to the `plurals` hash in the file.
22
-
23
- - [ ] add/edit the first line comment in the language rule in your dictionary file (e.g. `# :one_other pluralization ...`
24
-
25
- - [ ] The mandatory pluralized entry in the dictionary file is the `item_name`. Please, provide all the plurals needed by your language. E.g. if your language uses the `:east_slavic` you should provide the plurals for `one`, `few`, `many` and `other`, if it uses `:one_other`, you should provide `one` and `other` plurals. If it uses `:other` you should only provide a single value. Look into other dictionary files to get some example. Ask if in doubt.
26
-
27
- - [ ] The other entries in the dictionary file don't need any plural variant in most languages since the pluralization of the `item_name` in the sentence is enough. However, in some language, a whole sentence might need to be written in different ways for different counts. In that case you should add the different plurals for the sentence and the `count` will trigger the one that applies.
28
-
29
- Feel free to ask for help in your Pull Request.
30
-
31
- ### Useful Links
32
-
33
- * [Pagy I18n Documentation](https://ddnexus.github.io/pagy/api/frontend#i18n)
34
- * [I18n Extra](https://ddnexus.github.io/pagy/extras/i18n)
35
-
data/lib/locales/bg.yml DELETED
@@ -1,22 +0,0 @@
1
- # :one_other pluralization (see https://github.com/ddnexus/pagy/blob/master/lib/locales/utils/p11n.rb)
2
-
3
- bg:
4
- pagy:
5
-
6
- item_name:
7
- one: "резултат"
8
- other: "резултати"
9
-
10
- nav:
11
- prev: "&lsaquo;&nbsp;Предишна"
12
- next: "Следваща&nbsp;&rsaquo;"
13
- gap: "&hellip;"
14
-
15
- info:
16
- no_items: "Няма намерени %{item_name}"
17
- single_page: "Показани са <b>%{count}</b> %{item_name}"
18
- multiple_pages: "Показани са %{item_name} <b>%{from}-%{to}</b> от <b>%{count}</b> общо"
19
-
20
- combo_nav_js: "Страница %{page_input} от %{pages}"
21
-
22
- items_selector_js: "Покажи %{items_input} %{item_name} на страница"
data/lib/locales/ca.yml DELETED
@@ -1,22 +0,0 @@
1
- # :one_other pluralization (see https://github.com/ddnexus/pagy/blob/master/lib/locales/utils/p11n.rb)
2
-
3
- ca:
4
- pagy:
5
-
6
- item_name:
7
- one: "element"
8
- other: "elements"
9
-
10
- nav:
11
- prev: "&lsaquo;&nbsp;Anterior"
12
- next: "Següent&nbsp;&rsaquo;"
13
- gap: "&hellip;"
14
-
15
- info:
16
- no_items: "No s'ha trobat cap resultat"
17
- single_page: "Mostrant <b>%{count}</b> %{item_name}"
18
- multiple_pages: "Mostrant %{item_name} <b>%{from}-%{to}</b> de <b>%{count}</b> en total"
19
-
20
- combo_nav_js: "Pàgina %{page_input} de %{pages}"
21
-
22
- items_selector_js: "Mostra %{items_input} %{item_name} per pàgina"
data/lib/locales/da.yml DELETED
@@ -1,22 +0,0 @@
1
- # :one_other pluralization (see https://github.com/ddnexus/pagy/blob/master/lib/locales/utils/p11n.rb)
2
-
3
- da:
4
- pagy:
5
-
6
- item_name:
7
- one: "resultat"
8
- other: "resultater"
9
-
10
- nav:
11
- prev: "&lsaquo;&nbsp;Forrige"
12
- next: "Næste&nbsp;&rsaquo;"
13
- gap: "&hellip;"
14
-
15
- info:
16
- no_items: "Ingen %{item_name} fundet"
17
- single_page: "Viser <b>%{count}</b> %{item_name}"
18
- multiple_pages: "Viser %{item_name} <b>%{from}-%{to}</b> til <b>%{count}</b> totalt"
19
-
20
- combo_nav_js: "Side %{page_input} of %{pages}"
21
-
22
- items_selector_js: "Antal %{items_input} %{item_name} per side"
data/lib/locales/de.yml DELETED
@@ -1,22 +0,0 @@
1
- # :one_other pluralization (see https://github.com/ddnexus/pagy/blob/master/lib/locales/utils/p11n.rb)
2
-
3
- de:
4
- pagy:
5
-
6
- item_name:
7
- one: "Eintrag"
8
- other: "Einträge"
9
-
10
- nav:
11
- prev: "&lsaquo;&nbsp;Zurück"
12
- next: "Weiter&nbsp;&rsaquo;"
13
- gap: "&hellip;"
14
-
15
- info:
16
- no_items: "Kein %{item_name} gefunden"
17
- single_page: "Zeige <b>%{count}</b> %{item_name}"
18
- multiple_pages: "Zeige %{item_name} <b>%{from}-%{to}</b> von <b>%{count}</b> gesamt"
19
-
20
- combo_nav_js: "Seite %{page_input} von %{pages}"
21
-
22
- items_selector_js: "Zeige %{items_input} %{item_name} pro Seite"
data/lib/locales/en.yml DELETED
@@ -1,22 +0,0 @@
1
- # :one_other pluralization (see https://github.com/ddnexus/pagy/blob/master/lib/locales/utils/p11n.rb)
2
-
3
- en:
4
- pagy:
5
-
6
- item_name:
7
- one: "item"
8
- other: "items"
9
-
10
- nav:
11
- prev: "&lsaquo;&nbsp;Prev"
12
- next: "Next&nbsp;&rsaquo;"
13
- gap: "&hellip;"
14
-
15
- info:
16
- no_items: "No %{item_name} found"
17
- single_page: "Displaying <b>%{count}</b> %{item_name}"
18
- multiple_pages: "Displaying %{item_name} <b>%{from}-%{to}</b> of <b>%{count}</b> in total"
19
-
20
- combo_nav_js: "Page %{page_input} of %{pages}"
21
-
22
- items_selector_js: "Show %{items_input} %{item_name} per page"
data/lib/locales/fr.yml DELETED
@@ -1,22 +0,0 @@
1
- # :one_upto_two_other pluralization (see https://github.com/ddnexus/pagy/blob/master/lib/locales/utils/p11n.rb)
2
-
3
- fr:
4
- pagy:
5
-
6
- item_name:
7
- one: "élément"
8
- other: "éléments"
9
-
10
- nav:
11
- prev: "&lsaquo;&nbsp;Précédent"
12
- next: "Suivant&nbsp;&rsaquo;"
13
- gap: "&hellip;"
14
-
15
- info:
16
- no_items: "Aucun %{item_name} trouvé"
17
- single_page: "Affichage de <b>%{count}</b> %{item_name}"
18
- multiple_pages: "Affichage des %{item_name} <b>%{from} à %{to}</b> sur <b>%{count}</b> au total"
19
-
20
- combo_nav_js: "Page %{page_input} sur %{pages}"
21
-
22
- items_selector_js: "Afficher %{items_input} %{item_name} par page"
data/lib/locales/id.yml DELETED
@@ -1,20 +0,0 @@
1
- # :other pluralization (see https://github.com/ddnexus/pagy/blob/master/lib/locales/utils/p11n.rb)
2
-
3
- id:
4
- pagy:
5
-
6
- item_name: "item"
7
-
8
- nav:
9
- prev: "&lsaquo;&nbsp;Sebelumnya"
10
- next: "Selanjutnya&nbsp;&rsaquo;"
11
- gap: "&hellip;"
12
-
13
- info:
14
- no_items: "Tidak ditemukan %{item_name}"
15
- single_page: "Menampilkan <b>%{count}</b> %{item_name}"
16
- multiple_pages: "Menampilkan %{item_name} <b>%{from}-%{to}</b> dari total <b>%{count}</b>"
17
-
18
- combo_nav_js: "Halaman %{page_input} dari %{pages}"
19
-
20
- items_selector_js: "Tampilkan %{items_input} %{item_name} per halaman"
data/lib/locales/it.yml DELETED
@@ -1,22 +0,0 @@
1
- # :one_other pluralization (see https://github.com/ddnexus/pagy/blob/master/lib/locales/utils/p11n.rb)
2
-
3
- it:
4
- pagy:
5
-
6
- item_name:
7
- one: "elemento"
8
- other: "elementi"
9
-
10
- nav:
11
- prev: "&lsaquo;&nbsp;Precedente"
12
- next: "Seguente&nbsp;&rsaquo;"
13
- gap: "&hellip;"
14
-
15
- info:
16
- no_items: "Nessun %{item_name} trovato"
17
- single_page: "Visualizzazione di <b>%{count}</b> %{item_name}"
18
- multiple_pages: "Visualizzazione %{item_name} <b>%{from}-%{to}</b> di <b>%{count}</b> in totale"
19
-
20
- combo_nav_js: "Pagina %{page_input} di %{pages}"
21
-
22
- items_selector_js: "Mostra %{items_input} %{item_name} per pagina"
data/lib/locales/ja.yml DELETED
@@ -1,20 +0,0 @@
1
- # :other pluralization (see https://github.com/ddnexus/pagy/blob/master/lib/locales/utils/p11n.rb)
2
-
3
- ja:
4
- pagy:
5
-
6
- item_name: "結果"
7
-
8
- nav:
9
- prev: "&lsaquo;&nbsp;前へ"
10
- next: "次へ&nbsp;&rsaquo;"
11
- gap: "&hellip;"
12
-
13
- info:
14
- no_items: "見つかりませんでした"
15
- single_page: "<b>%{count}</b> 件の%{item_name}"
16
- multiple_pages: "<b>%{count}</b> 件中 <b>%{from}-%{to}</b> 件目の%{item_name}を表示中"
17
-
18
- combo_nav_js: "%{page_input} / %{pages} ページ"
19
-
20
- items_selector_js: "%{items_input} 件ずつ表示"
data/lib/locales/km.yml DELETED
@@ -1,19 +0,0 @@
1
- # :other pluralization (see https://github.com/ddnexus/pagy/blob/master/lib/locales/utils/p11n.rb)
2
-
3
- km:
4
- pagy:
5
- item_name: "ធាតុ"
6
-
7
- nav:
8
- prev: "&lsaquo;&nbsp;មុន"
9
- next: "បន្ទាប់&nbsp;&rsaquo;"
10
- gap: "&hellip;"
11
-
12
- info:
13
- no_items: "មិនមាន %{item_name} ទេ"
14
- single_page: "បង្ហាញ <b>%{count}</b> %{item_name}"
15
- multiple_pages: "បង្ហាញ %{item_name} <b>%{from}-%{to}</b> នៃ <b>%{count}</b> ជាចំនួនសរុប"
16
-
17
- combo_nav_js: "ទំព័រ %{page_input} នៃ %{pages}"
18
-
19
- items_selector_js: "បង្ហាញ %{items_input} %{item_name} ក្នុង ១ ទំព័រ"
data/lib/locales/ko.yml DELETED
@@ -1,20 +0,0 @@
1
- # :other pluralization (see https://github.com/ddnexus/pagy/blob/master/lib/locales/utils/p11n.rb)
2
-
3
- ko:
4
- pagy:
5
-
6
- item_name: "항목"
7
-
8
- nav:
9
- prev: "&lsaquo;&nbsp;이전"
10
- next: "이후&nbsp;&rsaquo;"
11
- gap: "&hellip;"
12
-
13
- info:
14
- no_items: "%{item_name} 없음"
15
- single_page: "<b>%{count}</b>개의 %{item_name} 표시됨"
16
- multiple_pages: "총 <b>%{count}</b>개의 %{item_name} 중 <b>%{from}-%{to}</b>"
17
-
18
- combo_nav_js: "총 %{pages} 중 %{page_input} 페이지"
19
-
20
- items_selector_js: "페이지 당 %{items_input}개 표시%"
data/lib/locales/nb.yml DELETED
@@ -1,22 +0,0 @@
1
- # :one_other pluralization (see https://github.com/ddnexus/pagy/blob/master/lib/locales/utils/p11n.rb)
2
-
3
- nb:
4
- pagy:
5
-
6
- item_name:
7
- one: "resultat"
8
- other: "resultater"
9
-
10
- nav:
11
- prev: "&lsaquo;&nbsp;Forrige"
12
- next: "Neste&nbsp;&rsaquo;"
13
- gap: "&hellip;"
14
-
15
- info:
16
- no_items: "Ingen %{item_name} funnet"
17
- single_page: "Viser <b>%{count}</b> %{item_name}"
18
- multiple_pages: "Viser %{item_name} <b>%{from}-%{to}</b> av totalt <b>%{count}</b>"
19
-
20
- combo_nav_js: "Side %{page_input} av %{pages}"
21
-
22
- items_selector_js: "Vis %{items_input} %{item_name} per side"
data/lib/locales/nl.yml DELETED
@@ -1,22 +0,0 @@
1
- # :one_other pluralization (see https://github.com/ddnexus/pagy/blob/master/lib/locales/utils/p11n.rb)
2
-
3
- nl:
4
- pagy:
5
-
6
- item_name:
7
- one: "stuk"
8
- other: "stuks"
9
-
10
- nav:
11
- prev: "&lsaquo;&nbsp;Vorige"
12
- next: "Volgende&nbsp;&rsaquo;"
13
- gap: "&hellip;"
14
-
15
- info:
16
- no_items: "Geen %{item_name} gevonden"
17
- single_page: "Toont <b>%{count}</b> %{item_name}"
18
- multiple_pages: "Toont <b>%{from}-%{to}</b> %{item_name} van <b>%{count}</b> in totaal"
19
-
20
- combo_nav_js: "Pagina %{page_input} van %{pages}"
21
-
22
- items_selector_js: "Toont %{items_input} %{item_name} per pagina"
data/lib/locales/pl.yml DELETED
@@ -1,24 +0,0 @@
1
- # :polish pluralization (see https://github.com/ddnexus/pagy/blob/master/lib/locales/utils/p11n.rb)
2
-
3
- pl:
4
- pagy:
5
-
6
- item_name:
7
- one: "element"
8
- few: "elementy"
9
- many: "elementów"
10
- other: "elementów"
11
-
12
- nav:
13
- prev: "&lsaquo;&nbsp;Poprzednia"
14
- next: "Następna&nbsp;&rsaquo;"
15
- gap: "&hellip;"
16
-
17
- info:
18
- no_items: "Nie znaleziono %{item_name}"
19
- single_page: "Wyświetlono <b>%{count}</b> %{item_name}"
20
- multiple_pages: "Wyświetlono %{item_name} <b>%{from}-%{to}</b> z wszystkich <b>%{count}</b>"
21
-
22
- combo_nav_js: "Strona %{page_input} z %{pages}"
23
-
24
- items_selector_js: "Pokaż %{items_input} %{item_name} na stronie"
data/lib/locales/ru.yml DELETED
@@ -1,24 +0,0 @@
1
- # :east_slavic pluralization (see https://github.com/ddnexus/pagy/blob/master/lib/locales/utils/p11n.rb)
2
-
3
- ru:
4
- pagy:
5
-
6
- item_name:
7
- one: "запись"
8
- few: "записи"
9
- many: "записей"
10
- other: "записей"
11
-
12
- nav:
13
- prev: "&lsaquo;&nbsp;Назад"
14
- next: "Вперёд&nbsp;&rsaquo;"
15
- gap: "&hellip;"
16
-
17
- info:
18
- no_items: "Пока %{item_name} нет"
19
- single_page: "<b>%{count}</b> %{item_name}"
20
- multiple_pages: "Всего <b>%{count}</b> %{item_name}, показаны с <b>%{from}</b> по <b>%{to}</b>"
21
-
22
- combo_nav_js: "Страница %{page_input} из %{pages}"
23
-
24
- items_selector_js: "Показать %{items_input} %{item_name} на странице"
@@ -1,23 +0,0 @@
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: "&lsaquo;&nbsp;Föregående"
13
- next: "Nästa&nbsp;&rsaquo;"
14
- gap: "&hellip;"
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"
data/lib/locales/sv.yml DELETED
@@ -1,23 +0,0 @@
1
- # :one_two_other pluralization (see https://github.com/ddnexus/pagy/blob/master/lib/locales/utils/p11n.rb)
2
-
3
- sv:
4
- pagy:
5
-
6
- item_name:
7
- one: "resultat"
8
- two: "resultat"
9
- other: "resultat"
10
-
11
- nav:
12
- prev: "&lsaquo;&nbsp;Föregående"
13
- next: "Nästa&nbsp;&rsaquo;"
14
- gap: "&hellip;"
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"
data/lib/locales/tr.yml DELETED
@@ -1,20 +0,0 @@
1
- # :other pluralization (see https://github.com/ddnexus/pagy/blob/master/lib/locales/utils/p11n.rb)
2
-
3
- tr:
4
- pagy:
5
-
6
- item_name: "kayıt"
7
-
8
- nav:
9
- prev: "&lsaquo;&nbsp;Önceki"
10
- next: "Sonraki&nbsp;&rsaquo;"
11
- gap: "&hellip;"
12
-
13
- info:
14
- no_items: "Hiç %{item_name} bulunamadı"
15
- single_page: "Toplam <b>%{count}</b> %{item_name} gösteriliyor"
16
- multiple_pages: "<b>%{count}</b> %{item_name} içerisinden <b>%{from}-%{to}</b> kadarı gösteriliyor"
17
-
18
- combo_nav_js: "Sayfa %{page_input} / %{pages}"
19
-
20
- items_selector_js: "Sayfada %{items_input} %{item_name} göster"
@@ -1,25 +0,0 @@
1
- # See https://ddnexus.github.io/pagy/api/frontend#i18n
2
- # encoding: utf-8
3
- # frozen_string_literal: true
4
-
5
- # this file returns the I18n hash used as default alternative to the i18n gem
6
-
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|
11
- # eval: we don't need to keep the loader proc in memory
12
- eval(Pagy.root.join('locales', 'utils', 'loader.rb').read).call(i18n_hash, *load_args) #rubocop:disable Security/Eval
13
- end
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
20
- data, pluralize = self[locale]
21
- translate = data[path] || vars[:count] && data[path+=".#{pluralize.call(vars[:count])}"] or return %([translation missing: "#{path}"])
22
- translate.call(vars)
23
- end
24
- i18n_hash.load(locale: 'en')
25
- end
@@ -1,34 +0,0 @@
1
- # encoding: utf-8
2
- # frozen_string_literal: true
3
-
4
- # the whole file will be eval'ed/executed and gc-collected after returning/executing the loader proc
5
-
6
- # eval: no need for the whole file in memory
7
- plurals, _ = eval(Pagy.root.join('locales', 'utils', 'p11n.rb').read) #rubocop:disable Security/Eval
8
-
9
- # flatten the dictionary file nested keys
10
- # convert each value to a simple ruby interpolation proc
11
- flatten = lambda do |hash, key=''|
12
- hash.each.reduce({}) do |h, (k, v)|
13
- v.is_a?(Hash) \
14
- ? h.merge!(flatten.call(v, "#{key}#{k}."))
15
- : h.merge!(eval %({"#{key}#{k}" => lambda{|vars|"#{v.gsub(/%{[^}]+?}/){|m| "\#{vars[:#{m[2..-2]}]||'#{m}'}" }}"}})) #rubocop:disable Security/Eval
16
- end
17
- end
18
-
19
- # loader proc
20
- lambda do |i18n, *args|
21
- i18n.clear
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
28
- arg[:filepath] ||= Pagy.root.join('locales', "#{arg[:locale]}.yml")
29
- arg[:pluralize] ||= plurals[arg[:locale]]
30
- hash = YAML.load(File.read(arg[:filepath], encoding: 'UTF-8')) #rubocop:disable Security/YAMLLoad
31
- hash.key?(arg[:locale]) or raise VariableError, %(expected :locale "#{arg[:locale]}" not found in :filepath "#{arg[:filepath].inspect}")
32
- i18n[arg[:locale]] = [flatten.call(hash[arg[:locale]]), arg[:pluralize]]
33
- end
34
- end