[SOLVED] DefaultContentLanguage does not seem to work

I’ve been fiddling with the multilingual feature, and just found an issue today.
Up until now I didn’t see it because I was using DefaultContentLanguage = "en" . Today I changed to DefaultContentLanguage = "de" and it turned out that the default language of the site is still English.

Here a simplified version of my config:

IsMultiLingual = true
DefaultContentLanguage = "de"
DefaultContentLanguageInSubdir = false

    weight = 2
    title = "Meine Website auf Deutsch"
    languageName = "Deutsch"

    name = "Startseite"
    weight = -110
    identifier = "home"
    url = "/"

    weight = 1
    title = "My site in English"
    languageName = "English"
    name = "Home"
    weight = -110
    identifier = "home"
    url = "/"

If I use this config, the English version is being served by default. Now, if I remove completely the English part, the German version comes up (which shows that the config should be OK).

I’ve also tried to change the weight parameter for both languages but it still doesn’t work for me.

Has anyone seen this issue before?

I just tested this by switching the default in one my my sites and that worked fine back and forth.

Anyone else? @digitalcraftsman ?

FYI - I’m using a version compiled today Hugo Static Site Generator v0.17-DEV BuildDate: 2016-09-21T08:13:23Z on Ubuntu 14.04.3 LTS, Trusty Tahr

btw, would it not be useful to add the git-hash in the version info for debugging purposes?

Build with Make and you get a git hash.

I will add a test for this later.

Yes, and I suspect that is your issue. The default content language in subdir feature was added late in the development cycle, so you should pull the latest Hugo and build that.

The new automated test also passes on all OS:

So, I’ve pulled the latest source and built Hugo using make and this is what I get when I print {{ .Hugo.CommitHash }}: 2071d47

That should mean I have the latest and greatest installed right?
However, it still doesn’t work for me.

As an experiment, I have completely removed the English language from my site and replaced all occurences of “en” to “fr” (in the menus, config, i18n files etc) I’ve also changed all extensions of the content files to filename.fr.md and filename.de.md. Both french and german languages get generated in their respective subdir, however, and that’s interesting, the en subfolder still gets generated even now where I have nothing in english.

Yes. I would have to see the complete site source of your project to be able to help further

So, I have much simplified my site, removing all unnecessary files, and pushed it on github https://github.com/aubort/loyall. This branch has the issue we are talking about on my side. Hopefully we are going to be able to find out what’s going on.

See https://github.com/aubort/loyall/blob/simple/config.toml#L6

According to the TOML spec, only maps/dictionaries can follow maps/dictionaries. You can confirm by doing a hugo config, but in your case you get the default, which is en.

Oh shoot… Thanks much for having pointed this out, it’s working well now. Sorry for wasting your time on this non-issue.

By the way

IsMultiLingual = true

Isn’t doing anything. A site is multilingual if number of languages > 1.