Question about filling in translation gaps

Hello, this is a great feature. Already using it. Thanks.
But i have some trouble for doing something a bit more sophisticated.

  • Use case for a FR + EN blog.
  • We have most of FR only blogs, some EN only and some FR+EN.
  • I can fill in EN list with FR blog posts with the above method. Nice.

But when I have a translated post (same /content/french/news/myFR+ENpost & /content/english/news/myFR+ENpost), It always get the FR post and I find no way to propose the EN post in the EN language.

I’m pretty sure this is obvious to do but no luck.
Any tip/ligh/help welcome.

[module]
  [module.hugoVersion]
   min = '0.96.0'

# EN content
[[module.mounts]]
source = 'content/english/news'
target = 'content/news'
lang = 'en'

# FR content
[[module.mounts]]
source = 'content/french/news'
target = 'content/news'
lang = 'fr'

# Fill in the missing translations
[[module.mounts]]
source = 'content/french/news'
target = 'content/news'
lang = 'en'

I don’t understand. Please clarify.

Dear @jmooring thanks for making a proper thread, and sorry not being crystal clear.

My content structure

- Content
  - english
    - news
      - post-1 [EN only]
      - post-2

  - french
    - news
      - post-2
      - post-3 [FR only]
      - post-4 [FR only]

So my post2 is translated in FR and in EN

Basic behaviour

Basically it works. EN site shows EN posts and FR shows FR post. Classic.

Web site in EN, the news list:

  • post1 (en)
  • post2 (en)

Web site in FR, the news list:

  • post2 (fr)
  • post3 (fr)
  • post4 (fr)

New v0.96.0 behaviour

  • I upgraded to v0.96.0 to be able to have FR posts on the EN site.
  • It works really well with the setup you gave on the previous post

Web site in EN, the news list:

  • post1 (en)
  • post2 (fr)
  • post3 (fr)
  • post4 (fr)

The “problem” : My post2 is translated in FR and in EN. But with this setup, I can’t get the post2 showing up in english. Only the Post2 in french is showing up.
Looking at the config, this seems normal because we told to override the EN with FR. Works “as should technically be”.

My config.toml setup for this:

[module]
  [module.hugoVersion]
   min = '0.96.0'

# EN News content
[[module.mounts]]
source = 'content/english/news'
target = 'content/news'
lang = 'en'

# FR News content
[[module.mounts]]
source = 'content/french/news'
target = 'content/news'
lang = 'fr'

#------------------------------------------------------------------------------
# Fill in the missing translations
#------------------------------------------------------------------------------
# This fills in the gaps in missing EN content with FR content
[[module.mounts]]
source = 'content/french/news'
target = 'content/news'
lang = 'en'

My sophisticated expected behaviour

Because my post2 is already translated in EN, I would like to have it showing up in EN on the EN site version.

Web site in EN, the news list I’d like :

  • post1 (en)
  • post2 (en) => because we are in the EN site, even if post2 (fr) exists.
  • post3 (fr)
  • post4 (fr)

I tried a lot of conf but failed to achieve this.

I cannot reproduce the problem. Perhaps I’m doing something wrong.

git clone --single-branch -b hugo-forum-topic-37916 https://github.com/jmooring/hugo-testing hugo-forum-topic-37916
cd hugo-forum-topic-37916
hugo server
3 Likes

Mmmmm, thanks a lot. Yes your example works as I wish.

I’ll look closely for every difference who could explain.

Million thanks Joe.

2 Likes

Mmmmmm. Works now.
Only difference was an other mount directives I had during my tests. And mount order.
I removed them and works now.
Thanks a lot and sorry for the noise.

# FR content
#[[module.mounts]]
#source = 'content/french'
#target = 'content'
#lang = 'fr'
# EN content
#[[module.mounts]]
#source = 'content/english'
#target = 'content'
#lang = 'en'
3 Likes

By the way, hugo new features keep on going amaze me.

This feature is really supra/hypra/uber cool.

2 Likes

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.