Allow admins the option to show the header language switcher even for logged-in users

AI-generated summary

The discussion revolves around enhancing the language switcher feature in Discourse to allow administrators to display the header language switcher for logged-in users, not just anonymous ones. Currently, the content localization anon language switcher setting restricts the switcher to non-logged-in users. The proposed changes include renaming the setting to remove “anon,” expanding options to include “none,” “anonymous,” and “all,” and updating the language selection for logged-in users to use user.locale instead of cookies. The feature has been implemented and merged via PR #34578, with a video demonstrating the updated behavior. There is also consideration to phase out the language selector in /my/preferences/interface in favor of the header switcher for a more cohesive user experience. nat and Jagster briefly comment on the implementation and its implications.

Currently, the site setting content localization anon language switcher is a toggle to show the language switcher only for non-logged-in users.

Screenshots 📸

The Setting

The Switcher

There have been some requests to expand this to allow logged-in users to set the language from the header as well.

The work here would involve

  • updating the setting name to exclude “anon”
  • expanding the setting to “none”, “anonymous”, “all”

  • the anon language is tracked via cookies, switching the language in logged-in should update the user.locale instead of cookies

By completing this, we should also update related topics (e.g. Header Locale Selector) that this is now possible in core.

11 Likes

This is now done and merged - FEATURE: Also allow language switcher to be shown when users are logged in by nattsw · Pull Request #34578 · discourse/discourse · GitHub.

Here’s the video that was included in the PR description showing how it should behave.

Something we may consider is perhaps to retire the one shown in /my/preferences/interface in favour of this one for a better experience where the site owner may choose the available languages for the site. We’ll have a few discussions internally first.

9 Likes

That video shows same time why AI-summaries should be translated too :joy:

1 Like

I hear you.. All in due time.

5 Likes

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