Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Page is not reloading/refreshing when switching languages in navigation menu UI #4711

Closed
thabaum opened this issue Oct 5, 2024 · 10 comments

Comments

@thabaum
Copy link
Contributor

thabaum commented Oct 5, 2024

Oqtane Info

Version - 5.3.4
Render Mode - Static
Interactivity - Server
Database - SQL Server

Describe the bug

After switching languages in the LanguageSwitcher.razor component the page is not reloaded or refreshed to show the language did in fact change.

Expected Behavior

Language in the UI will change once the language is changed in the navigation menu control.

Steps To Reproduce

  1. Install multiple languages in the language management control panel.
  2. Switch between languages and notice how the language of the administration page for languages and the UI control for switching languages does not update in the UI to reflect the new language selected.

Anything else?

NavigationManager.NavigateTo(NavigationManager.Uri.Replace($"?culture={culture}", ""), true);

I updated the line in LanguageSwitcher.razor like above still same results, the UI does not update without refreshing the page manually in the browser to the view the language selected.

?culture={culture} will appear in the URL for a moment then gets removed with the culture variable replaced with the selected language abbreviation.

This was discovered while working with the issue in discussion #4703

Issue https://github.com/oqtane/oqtane.framework/pull/4493/files was working in the area of the cookie which was thought to have had been the issue updating the httpOnly setting to false, however I was not able to reproduce any different results as a page refresh would display the changes to the UI updated with the language selected.

@thabaum
Copy link
Contributor Author

thabaum commented Oct 6, 2024

I am thinking maybe an issue with "Enhanced Navigation" potentially thinking more about the issues we have had in the past relating. This language switcher control is in the Oqtane Navigation menu and does not seem to "reload/refresh" the UI content for the control itself and the content within the content pain.

@sbwalker
Copy link
Member

@thabaum with the latest changes and using Static Rendering, I am not able to reproduce what you are describing above. If I have multiple languages in my site and I select a language from the Language Switcher I can see the cookie being updated in my browser dev tools and when I click the down arrow in the Language Switcher I can see that the new language is highlighted.

@sbwalker
Copy link
Member

sbwalker commented Oct 14, 2024

I think what you may be referring to is the names of the Languages in the Language Switcher are not changing based on the item selected by the user. This is actually a caching issue, as the list of languages is cached for the site - not based on the UI culture of the current user.

@thabaum
Copy link
Contributor Author

thabaum commented Oct 14, 2024

@sbwalker yes this is the issue. The admin page is not changing, but if you are navigating around after switching it seems OK. I dont see any other way to test langauges on different pages switching between. I am not sure what language packs are even updated such as for the control panel I see english when using dutch.

image

So to see it in action like you described, the Language Management has been what I have used to see the updates. I have to hit refresh to see them update in static mode only I believe.

@sbwalker
Copy link
Member

@thabaum #4729 fixes the issue with the language names not being localized based on the current users UI culture

@thabaum
Copy link
Contributor Author

thabaum commented Oct 14, 2024

image

it fixes it in this area

but the language manager still stays the same

image
image

@sbwalker
Copy link
Member

The labels in the UI and the list of language names in the Language Switcher are actually based on totally different concepts. UI labels will not change unless you have a translation package installed for the language you choose from the Language Switcher - if no translation package exists, it will display the fallback which is English

@thabaum
Copy link
Contributor Author

thabaum commented Oct 14, 2024

I hit refresh and I get this:

image

@sbwalker
Copy link
Member

Ok I will need to look into Language Management tomorrow - it is probably a caching issue as well

sbwalker added a commit that referenced this issue Oct 15, 2024
fix #4711 - full page refresh required to affect language changes
@sbwalker
Copy link
Member

sbwalker commented Oct 15, 2024

#4732 resolves this issue. It requires the use of data-enhance-nav="false" to force a full page refresh on the language hyperlinks. The user experience is not optimal when using a full page refresh - but it is consistent with the experience when using fully interactive render mode.

Note that the full page refresh is only required when there are interactive components on a static page (ie. all of the admin pages, etc...) as the interactive components run in their own process and do not get access to the new cookie value unless a full page refresh is performed.

I discovered a few other oddities while investigating this problem and will log a separate issue to describe them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants