How does IsTranslated determine that a post is translated

Hi!

I’ve been testing Hugo for a while, gently migrating my blog from Jekyll. I have some questions about i18n and more specificaly, I don’t understand how the .IsTranslated param works because it seems to always be true.

Maybe is it relative to the organization of my content, I don’t know.

For example, for this french content: “À l’aventure” (source) Hugo defines that an english translation is available and that it is “Opera Dragonfly Search Form is great” (source). But for that one, Hugo then decides that the more accurate french content is “Petits utilitaires du quotidien sous XP” (/master/content/default/2006/08/petits-utilitaires-du-quotidien-sous-xp/index.fr.md). These three posts have only a common filename (index.md or index.en.md).

It seems that even when Hugo does not find a translation, it is considering the oldest index.{{lang}}.md as a valid one. Does somebody have another explanation?

As you already concluded, Hugo uses file names to match regular page translations. And by naming all your content files with the same name, you cannot currently use this feature.

1 Like

Thanks a lot for the hard work around the development, first of all, and your answer too.

If I understand correctly, any content that have the same filename will be considered a plausible translation for another, even if they are not at all in the same place (different sections, pages vs. content)… ? I’ll consider naming the content files with the publication date, accordingly.

I curiously did not implement this “translation logic” myself, hence I just created this issue:

But adding the “section” to the mix may break more than it solves, not sure.

But the above issue would not help you, so I suggest you add some kind of identifier to the base filenames. For the oter page types, this is slightly simpler.