diff --git a/FilePaginatorPlugin.php b/FilePaginatorPlugin.php index 94bfc40..adeb546 100644 --- a/FilePaginatorPlugin.php +++ b/FilePaginatorPlugin.php @@ -13,6 +13,7 @@ class FilePaginatorPlugin extends Omeka_Plugin_AbstractPlugin { protected $_hooks = array( + 'initialize', 'public_head', 'config', 'config_form', @@ -24,6 +25,16 @@ class FilePaginatorPlugin extends Omeka_Plugin_AbstractPlugin 'file_markup_options' ); + /** + * Add the translations. + */ + public function hookInitialize() + { + + add_translation_source(dirname(__FILE__).'/languages'); + + } + public function hookPublicHead($args) { queue_js_file('jquery.simplePagination'); @@ -46,7 +57,7 @@ public function hookConfig($args){ public function filterFilesForItem($html) { $theme = get_option('file_paginator_theme'); - return '
'.$html; + return ''.$html; } public function filterFileMarkupOptions ($options) { @@ -68,4 +79,4 @@ public function filterFileMarkup($html,$args) { . ''; } } -?> \ No newline at end of file +?> diff --git a/languages/ru.mo b/languages/ru.mo new file mode 100644 index 0000000..40c04af Binary files /dev/null and b/languages/ru.mo differ diff --git a/languages/ru.po b/languages/ru.po new file mode 100644 index 0000000..ea8d728 --- /dev/null +++ b/languages/ru.po @@ -0,0 +1,54 @@ +msgid "" +msgstr "" +"Content-Transfer-Encoding: 8bit\n" +"Content-Type: text/plain; charset=UTF-8\n" +"MIME-Version: 1.0\n" +"POT-Creation-Date: 2024-03-07 09:29+0200\n" +"Project-Id-Version: FilePaginator\n" +"X-Domain: FilePaginator\n" +"X-Generator: Poedit 2.2\n" +"PO-Revision-Date: \n" +"Language-Team: \n" +"Last-Translator: \n" +"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<12 || n%100>14) ? 1 : 2);\n" +"Language: ru\n" + +#: plugins/FilePaginator/FilePaginatorPlugin.php:49 +msgid "Prev" +msgstr "Предыдущий" + +#: plugins/FilePaginator/FilePaginatorPlugin.php:49 +msgid "Next" +msgstr "Следующий" + +#: plugins/FilePaginator/config_form.php:6 +msgid "Theme" +msgstr "Тема" + +#: plugins/FilePaginator/config_form.php:9 +msgid "Light" +msgstr "Светлая" + +#: plugins/FilePaginator/config_form.php:9 +msgid "Dark" +msgstr "Тёмная" + +#: plugins/FilePaginator/config_form.php:9 +msgid "Compact" +msgstr "Компактный" + +#: plugins/FilePaginator/config_form.php:12 +msgid "Links" +msgstr "Ссылка" + +#: plugins/FilePaginator/config_form.php:16 +msgid "Check the box below to launch files into new tabs on click." +msgstr "Установите флажок ниже, чтобы по щелчку мыши запускать файлы на новых вкладках." + +#: plugins/FilePaginator/config_form.php:20 +msgid "Metadata" +msgstr "Метаданые" + +#: plugins/FilePaginator/config_form.php:24 +msgid "Check the box below to show file metadata." +msgstr "Установите флажок ниже, чтобы отобразить метаданные файла." diff --git a/languages/template.pot b/languages/template.pot new file mode 100644 index 0000000..a50069c --- /dev/null +++ b/languages/template.pot @@ -0,0 +1,49 @@ +msgid "" +msgstr "" +"Content-Transfer-Encoding: 8bit\n" +"Content-Type: text/plain; charset=UTF-8\n" +"MIME-Version: 1.0\n" +"POT-Creation-Date: 2024-03-07 09:29+0200\n" +"Project-Id-Version: FilePaginator\n" +"X-Domain: FilePaginator\n" +"X-Generator: LanguagesManager\n" + +#: plugins/FilePaginator/FilePaginatorPlugin.php:49 +msgid "Prev" +msgstr "" + +#: plugins/FilePaginator/FilePaginatorPlugin.php:49 +msgid "Next" +msgstr "" + +#: plugins/FilePaginator/config_form.php:6 +msgid "Theme" +msgstr "" + +#: plugins/FilePaginator/config_form.php:9 +msgid "Light" +msgstr "" + +#: plugins/FilePaginator/config_form.php:9 +msgid "Dark" +msgstr "" + +#: plugins/FilePaginator/config_form.php:9 +msgid "Compact" +msgstr "" + +#: plugins/FilePaginator/config_form.php:12 +msgid "Links" +msgstr "" + +#: plugins/FilePaginator/config_form.php:16 +msgid "Check the box below to launch files into new tabs on click." +msgstr "" + +#: plugins/FilePaginator/config_form.php:20 +msgid "Metadata" +msgstr "" + +#: plugins/FilePaginator/config_form.php:24 +msgid "Check the box below to show file metadata." +msgstr "" diff --git a/languages/uk.mo b/languages/uk.mo new file mode 100644 index 0000000..4c8e506 Binary files /dev/null and b/languages/uk.mo differ diff --git a/languages/uk.po b/languages/uk.po new file mode 100644 index 0000000..52b6ac8 --- /dev/null +++ b/languages/uk.po @@ -0,0 +1,54 @@ +msgid "" +msgstr "" +"Content-Transfer-Encoding: 8bit\n" +"Content-Type: text/plain; charset=UTF-8\n" +"MIME-Version: 1.0\n" +"POT-Creation-Date: 2024-03-07 09:29+0200\n" +"Project-Id-Version: FilePaginator\n" +"X-Domain: FilePaginator\n" +"X-Generator: Poedit 2.2\n" +"PO-Revision-Date: \n" +"Language-Team: \n" +"Last-Translator: \n" +"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<12 || n%100>14) ? 1 : 2);\n" +"Language: uk_UA\n" + +#: plugins/FilePaginator/FilePaginatorPlugin.php:49 +msgid "Prev" +msgstr "Попередній" + +#: plugins/FilePaginator/FilePaginatorPlugin.php:49 +msgid "Next" +msgstr "Наступний" + +#: plugins/FilePaginator/config_form.php:6 +msgid "Theme" +msgstr "Тема" + +#: plugins/FilePaginator/config_form.php:9 +msgid "Light" +msgstr "Світла" + +#: plugins/FilePaginator/config_form.php:9 +msgid "Dark" +msgstr "Темна" + +#: plugins/FilePaginator/config_form.php:9 +msgid "Compact" +msgstr "Компактний" + +#: plugins/FilePaginator/config_form.php:12 +msgid "Links" +msgstr "Посилання" + +#: plugins/FilePaginator/config_form.php:16 +msgid "Check the box below to launch files into new tabs on click." +msgstr "Поставте прапорець нижче, щоб відкривати файли в нових вкладках після натискання." + +#: plugins/FilePaginator/config_form.php:20 +msgid "Metadata" +msgstr "Метадані" + +#: plugins/FilePaginator/config_form.php:24 +msgid "Check the box below to show file metadata." +msgstr "Поставте прапорець нижче, щоб відобразити метадані файлу." diff --git a/views/shared/javascripts/filePagination.js b/views/shared/javascripts/filePagination.js index b1a47ca..e9e689c 100644 --- a/views/shared/javascripts/filePagination.js +++ b/views/shared/javascripts/filePagination.js @@ -3,26 +3,15 @@ jQuery(function($) { var pagination = $('#file-pagination') if (!pagination.length) return; var items = $(".single-file"); - + var numItems = items.length; var perPage = 1; var theme = pagination.data("theme"); + var prevText = pagination.data("prevtext"); + var nextText = pagination.data("nexttext"); items.slice(perPage).hide(); - pagination.pagination({ - items: numItems, - itemsOnPage: perPage, - cssStyle: theme, - - onPageClick: function(pageNumber) { - var showFrom = perPage * (pageNumber - 1); - var showTo = showFrom + perPage; - - items.hide() - .slice(showFrom, showTo).show(); - } - }); function checkFragment() { var hash = window.location.hash || "#page-1"; hash = hash.match(/^#page-(\d+)$/); @@ -30,6 +19,24 @@ jQuery(function($) { pagination.pagination("selectPage", parseInt(hash[1])); } }; - $(window).bind("popstate", checkFragment); - checkFragment(); + + if(numItems > 1){ + pagination.pagination({ + items: numItems, + itemsOnPage: perPage, + cssStyle: theme, + prevText: prevText, + nextText: nextText, + + onPageClick: function(pageNumber) { + var showFrom = perPage * (pageNumber - 1); + var showTo = showFrom + perPage; + + items.hide() + .slice(showFrom, showTo).show(); + } + }); + $(window).bind("popstate", checkFragment); + checkFragment(); + } });