Suggestion for simple language navigator/switch

Hi,

I’m having problems with getting a simple (two langage) navigator. I’m not a programmer so I first tried the hugo-bootstrap-premium theme which is multilingual, but when I follow the setup guide, even with the example site, the language switcher doesn’t work.

I then tried to do something with menus with the following:

    cat language.md
---
date: 2018-03-10
linktitle: "Français" 
draft: false
menu:
  main:
#prev: /
title: "Français"
weight: 10
url: /fr

And

cat language.fr.md 
---
date: 2018-03-10
linktitle: "English" 
draft: false
menu:
  main:
#prev: /
title: "English"
weight: 10
url: /
---

It switches nicely from English to French, but not back. I tried changing the url to /en as well but the top menubar stays in French. (even thought the url shows localhost:1313/) Maybe some caching or something? Or on the other hand, once the site is in French, the “English” menu appears, but when I hover over it, then it shows in the browser bottom left that it effectively wants to go to localhost:1313/fr.

Can someone point me to a tutorial that can help a junkyard cut and paste programmer to get a language navigator working? Thanks!!!

Not sure if you can add a language sWitcher to à Hugo menu, I would guess not. But you can try and add the following to your templates.

{{ range .Translations }}
	<a href="{{ .Permalink }}">{{ .Lang }}</a>
{{ end}}

Thank you very much! I put in the header.html and it works. It would be so nice for newbies like me to be able to define a (dropdown) menu item to refer to this.

You can use .AllTranslations. This one returns the current translation along the other ones.

See the doc for more info on this. All your questions seem to be answered there.