question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Feature suggestion: automatically redirect user to last selected language

See original GitHub issue

I want to suggest an idea and checked that …

  • … to my best knowledge, my idea wouldn’t break something for other users
  • … the documentation does not mention anything about my idea
  • … there are no open or closed issues that are related to my idea

Description

When using the alternate feature, it would be nice if the selected language was saved in local storage.

Use Cases

Build features on top of being able to tell which language a user selected.

Screenshots / Mockups

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
squidfunkcommented, Jun 20, 2021

Okay, so we could persist the hreflang value when switching languages:

https://github.com/squidfunk/mkdocs-material/blob/a4a00af0177e4d50e0af47ae2edb2723b4c50c28/src/partials/header.html#L118

That could actually work. However, it would only be sensical when the language-based routing (aka “Stay on page when switching languages”) is implemented. Then, we could detect the last-selected language and route the user automatically to the respective page, given that the pages have the same file name (= URL) in both languages. Otherwise, it would fall back to the homepage.

0reactions
squidfunkcommented, Oct 7, 2021

This issue has currently zero interest in the community, which is why I’m not considering it for implementation. The desired behavior can be achieved via theme extension and some additional JavaScript.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Best practices for language redirection - Weglot
A much less tedious and user-friendly option is to automatically redirect to alternative languages. And so, this is what we'll be focusing on ......
Read more >
how to automatically redirect the user to a specific language in ...
1 Answer 1 · Don't change anything. Django's locale middleware is quite good at discovering language preferences and redirects users to their ...
Read more >
Automatic User Language Detection in TranslatePress
Automatic User Language Detection in TranslatePress ... Redirecting visitors to their own language preference based on browser language or IP ...
Read more >
REDIRECT USER BY LAST SELECTED LANGUAGE - WPML
I have a website with 2 languages ​​namely PT (as default language) and EN is it possible for me to redirect users based...
Read more >
Smart Language Redirects Or How To Quickly Autotranslate Shopify ...
With this request the system receives the browser language and IP address data, which is detected with auto detection mode. And based on...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found