[B2B-3799] Fix inconsistent translations across buyer portal#883
Draft
bc-gary wants to merge 8 commits into
Draft
[B2B-3799] Fix inconsistent translations across buyer portal#883bc-gary wants to merge 8 commits into
bc-gary wants to merge 8 commits into
Conversation
…ed components Shared quote components (QuoteInfo, ContactInfo, QuoteAddress, etc.) use quoteDraft.* translation keys but are also rendered on the quoteDetail page. Since translations are fetched per page, merchant custom translations for these keys were never loaded on quoteDetail. Add PAGE_DEPENDENCIES map so visiting a page also fetches translations for pages whose components are shared on that page.
… portal Multiple translation issues causing merchant custom translations to not display or display inconsistently: 1. Kebab-case URL routes (purchased-products, user-management) did not match camelCase translation key prefixes. Add REPEATED_PAGES mappings. 2. Cross-page shared components use translation keys from other pages. Add TRANSLATION_DEPENDENCIES so shoppingList, quoteDraft and quoteDetail pages also fetch purchasedProducts translations. 3. Bulk upload cancel button had a hardcoded "cancel" string bypassing the translation system. Remove the prop so B3Dialog uses b3Lang(). 4. Bulk upload modal had 13 hardcoded English strings never wired to the translation system. Add global.B3Upload.* and global.bulkUpload.* keys to en.json and wire all strings through b3Lang().
…k add - Add global.B3Upload.title key and wire default dialog title through b3Lang() so 'Bulk upload' is translatable. - Add shoppingList as a dependency of quoteDraft and quoteDetail so the QuickAdd component's shoppingList.quickAdd.* keys (Quick add, Show more rows) load on quote pages.
… translations - Wire hardcoded 'No products found' in both ProductListDialog files through b3Lang() with new global.searchProduct.noProductsFound key. - Add shoppingLists (plural) as a translation dependency for pages that render ProductListDialog with its shoppingLists.close key: purchasedProducts, quoteDraft, quoteDetail.
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.
Jira: B2B-3799
What/Why?
Merchant custom translations uploaded via CSV were not being applied consistently
across the Buyer Portal. Several root causes were identified:
1. Kebab-case URL routes don't match camelCase translation key prefixes
The translation system extracts the page name from the URL path (
location.pathname.split('/')).Routes like
/purchased-productsand/user-managementproduce kebab-case names, butthe translation API and
en.jsonkeys use camelCase (purchasedProducts,userManagement).Custom translations for these pages were silently ignored.
Adds
REPEATED_PAGESmappings forpurchased-products → purchasedProductsanduser-management → userManagement.2. Cross-page shared components miss translations from other pages
Components on the Shopping List Detail page use
purchasedProducts.quickAdd.*keys(SKU, Qty labels). The Quote Draft and Quote Detail pages use
purchasedProducts.quickOrderPad.*keys (min/max quantity messages).Extends
TRANSLATION_DEPENDENCIESso these pages also fetchpurchasedProductstranslations when visited.
3. Bulk upload cancel button was hardcoded
B3Upload.tsxpassedleftSizeBtn="cancel"toB3Dialog, which rendered the literalstring "cancel" instead of calling
b3Lang('global.dialog.cancel'). Removes the propso the dialog falls back to the translated value.
4. Bulk upload modal had 13 hardcoded English strings
Strings like "Upload file", "Download sample", "Drag & drop file here", column headers
("SKU", "Qty", "Row", "Error"), tab labels ("Errors", "Valid"), "Remove", "Products per
page:", and "No product" were never wired through the translation system.
Adds
global.B3Upload.*andglobal.bulkUpload.*keys toen.jsonand wires allstrings through
b3Lang().Rollout/Rollback
(fetch translations that were missing, wire strings that were hardcoded). Only affects
stores with custom translations configured in the B2B Dashboard.
Testing
tsc --noEmit)