Skip to content

Fix: Support dynamic locale switching (Fixes #85)#101

Open
robotex82 wants to merge 1 commit intoGuavaCZ:mainfrom
robotex82:bugfix/85-locale-changing
Open

Fix: Support dynamic locale switching (Fixes #85)#101
robotex82 wants to merge 1 commit intoGuavaCZ:mainfrom
robotex82:bugfix/85-locale-changing

Conversation

@robotex82
Copy link
Copy Markdown

Fix: Support dynamic locale switching (Fixes #85)

Description

This PR fixes an issue where documentation content and the sidebar would stick to the boot-time locale (typically from .env), ignoring runtime locale changes (e.g., via middleware).

Changes

  1. Multi-Locale Loading: Updated FlatfileNode::getRows() to scan and load documentation for all available locales found in the docs directory, rather than just the current app locale.
    • Records are now namespaced by locale (e.g., de.welcome) to prevent ID collisions in the Sushi cache.
    • Added a locale column to the FlatfileNode schema.
  2. Strict Filtering: Added a Global Scope to FlatfileNode that filters all queries by App::getLocale().
    • This ensures that FlatfileNode::all(), used by the sidebar navigation builder, only returns items for the current user's language.
    • This prevents "sidebar leakage" where English items would appear for German users if navigation was built before the locale switch.
  3. Route Binding: Updated resolveRouteBindingQuery to scope lookups to the current locale.

Verification

Verified that switching the user's locale at runtime correctly updates both the documentation content and the sidebar navigation structure.

@robotex82 robotex82 force-pushed the bugfix/85-locale-changing branch from ea48fdc to e5a32a8 Compare December 17, 2025 02:42
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

Successfully merging this pull request may close these issues.

[Bug]:The Documentatiton tab does not respect the language change

1 participant