Open tranduyhung opened 8 years ago
Hi, I'm also interested in this. I've tried to replace $this->items[$x] = new PaginationPage($x, '/page' . $config->get('system.param_sep') . $x);
with $this->items[$x] = new PaginationPage($x, '/'. $grav['language']->translate('PLUGIN_PAGINATION.PAGE') . $config->get('system.param_sep') . $x);
in classes/plugin/PaginationHelper.php but I got the same error as @tranduyhung
Looking forward to seeing someone taking it from here and suggest a pull request.
Ive looked into this and the problem is here:
public function currentPage()
{
$page = (int)($this->params['page'] ?? 1);
return max(1, $page);
}
This function from Grav/Common/Uri is hardchecking the 'page' param. changing it to something like this:
public function currentPage()
{
$page = (int)($this->params[Grav::instance()['language']->translate('PLUGIN_PAGINATION.PAGE')]] ?? 1);
return max(1, $page);
}
does work for returning the appropriate page but may have some effects on other things
what is your opinion @mahagr @rhukster ?
Above does not work as it doesn't change the parameter name in the templates and I don't think that it's used so much either.
I'm not sure if it's best to use translation like that, especially as it gets translated to Chinese etc.. Might be better to use something like PAGE_URL_ATTRIBUTE and add a comment to it what it is used for.
oh yeah theres a couple more modifications that are needed for it to work, we got it working this is the only function thats directly from core. But yeah a diff translation name than just page is better i agree
Ran into this issue today. Any plans to change this behavior?
WordPress uses only the number of pages.
It is great if the plugin gives an option to change "page" param in URL to something else, like for localization.
For example, I would like to have
instead of
"trang" means "page" in my language.
I looked into the code and I was able to change "page" to a different word, but the page's result was only from page 1 and the pagination only activated page 1, I couldn't browse pages 2+.