New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pagination of multilingual pages is slightly broken #2972

Closed
aroig opened this Issue Jan 21, 2017 · 2 comments

Comments

Projects
None yet
2 participants
@aroig
Contributor

aroig commented Jan 21, 2017

If I add a paginator on a section page which is translated to several languages, two problems appear:

  1. The cross-language links obtained from .Translations from a page in the pagination sequence different from the first, point always to the first page of the translation.
  2. The .Translations variable for non-first pages includes the first page of the current language.

I think 2 may be a consequence of 1. It looks like 1 is going to be annoying to fix, since pagination happens very late in the rendering process. I guess a good way to fix it would be to make pagination pages into proper pages, etc, etc.

@bep

This comment has been minimized.

Show comment
Hide comment
@bep

bep Jan 22, 2017

Member

Please don't use "broken" unless you have a well defined "correct solution".

There may be work to be done with pagination vs multilingual (had to stop somewhere), but I'm not sure this is one of them.

I see 3 alternatives:

  1. Return an empty .Translations for pages > 1 because we have no good way of guessing translation.
  2. Link to the same page, so "/home/en/32" => "/home/no/32"
  3. Always link to page 1 (current status)

2 would very rarely be correct (as it would need 1:1 translation for all languages, with equal sorting, taxonomy definition etc.), and it isn't cost effective to try to implement some logic around it.

So then it is 1 or 3?

Member

bep commented Jan 22, 2017

Please don't use "broken" unless you have a well defined "correct solution".

There may be work to be done with pagination vs multilingual (had to stop somewhere), but I'm not sure this is one of them.

I see 3 alternatives:

  1. Return an empty .Translations for pages > 1 because we have no good way of guessing translation.
  2. Link to the same page, so "/home/en/32" => "/home/no/32"
  3. Always link to page 1 (current status)

2 would very rarely be correct (as it would need 1:1 translation for all languages, with equal sorting, taxonomy definition etc.), and it isn't cost effective to try to implement some logic around it.

So then it is 1 or 3?

aroig added a commit to aroig/hugo that referenced this issue Jan 22, 2017

hugolib: discard current language based on .Lang()
Otherwise we fail to skip the current language in translations
for paginated pages.

Fixes #2972
@aroig

This comment has been minimized.

Show comment
Hide comment
@aroig

aroig Jan 22, 2017

Contributor

Please don't use "broken" unless you have a well defined "correct solution".

I was thinking of 2 above, but as you point out this can't be a general solution because of missing translated pages. In that case, I agree that current behavior is ok.

In a blog-like site, one may want to fall back to a different language instead of skipping a missing translated page. In such mode, then 2 would make sense.

The second problem I reported is fixed by #2976.

Contributor

aroig commented Jan 22, 2017

Please don't use "broken" unless you have a well defined "correct solution".

I was thinking of 2 above, but as you point out this can't be a general solution because of missing translated pages. In that case, I agree that current behavior is ok.

In a blog-like site, one may want to fall back to a different language instead of skipping a missing translated page. In such mode, then 2 would make sense.

The second problem I reported is fixed by #2976.

@bep bep closed this in #2976 Feb 19, 2017

bep added a commit that referenced this issue Feb 19, 2017

hugolib: Discard current language based on .Lang()
Otherwise we fail to skip the current language in translations
for paginated pages.

Fixes #2972
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment