Open idontknowjs opened 3 years ago
Hey @kelson42 , can I work on it :)
@covalentbond Explain first here how you want to fix it, and get an approval. Then you should provide the solution.
We can write a function to detect the pathname of the webpage with window.location.pathname
, depending upon the string variable. The value can be stored like window.localStorage.setItem('lang', 'fr')
.
Again whenever a user visits the page, it will check in window.localStorage
if there is some preferred value present or not. If present then we can redirect the user to window.location.pathname + /{that_lang}, else it will render the page in en
by default
Other than that, a new feature can also be added to automatically detect the user's preferred language of the device - the website is being viewed on. You can console this value window.navigator.language
, it will show the default language preference of the your device. And we automatically render it to fr
or de
.
But, I'm not aware where is the repository for kiwix.org :)
I confirm the issue (both on Chrome and Firefox) but considering the website is on Wordpress I'm slightly surprised we'd need a direct fix. @martin8032 thoughts?
This issue has been automatically marked as stale because it has not had recent activity. It will be now be reviewed manually. Thank you for your contributions.
Do not mark it as stale
This is something WPML (the multilingual plugin on our WordPress website) should handle, but as far as I can see it's not implemented yet:
https://wpml.org/forums/topic/remember-language-choice-3/
I agree that remembering the last language choice would be a nice feature. On the other hand, since so little of our website is currently translated I'd rather recommend to have an exclusively English website anyway.
This issue has been automatically marked as stale because it has not had recent activity. It will be now be reviewed manually. Thank you for your contributions.
Describe the bug The language changed on the website always open in
en
, irrespective the user might have already translated the website to a specific language. The language preference of the user is never stored. Once the tab is closed and when user visits website , the website loads in defaulten
onlyTo Reproduce Steps to reproduce the behavior:
Expected behavior It should open in the translated language ie
fr
, https://www.kiwix.org/fr/Additional context This could be achieved by storing the user language preference in
local storage
, and rendering the website depending upon thelanguage value
stored in local storage.I would like to work upon this