[mirror] dont let browsers auto-translate currency#1
Open
yashwant86 wants to merge 31 commits into
Open
Conversation
…ommerce/product-editor, woocommerce
Fix bug because $parsed_block is out of scope inside function
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
⚡ Risk Assessment —
|
| Files | Summary |
|---|---|
Price Markup Translation Preventionplugins/woocommerce/includes/wc-formatting-functions.phpplugins/woocommerce/client/blocks/assets/js/base/components/product-price/index.tsxplugins/woocommerce/client/blocks/assets/js/blocks/mini-cart/block.tsxplugins/woocommerce/client/blocks/packages/components/formatted-monetary-amount/index.tsxpackages/js/product-editor/src/components/formatted-price/formatted-price.tsxplugins/woocommerce/src/Blocks/BlockTypes/MiniCart.phpplugins/woocommerce/src/Blocks/BlockTypes/MiniCartFooterBlock.phpplugins/woocommerce/src/Blocks/BlockTypes/MiniCartProductsTableBlock.phpplugins/woocommerce/client/blocks/assets/js/previews/product-response-items.tsplugins/woocommerce/client/blocks/assets/js/previews/products.js |
Adds translate="no" and notranslate class attributes to currency symbol and price display elements to prevent browser auto-translation engines from modifying currency symbols and amounts. |
Test Expectations Updateplugins/woocommerce/tests/legacy/unit-tests/product/data.phpplugins/woocommerce/tests/legacy/unit-tests/formatting/functions.phpplugins/woocommerce/tests/legacy/unit-tests/cart/cart.phpplugins/woocommerce/tests/legacy/unit-tests/order/class-wc-tests-crud-orders.php |
Updates test assertions to match new price HTML output with translate="no" attributes on currency symbols. |
ProductCollection Controller Logic Fixplugins/woocommerce/src/Blocks/BlockTypes/ProductCollection/Controller.php |
Fixes operator precedence bug by adding parentheses around null coalescing expression before && operator to ensure correct evaluation of forcePageReload flag. |
Static Analysis Baseline Cleanupplugins/woocommerce/phpstan-baseline.neon |
Removes obsolete phpstan baseline entries for fixed static analysis warnings in ProductCollection Controller. |
Changelog Entriesplugins/woocommerce/changelog/62037-patch-1packages/js/product-editor/changelog/62037-patch-1plugins/woocommerce/changelog/patch-1 |
Adds changelog entries documenting patch fixes for currency translation prevention and variable reference correction. |
Whitespace Cleanupplugins/woocommerce/src/Blocks/BlockTypes/MiniCartProductsTableBlock.php |
Removes trailing whitespace from template markup lines. |
Sequence Diagram
sequenceDiagram
participant User
participant Browser
participant WooCommerce
User->>WooCommerce: View product/cart page
WooCommerce->>WooCommerce: Generate price HTML with translate="no"
WooCommerce->>Browser: Return HTML with currency symbol marked notranslate
Browser->>Browser: Parse HTML, detect translate="no" attribute
User->>Browser: Enable auto-translate (e.g., Google Translate)
Browser->>Browser: Skip translating currency symbol
Browser->>User: Display price with original currency symbol intact
Dig Deeper With Commands
/review <file-path> <function-optional>/chat <file-path> "<question>"/roast <file-path>
Runs only when explicitly triggered.
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.
Mirror of upstream woocommerce#62037 (open PR live findings) for benchmark. Do not merge.
Summary by MergeMonkey