Bug Fix: Language Switcher Not Updating UI #4#7
Open
arnab9957 wants to merge 2 commits intoeccentriccoder01:mainfrom
Open
Bug Fix: Language Switcher Not Updating UI #4#7arnab9957 wants to merge 2 commits intoeccentriccoder01:mainfrom
arnab9957 wants to merge 2 commits intoeccentriccoder01:mainfrom
Conversation
|
@arnab9957 is attempting to deploy a commit to the eccentriccoder01's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Owner
|
@arnab9957 Thanks for raising the PR... Kindly look into this error which popped up in the preview deployment, there are some issues involving duplicate keys and unnecessary characters: |
Author
|
Fixed this issue; please check that |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix Language Toggle Not Updating Content
📝 Description
This PR resolves the issue where switching the language (Hindi/English) in the sidebar would not update the page content, specifically on the Shopping Bag page and Vendor Dashboard. The issue was caused by hardcoded text in components, static mock data, and missing translation keys.
🔄 Changes
1. Dynamic Shopping Bag (Key Fix)
src/pages/Bag.js:
Refactored mock data to include both English and Hindi fields (e.g., ItemNameEn, descriptionEn).
Implemented dynamic logic to serve the correct language data based on the selected language.
Added language dependency to useEffect to trigger content updates immediately upon toggling.
Destructured language from useLanguage() to ensure reactivity.
2. Component Refactoring & Translation
src/components/OrderSummary.js & src/components/CartItem.js:
Replaced hardcoded Hindi text with dynamic t() function calls.
Imported and utilized useLanguage hook.
3. Language Context Updates
src/context/LanguageContext.js:
Added 15+ missing translation keys to support the Shopping Bag and Order Summary (e.g., orderSummary, subtotal, securePayment, delivery).
4. Build & Import Fixes (Additional)
Vendor Pages: Fixed incorrect relative import paths in 9+ files (Dashboard.js, Items.js, Inventory.js, etc.) that were causing compile errors.
ESLint Fixes: Resolved no-undef errors in Home.js and Shop1.js related to useLanguage usage.
✅ Verification

Browser Testing: Verified that checking the "ENG" toggle in the sidebar immediately updates:
"Shopping Bag" page headers and labels.
"Order Summary" section (Subtotal, Delivery, etc.).
Product names ("Kundan Necklace") and descriptions.
Build Check: Confirmed that the application compiles without errors after fixing the import paths.