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

regression: IsTranslated can be wrong for "node types" #2812

Closed
pierreozoux opened this Issue Dec 21, 2016 · 4 comments

Comments

Projects
None yet
2 participants
@pierreozoux

pierreozoux commented Dec 21, 2016

Hello and thanks for the great work :)

I have a quick question (referring to this issue )

Our website is printing a little icon "fr" link for french translation of the home page.
(You can see it in action here: https://indie.host/ on the top right)
This was built with 0.17.

I just tried with 0.18, and the "fr" link disappeared.
I checked the value of "IsTranslated" and it is to false.

Could you tell us what happened during the upgrade, and what can we do to fix?

You can find the code for the website here:
https://git.indie.host/meta/website/tree/master

Thanks a lot!

@bep bep added the Bug label Dec 21, 2016

@bep bep added this to the v0.19 milestone Dec 21, 2016

@bep

This comment has been minimized.

Show comment
Hide comment
@bep

bep Dec 21, 2016

Member

Hey and thanks for the bug report.

It is the IsTranslated that is faulty.

In your case you can just remove this:

   {{ if .IsTranslated }}

If you want to replace that conditional until we get a fix for this, you can do something like this:

   {{ if gt (len .Translations) 0 }}
Member

bep commented Dec 21, 2016

Hey and thanks for the bug report.

It is the IsTranslated that is faulty.

In your case you can just remove this:

   {{ if .IsTranslated }}

If you want to replace that conditional until we get a fix for this, you can do something like this:

   {{ if gt (len .Translations) 0 }}
@bep

This comment has been minimized.

Show comment
Hide comment
@bep

bep Dec 21, 2016

Member

Note to self, the IsTranslated func actually looks correct, so there must be something other going on. (but the workaround still holds)

Member

bep commented Dec 21, 2016

Note to self, the IsTranslated func actually looks correct, so there must be something other going on. (but the workaround still holds)

bep added a commit that referenced this issue Dec 21, 2016

@bep

This comment has been minimized.

Show comment
Hide comment
@bep

bep Dec 21, 2016

Member

OK, now I see it. IsTranslated is wrong for sites with only 1 translation.

Member

bep commented Dec 21, 2016

OK, now I see it. IsTranslated is wrong for sites with only 1 translation.

@bep bep changed the title from 0.18 regression about multilingual support to regression: IsTranslated can be wrong for "node types" Dec 21, 2016

@pierreozoux

This comment has been minimized.

Show comment
Hide comment
@pierreozoux

pierreozoux Dec 21, 2016

Happy that it helped! And thanks for your reactivity!

pierreozoux commented Dec 21, 2016

Happy that it helped! And thanks for your reactivity!

@bep bep modified the milestones: v0.18.1, v0.19 Dec 25, 2016

bep added a commit to bep/hugo that referenced this issue Dec 26, 2016

hugolib: Fix IsTranslated for "old" node types
The new logic for creating Page objects from old node types
didn't include itself in the translation logic, so
`IsTranslated` returned falsely false for sites with only two languages.

The `AllTranslations` method also returned too few pages in that case.

This commit fixes that.

Fixes gohugoio#2812

@bep bep closed this in #2834 Dec 27, 2016

bep added a commit that referenced this issue Dec 27, 2016

hugolib: Fix IsTranslated for "old" node types
The new logic for creating Page objects from old node types
didn't include itself in the translation logic, so
`IsTranslated` returned falsely false for sites with only two languages.

The `AllTranslations` method also returned too few pages in that case.

This commit fixes that.

Fixes #2812

bep added a commit that referenced this issue Dec 29, 2016

hugolib: Fix IsTranslated for "old" node types
The new logic for creating Page objects from old node types
didn't include itself in the translation logic, so
`IsTranslated` returned falsely false for sites with only two languages.

The `AllTranslations` method also returned too few pages in that case.

This commit fixes that.

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