Skip to content
Permalink
Browse files

Localize paginator numbers.

  • Loading branch information...
dereuromark committed Oct 12, 2016
1 parent 90b4943 commit e23814310495b8e992c131ea0bd6b543858a8cc1
Showing with 43 additions and 43 deletions.
  1. +7 −7 src/View/Helper/PaginatorHelper.php
  2. +36 −36 tests/TestCase/View/Helper/PaginatorHelperTest.php
@@ -814,7 +814,7 @@ protected function _modulusNumbers($templater, $params, $options)
for ($i = $start; $i < $params['page']; $i++) {
$out .= $this->_formatNumber($templater, [
'text' => $i,
'text' => $this->Number->format($i),
'page' => $i,
'model' => $options['model'],
'url' => $options['url'],
@@ -823,14 +823,14 @@ protected function _modulusNumbers($templater, $params, $options)
$url = array_merge($options['url'], ['page' => $params['page']]);
$out .= $templater->format('current', [
'text' => $params['page'],
'text' => $this->Number->format($params['page']),
'url' => $this->generateUrl($url, $options['model']),
]);
$start = $params['page'] + 1;
for ($i = $start; $i < $end; $i++) {
$out .= $this->_formatNumber($templater, [
'text' => $i,
'text' => $this->Number->format($i),
'page' => $i,
'model' => $options['model'],
'url' => $options['url'],
@@ -839,7 +839,7 @@ protected function _modulusNumbers($templater, $params, $options)
if ($end != $params['page']) {
$out .= $this->_formatNumber($templater, [
'text' => $i,
'text' => $this->Number->format($i),
'page' => $end,
'model' => $options['model'],
'url' => $options['url'],
@@ -921,7 +921,7 @@ protected function _numbers($templater, $params, $options)
]);
} else {
$vars = [
'text' => $i,
'text' => $this->Number->format($i),
'url' => $this->generateUrl($url, $options['model']),
];
$out .= $templater->format('number', $vars);
@@ -981,7 +981,7 @@ public function first($first = '<< first', array $options = [])
$url = array_merge($options['url'], ['page' => $i]);
$out .= $this->templater()->format('number', [
'url' => $this->generateUrl($url, $options['model']),
'text' => $i
'text' => $this->Number->format($i)
]);
}
} elseif ($params['page'] > 1 && is_string($first)) {
@@ -1042,7 +1042,7 @@ public function last($last = 'last >>', array $options = [])
$url = array_merge($options['url'], ['page' => $i]);
$out .= $this->templater()->format('number', [
'url' => $this->generateUrl($url, $options['model']),
'text' => $i
'text' => $this->Number->format($i)
]);
}
} elseif ($params['page'] < $params['pageCount'] && is_string($last)) {
@@ -1615,10 +1615,10 @@ public function testNumbersModulus()
['li' => []], ['a' => ['href' => '/index']], '1', '/a', '/li',
['li' => []], ['a' => ['href' => '/index?page=2']], '2', '/a', '/li',
['li' => ['class' => 'ellipsis']], '&hellip;', '/li',
['li' => []], ['a' => ['href' => '/index?page=4894']], '4894', '/a', '/li',
['li' => ['class' => 'active']], '<a href=""', '4895', '/a', '/li',
['li' => []], ['a' => ['href' => '/index?page=4896']], '4896', '/a', '/li',
['li' => []], ['a' => ['href' => '/index?page=4897']], '4897', '/a', '/li',
['li' => []], ['a' => ['href' => '/index?page=4894']], '4,894', '/a', '/li',
['li' => ['class' => 'active']], '<a href=""', '4,895', '/a', '/li',
['li' => []], ['a' => ['href' => '/index?page=4896']], '4,896', '/a', '/li',
['li' => []], ['a' => ['href' => '/index?page=4897']], '4,897', '/a', '/li',
];
$this->assertHtml($expected, $result);
@@ -1631,8 +1631,8 @@ public function testNumbersModulus()
['li' => ['class' => 'active']], '<a href=""', '3', '/a', '/li',
['li' => []], ['a' => ['href' => '/index?page=4']], '4', '/a', '/li',
['li' => ['class' => 'ellipsis']], '&hellip;', '/li',
['li' => []], ['a' => ['href' => '/index?page=4896']], '4896', '/a', '/li',
['li' => []], ['a' => ['href' => '/index?page=4897']], '4897', '/a', '/li',
['li' => []], ['a' => ['href' => '/index?page=4896']], '4,896', '/a', '/li',
['li' => []], ['a' => ['href' => '/index?page=4897']], '4,897', '/a', '/li',
];
$this->assertHtml($expected, $result);
@@ -1643,8 +1643,8 @@ public function testNumbersModulus()
['li' => ['class' => 'active']], '<a href=""', '3', '/a', '/li',
['li' => []], ['a' => ['href' => '/index?page=4']], '4', '/a', '/li',
['li' => ['class' => 'ellipsis']], '&hellip;', '/li',
['li' => []], ['a' => ['href' => '/index?page=4896']], '4896', '/a', '/li',
['li' => []], ['a' => ['href' => '/index?page=4897']], '4897', '/a', '/li',
['li' => []], ['a' => ['href' => '/index?page=4896']], '4,896', '/a', '/li',
['li' => []], ['a' => ['href' => '/index?page=4897']], '4,897', '/a', '/li',
];
$this->assertHtml($expected, $result);
@@ -1657,11 +1657,11 @@ public function testNumbersModulus()
['li' => []], ['a' => ['href' => '/index?page=5']], '5', '/a', '/li',
['li' => []], ['a' => ['href' => '/index?page=6']], '6', '/a', '/li',
['li' => ['class' => 'ellipsis']], '&hellip;', '/li',
['li' => []], ['a' => ['href' => '/index?page=4893']], '4893', '/a', '/li',
['li' => []], ['a' => ['href' => '/index?page=4894']], '4894', '/a', '/li',
['li' => []], ['a' => ['href' => '/index?page=4895']], '4895', '/a', '/li',
['li' => []], ['a' => ['href' => '/index?page=4896']], '4896', '/a', '/li',
['li' => []], ['a' => ['href' => '/index?page=4897']], '4897', '/a', '/li',
['li' => []], ['a' => ['href' => '/index?page=4893']], '4,893', '/a', '/li',
['li' => []], ['a' => ['href' => '/index?page=4894']], '4,894', '/a', '/li',
['li' => []], ['a' => ['href' => '/index?page=4895']], '4,895', '/a', '/li',
['li' => []], ['a' => ['href' => '/index?page=4896']], '4,896', '/a', '/li',
['li' => []], ['a' => ['href' => '/index?page=4897']], '4,897', '/a', '/li',
];
$this->assertHtml($expected, $result);
@@ -1674,13 +1674,13 @@ public function testNumbersModulus()
['li' => []], ['a' => ['href' => '/index?page=4']], '4', '/a', '/li',
['li' => []], ['a' => ['href' => '/index?page=5']], '5', '/a', '/li',
['li' => ['class' => 'ellipsis']], '&hellip;', '/li',
['li' => []], ['a' => ['href' => '/index?page=4891']], '4891', '/a', '/li',
['li' => []], ['a' => ['href' => '/index?page=4892']], '4892', '/a', '/li',
['li' => ['class' => 'active']], '<a href=""', '4893', '/a', '/li',
['li' => []], ['a' => ['href' => '/index?page=4894']], '4894', '/a', '/li',
['li' => []], ['a' => ['href' => '/index?page=4895']], '4895', '/a', '/li',
['li' => []], ['a' => ['href' => '/index?page=4896']], '4896', '/a', '/li',
['li' => []], ['a' => ['href' => '/index?page=4897']], '4897', '/a', '/li',
['li' => []], ['a' => ['href' => '/index?page=4891']], '4,891', '/a', '/li',
['li' => []], ['a' => ['href' => '/index?page=4892']], '4,892', '/a', '/li',
['li' => ['class' => 'active']], '<a href=""', '4,893', '/a', '/li',
['li' => []], ['a' => ['href' => '/index?page=4894']], '4,894', '/a', '/li',
['li' => []], ['a' => ['href' => '/index?page=4895']], '4,895', '/a', '/li',
['li' => []], ['a' => ['href' => '/index?page=4896']], '4,896', '/a', '/li',
['li' => []], ['a' => ['href' => '/index?page=4897']], '4,897', '/a', '/li',
];
$this->assertHtml($expected, $result);
@@ -1699,11 +1699,11 @@ public function testNumbersModulus()
['li' => []], ['a' => ['href' => '/index?page=59']], '59', '/a', '/li',
['li' => []], ['a' => ['href' => '/index?page=60']], '60', '/a', '/li',
['li' => ['class' => 'ellipsis']], '&hellip;', '/li',
['li' => []], ['a' => ['href' => '/index?page=4893']], '4893', '/a', '/li',
['li' => []], ['a' => ['href' => '/index?page=4894']], '4894', '/a', '/li',
['li' => []], ['a' => ['href' => '/index?page=4895']], '4895', '/a', '/li',
['li' => []], ['a' => ['href' => '/index?page=4896']], '4896', '/a', '/li',
['li' => []], ['a' => ['href' => '/index?page=4897']], '4897', '/a', '/li',
['li' => []], ['a' => ['href' => '/index?page=4893']], '4,893', '/a', '/li',
['li' => []], ['a' => ['href' => '/index?page=4894']], '4,894', '/a', '/li',
['li' => []], ['a' => ['href' => '/index?page=4895']], '4,895', '/a', '/li',
['li' => []], ['a' => ['href' => '/index?page=4896']], '4,896', '/a', '/li',
['li' => []], ['a' => ['href' => '/index?page=4897']], '4,897', '/a', '/li',
];
$this->assertHtml($expected, $result);
@@ -1718,11 +1718,11 @@ public function testNumbersModulus()
['li' => []], ['a' => ['href' => '/index?page=6']], '6', '/a', '/li',
['li' => []], ['a' => ['href' => '/index?page=7']], '7', '/a', '/li',
['li' => ['class' => 'ellipsis']], '&hellip;', '/li',
['li' => []], ['a' => ['href' => '/index?page=4893']], '4893', '/a', '/li',
['li' => []], ['a' => ['href' => '/index?page=4894']], '4894', '/a', '/li',
['li' => []], ['a' => ['href' => '/index?page=4895']], '4895', '/a', '/li',
['li' => []], ['a' => ['href' => '/index?page=4896']], '4896', '/a', '/li',
['li' => []], ['a' => ['href' => '/index?page=4897']], '4897', '/a', '/li',
['li' => []], ['a' => ['href' => '/index?page=4893']], '4,893', '/a', '/li',
['li' => []], ['a' => ['href' => '/index?page=4894']], '4,894', '/a', '/li',
['li' => []], ['a' => ['href' => '/index?page=4895']], '4,895', '/a', '/li',
['li' => []], ['a' => ['href' => '/index?page=4896']], '4,896', '/a', '/li',
['li' => []], ['a' => ['href' => '/index?page=4897']], '4,897', '/a', '/li',
];
$this->assertHtml($expected, $result);
@@ -1734,8 +1734,8 @@ public function testNumbersModulus()
['li' => ['class' => 'active']], '<a href=""', '3', '/a', '/li',
['li' => []], ['a' => ['href' => '/index?page=4']], '4', '/a', '/li',
['li' => ['class' => 'ellipsis']], '&hellip;', '/li',
['li' => []], ['a' => ['href' => '/index?page=4896']], '4896', '/a', '/li',
['li' => []], ['a' => ['href' => '/index?page=4897']], '4897', '/a', '/li',
['li' => []], ['a' => ['href' => '/index?page=4896']], '4,896', '/a', '/li',
['li' => []], ['a' => ['href' => '/index?page=4897']], '4,897', '/a', '/li',
];
$this->assertHtml($expected, $result);
@@ -1746,8 +1746,8 @@ public function testNumbersModulus()
['li' => []], ['a' => ['href' => '/index?page=2']], '2', '/a', '/li',
['li' => ['class' => 'active']], '<a href=""', '3', '/a', '/li',
['li' => ['class' => 'ellipsis']], '&hellip;', '/li',
['li' => []], ['a' => ['href' => '/index?page=4896']], '4896', '/a', '/li',
['li' => []], ['a' => ['href' => '/index?page=4897']], '4897', '/a', '/li',
['li' => []], ['a' => ['href' => '/index?page=4896']], '4,896', '/a', '/li',
['li' => []], ['a' => ['href' => '/index?page=4897']], '4,897', '/a', '/li',
];
$this->assertHtml($expected, $result);
}
@@ -1834,8 +1834,8 @@ public function testNumbersWithUrlOptions()
['li' => ['class' => 'active']], '<a href=""', '3', '/a', '/li',
['li' => []], ['a' => ['href' => '/index?page=4&amp;foo=bar']], '4', '/a', '/li',
['li' => ['class' => 'ellipsis']], '&hellip;', '/li',
['li' => []], ['a' => ['href' => '/index?page=4896&amp;foo=bar']], '4896', '/a', '/li',
['li' => []], ['a' => ['href' => '/index?page=4897&amp;foo=bar']], '4897', '/a', '/li',
['li' => []], ['a' => ['href' => '/index?page=4896&amp;foo=bar']], '4,896', '/a', '/li',
['li' => []], ['a' => ['href' => '/index?page=4897&amp;foo=bar']], '4,897', '/a', '/li',
];
$this->assertHtml($expected, $result);
}

0 comments on commit e238143

Please sign in to comment.
You can’t perform that action at this time.