Skip to content

Commit

Permalink
Merge pull request #40 from daniellienert/feature/translate-nex-tprev…
Browse files Browse the repository at this point in the history
…ious

FEATURE: Translate next / previous
  • Loading branch information
daniellienert authored Apr 21, 2020
2 parents 7be184b + 23b9545 commit 6c230d8
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 6 deletions.
5 changes: 2 additions & 3 deletions Classes/Fusion/PaginationArrayImplementation.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

namespace Flowpack\Listable\Fusion;

use Neos\Flow\Annotations as Flow;
Expand Down Expand Up @@ -37,11 +36,11 @@ public function evaluate(): array
$displayRangeEnd = (integer)min($displayRangeEnd, $numberOfPages);
$links = \range($displayRangeStart, $displayRangeEnd);
if ($displayRangeStart > 2) {
array_unshift($links, "...");
array_unshift($links, '...');
array_unshift($links, 1);
}
if ($displayRangeEnd + 1 < $numberOfPages) {
$links[] = "...";
$links[] = '...';
$links[] = $numberOfPages;
}

Expand Down
6 changes: 3 additions & 3 deletions Resources/Private/Fusion/Pagination.fusion
Original file line number Diff line number Diff line change
Expand Up @@ -51,21 +51,21 @@ prototype(Flowpack.Listable:Pagination) < prototype(Neos.Fusion:Component) {
currentPage = ${String.toInteger(props.currentPage) - 1}
}
}
content = ${i}
content = ${Translation.translate(i, i, [], 'Main', 'Flowpack.Listable') }
}
}
next {
condition = ${i == 'next' && (props.showPreviousNextLinks == true)}
renderer = Neos.Fusion:Tag {
@process.tmpl = ${'<li class="next">' + value + '</li>'}
@process.tmpl = ${'<li class="next">' + value + '</li>'}
tagName = 'a'
attributes.href = Neos.Neos:NodeUri {
node = ${documentNode}
additionalParams = Flowpack.Listable:PaginationParameters {
currentPage = ${String.toInteger(props.currentPage) + 1}
}
}
content = ${i}
content = ${Translation.translate(i, i, [], 'Main', 'Flowpack.Listable') }
}
}
link {
Expand Down
15 changes: 15 additions & 0 deletions Resources/Private/Translations/de/Main.xlf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
<file original="" product-name="Flowpack.Listable" source-language="en" datatype="plaintext">
<body>
<trans-unit id="next" xml:space="preserve" approved="yes">
<source>next</source>
<target xml:lang="de" state="translated">Nächste</target>
</trans-unit>
<trans-unit id="previous" xml:space="preserve" approved="yes">
<source>previous</source>
<target xml:lang="de" state="translated">Vorherige</target>
</trans-unit>
</body>
</file>
</xliff>
13 changes: 13 additions & 0 deletions Resources/Private/Translations/en/Main.xlf
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
<file original="" product-name="Flowpack.Listable" source-language="en" datatype="plaintext">
<body>
<trans-unit id="next" xml:space="preserve" approved="yes">
<source>next</source>
</trans-unit>
<trans-unit id="previous" xml:space="preserve" approved="yes">
<source>previous</source>
</trans-unit>
</body>
</file>
</xliff>

0 comments on commit 6c230d8

Please sign in to comment.