The language switcher is a small component with an outsized effect on whether a multilingual site feels considered. It has one job: let a reader move to another version of the page they are reading, and stay on that page. Most switchers fail at that, either by dumping the reader on a home page or by deciding for them based on where their IP says they are.
Stay on the page, always
If a reader is on the pricing page and switches to German, they should arrive on the German pricing page. If that page does not exist, say so and offer the German home page, rather than silently going there. This requires the switcher to know which locales the current page exists in, which is the same record the tags come from and the reason both should come from one source.
Do not decide for the reader
Automatic redirection by IP is the most common complaint about multilingual sites, because the assumption is wrong constantly: travellers, expatriates, bilingual readers, anyone on a VPN. Suggest a version, remember the choice, and never override an explicit one. A crawler is also badly served by a forced redirect, which is a search problem on top of a courtesy one.
Name the languages in their own language
Deutsch, not German. Espanol, not Spanish. A reader who does not read your source language cannot find their own language in a list written in it, which is the whole population the switcher exists for. Flags are worse than names: a flag is a country and a language is not.
Where it sits
Top of the page for a site whose readers switch often, footer for a site where most readers arrive in the right version from search. Both are defensible; a switcher that is only in the footer on some templates is not.
Questions people ask about language switcher
Should the switcher use flags?
No. A flag is a country, and languages are not countries. Names in their own language are unambiguous and translate themselves.
Should we detect the reader's language automatically?
Suggest, do not redirect. Remember an explicit choice and never override it, and leave a crawler able to reach every version.
What if a page has no version in the chosen language?
Say so and offer the nearest thing, rather than redirecting silently to a home page. The switcher should know, because the record knows.
How should the switcher link the versions in the HTML?
As ordinary links to the other versions' URLs, one per locale, readable by a crawler without a script running, with the language name as the link text and the hreflang attribute on the anchor where the framework allows it. A switcher built as a JavaScript dropdown that changes a cookie and reloads gives a crawler nothing to follow.
Should the switcher remember the choice across visits?
Yes, and remembering is different from redirecting: a returning reader lands on the version they chose last time, and a new reader lands where the URL says. The choice is stored, the URL is never overridden by it, and the crawler sees a page that does not move.