Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions FilePaginatorPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
class FilePaginatorPlugin extends Omeka_Plugin_AbstractPlugin
{
protected $_hooks = array(
'initialize',
'public_head',
'config',
'config_form',
Expand All @@ -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');
Expand All @@ -46,7 +57,7 @@ public function hookConfig($args){

public function filterFilesForItem($html) {
$theme = get_option('file_paginator_theme');
return '<div id="file-pagination" data-theme="' . $theme . '"></div>'.$html;
return '<div id="file-pagination" data-theme="' . $theme . '" data-prevtext="'. __('Prev') .'" data-nexttext="'. __('Next') .'"></div>'.$html;
}

public function filterFileMarkupOptions ($options) {
Expand All @@ -68,4 +79,4 @@ public function filterFileMarkup($html,$args) {
. '</div>';
}
}
?>
?>
Binary file added languages/ru.mo
Binary file not shown.
54 changes: 54 additions & 0 deletions languages/ru.po
Original file line number Diff line number Diff line change
@@ -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 "Установите флажок ниже, чтобы отобразить метаданные файла."
49 changes: 49 additions & 0 deletions languages/template.pot
Original file line number Diff line number Diff line change
@@ -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 ""
Binary file added languages/uk.mo
Binary file not shown.
54 changes: 54 additions & 0 deletions languages/uk.po
Original file line number Diff line number Diff line change
@@ -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 "Поставте прапорець нижче, щоб відобразити метадані файлу."
39 changes: 23 additions & 16 deletions views/shared/javascripts/filePagination.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,40 @@ 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+)$/);
if(hash) {
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();
}
});