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

UI Does Not Update in Real-Time When Culture is Changed #1

Open
Peppe426 opened this issue Jul 18, 2024 · 0 comments
Open

UI Does Not Update in Real-Time When Culture is Changed #1

Peppe426 opened this issue Jul 18, 2024 · 0 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@Peppe426
Copy link
Owner

Overview:

The application's UI does not update in real-time to reflect changes in the culture settings. The culture setting change is being persisted correctly in the preferences, and the application reflects the new language settings upon restart. However, the expected real-time UI update to reflect the new culture settings does not occur.

Files Involved:

  1. CultureInfoService.cs (Infrastructure)
    • This static class is responsible for managing the application's culture settings. It includes a method SetCultureInfo(CultureInfo? cultureInfo) that sets the new culture for the application. This method also persists the selected culture in the preferences using Preferences.Set(LANGUAGE_PREFERENCE, cultureInfo.Name);. An event CultureChanged is raised whenever the culture is changed to notify other parts of the application.

  2. SiteSettingsPanel.razor.cs (Components/Panels)
    • This component allows users to change the application's culture settings. It subscribes to the CultureChanged event from CultureInfoService to react to changes in the application's culture. The method OnCultureChanged() is intended to trigger a UI update when the culture changes, but the real-time update does not occur as expected.

Expected Behavior:

When a user changes the language setting through the SiteSettingsPanel, the application's UI should immediately reflect the new culture settings without requiring a restart.

Current Behavior:

The culture change is successfully persisted in the preferences, and the application reflects the new language settings upon restart. However, the UI does not update in real-time to reflect the new culture settings when changed.

Steps to Reproduce:

  1. Open the application and navigate to the SiteSettingsPanel.
  2. Change the language setting.
  3. Observe that the UI does not update to reflect the new language setting in real-time.
  4. Restart the application.
  5. Observe that the application now reflects the new language setting.

Potential Areas for Investigation:

• Ensure that the CultureChanged event in CultureInfoService.cs is correctly hooked up and that the event handler in SiteSettingsPanel.razor.cs is being invoked.
• Investigate how the StateHasChanged() method is used in SiteSettingsPanel.razor.cs to ensure it triggers a re-render of the component and its children.
• Review the overall mechanism for notifying components of culture changes to ensure it is robust and capable of triggering the necessary UI updates across the application.

@Peppe426 Peppe426 added enhancement New feature or request help wanted Extra attention is needed labels Jul 18, 2024
@Peppe426 Peppe426 pinned this issue Jul 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant