Skip to content

Conversation

@rudy128
Copy link
Contributor

@rudy128 rudy128 commented Jan 15, 2026

📌 Fixes

Fixes #605


📝 Summary of Changes

This PR fixes critical localization issues where users were being redirected to English (/en) pages when navigating from non-English locales. The issue occurred when users selected a language (e.g., Japanese, Spanish, German) and then navigated to certain pages like /ladder, /partners, or clicked links from the documentation navbar.

Key Problems Solved:

  • Language selection was not preserved when navigating to /ladder, /partners, or contact pages
  • CORS errors occurred when clicking links from DocsNavbar due to incorrect URL resolution
  • Localized docs URLs (e.g., /es/docs/...) were not being redirected to the English-only documentation

Changes Made

1. Middleware Updates (src/middleware.ts)

  • Removed /ladder from the i18n middleware exclusion list to enable locale processing
  • Added automatic redirect logic for localized docs URLs (e.g., /es/docs/.../docs/...)
  • Ensured documentation remains English-only while other pages support all 10 locales

2. Navbar Component (src/components/Navbar.tsx)

  • Refactored to import both LocalizedLink (from @/i18n/navigation) and regular Link (from next/link)
  • Updated /ladder links to use LocalizedLink for locale preservation (desktop & mobile)
  • Updated /partners links to use LocalizedLink for locale preservation (desktop & mobile)
  • Updated /#contact links to use LocalizedLink for locale preservation (desktop & mobile)
  • Kept /docs/... links using regular Link to maintain English-only documentation

3. DocsNavbar Component (src/components/docs/DocsNavbar.tsx)

  • Added getBaseUrl import to properly construct absolute URLs
  • Updated /ladder links to use getBaseUrl() to prevent CORS errors (desktop & mobile)
  • Updated /partners links to use getBaseUrl() to prevent CORS errors (desktop & mobile)
  • Updated /#contact links to use getBaseUrl() to prevent CORS errors (desktop & mobile)
  • Ensured proper URL construction for both development (localhost) and production environments

Checklist

Please ensure the following before submitting your PR:

  • I have reviewed the project's contribution guidelines.
  • I have written unit tests for the changes (if applicable).
  • I have updated the documentation (if applicable).
  • I have tested the changes locally and ensured they work as expected.
  • My code follows the project's coding standards.

Screenshots or Logs (if applicable)

output.mp4

Before Fix:

✗ Navigate to /es/ladder → Click Partners → Redirects to /en/partners
✗ Navigate to /ja/ladder → Click Contact → Redirects to /en/#contact
✗ From /docs page → Click Ladder → CORS error trying to fetch https://kubestellar.io/en/ladder
output.mp4

After Fix:

✓ Navigate to /es/ladder → Click Partners → Stays at /es/partners
✓ Navigate to /ja/ladder → Click Contact → Stays at /ja/#contact
✓ From /docs page → Click Ladder → Successfully navigates to http://localhost:3000/en/ladder (in dev)
✓ All localized URLs properly maintain user's selected language
✓ Documentation URLs correctly strip locale prefix (e.g., /es/docs/... → /docs/...)

👀 Reviewer Notes

Testing Recommendations:

  1. Test language switching on the homepage and verify navigation to /ladder, /partners, and /#contact preserves the locale
  2. Test from /docs pages that clicking Ladder/Partners/Contact links work without CORS errors
  3. Verify that directly accessing localized docs URLs (e.g., /ja/docs/...) redirects to /docs/...
  4. Test on both localhost (dev) and production/preview environments

Architecture Notes:

  • The site now uses a hybrid approach: LocalizedLink for i18n pages and regular Link for docs
  • DocsNavbar uses getBaseUrl() for cross-environment compatibility (localhost vs production)
  • Middleware handles automatic redirects for localized docs URLs while allowing other pages to be localized
  • All 10 supported locales (en, hi, ja, es, de, fr, it, SC, zh-TW, pt) now work correctly for non-docs pages

Signed-off-by: Pratham Kamthan <prathamkamthan1306@gmail.com>
…nalization support in Navbar

Signed-off-by: Pratham Kamthan <prathamkamthan1306@gmail.com>
Signed-off-by: Pratham Kamthan <prathamkamthan1306@gmail.com>
@kubestellar-prow kubestellar-prow bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Jan 15, 2026
@kubestellar-prow
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign vedansh-5 for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@github-actions
Copy link
Contributor

Welcome to KubeStellar! 🚀 Thank you for submitting this Pull Request.

Before your PR can be merged, please ensure:

DCO Sign-off - All commits must be signed off with git commit -s to certify the Developer Certificate of Origin

PR Title - Must start with an emoji: ✨ (feature), 🐛 (bug fix), 📖 (docs), 🌱 (infra/tests), ⚠️ (breaking change)

Getting Started with KubeStellar:

Contributor Resources:


🌟 Help KubeStellar Grow - We Need Adopters!

Our roadmap is driven entirely by adopter feedback. Whether you're using KubeStellar yourself or know someone who could benefit from multi-cluster Kubernetes:

📋 Take our Multi-Cluster Survey - Share your use cases and help shape our direction!


A maintainer will review your PR soon. Feel free to ask questions in the comments or on Slack!

@kubestellar-prow kubestellar-prow bot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jan 15, 2026
@kubestellar-prow
Copy link

Hi @rudy128. Thanks for your PR.

I'm waiting for a kubestellar member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@netlify
Copy link

netlify bot commented Jan 15, 2026

Deploy Preview for kubestellar-docs ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 80bba9e
🔍 Latest deploy log https://app.netlify.com/projects/kubestellar-docs/deploys/69689cd71b8ce30008fcf649
😎 Deploy Preview https://deploy-preview-730--kubestellar-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@rudy128 rudy128 changed the title Issue/#605 fix(i18n): preserve locale selection across navigation and prevent CORS errors Jan 15, 2026
@rudy128
Copy link
Contributor Author

rudy128 commented Jan 15, 2026

@naman9271 @oksaumya please review this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dco-signoff: yes Indicates the PR's author has signed the DCO. frontend needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. typescript

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: Language selection resets to EN on Ladder page

1 participant