Multilanguage Support

Hello all, first time I am trying multilanguage feature for one of my clients and I’ve succeed so far except the menu. Everything else including content is changing but the menu will not be translated.

I am using Hugo v0.55.6/extended and here is my config.toml file.

baseURL = “/”
languageCode = “en-us”
title = “New Site Title”
themesDir = “…/…”

defaultContentLanguage = “en”
defaultContentLanguageInSubdir = true

[menu]
[[menu.main]]
name = “Home”
url = “/”
weight = 1

[[menu.main]]
name = “About Us”
url = “/about/”
weight = 2

[[menu.main]]
name = “News”
url = “/news/”
weight = 3

If I add [[menu.main]] like above I can see the menu and it will work but it will not be translated. Without it, the menu will not be visible if I use only the languages settings below.

[Languages.en]
title = “New Site Title English”
weight = 1
languageName = “English”

[[languages.en.menu.main]]
name = “Home”
url = “/”
weight = 1

[[languages.en.menu.main]]
name = “About Us”
url = “/about/”
weight = 2

[[languages.en.menu.main]]
name = “News”
url = “/news/”
weight = 3

[Languages.pl]
title = “New Site Title Polish”
weight = 2
languageName = “Polish”

[[languages.pl.menu.main]]
name = “Home”
url = “/”
weight = 1

[[languages.pl.menu.main]]
name = “O nas”
url = “/about/”
weight = 2

[[languages.pl.menu.main]]
name = “Aktualności”
url = “/news/”
weight = 3

I am really confused now I cannot see the mistake clearly here. Could somebody please help me to clarify the problem here?

Thanks in advance!

I think you are missing the first call to [Languages.en.menu]

For example:

[Languages.en.menu]

[[Languages.en.menu.main]]
name = "Stories"
url = "/story/"
weight = 2
post = "Come sit by the table, have a drink and read a tale"```
2 Likes

Hello brunoamaral,

I removed all language settings, used your code and worked like a charm. Even though I used the same structure, somehow things were messed up I believe.

Thanks a lot.

1 Like

I’m pretty sure you needed the part in bold :slight_smile:
Either way, I’m happy you got it working!

1 Like