From 4b82793b33b8312b1466ea70d5e8ad9d008e31be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albert=20Juh=C3=A9=20Lluveras?= Date: Thu, 2 Mar 2023 11:16:32 +0100 Subject: [PATCH] Fix Mini Cart missing translations (https://github.com/woocommerce/woocommerce-blocks/pull/8591) --- .../empty-mini-cart-contents-block/index.tsx | 6 +++-- .../filled-mini-cart-contents-block/index.tsx | 6 +++-- .../mini-cart-footer-block/index.tsx | 6 +++-- .../mini-cart-items-block/index.tsx | 6 +++-- .../mini-cart-products-table-block/index.tsx | 6 +++-- .../mini-cart-shopping-button-block/index.tsx | 6 +++-- .../mini-cart-title-block/index.tsx | 6 +++-- .../BlockTypes/EmptyMiniCartContentsBlock.php | 14 +++++++++++ .../FilledMiniCartContentsBlock.php | 14 +++++++++++ .../src/BlockTypes/MiniCart.php | 5 ++-- .../src/BlockTypes/MiniCartContents.php | 25 ++++++++++++++++--- .../src/BlockTypes/MiniCartFooterBlock.php | 14 +++++++++++ .../src/BlockTypes/MiniCartItemsBlock.php | 14 +++++++++++ .../BlockTypes/MiniCartProductsTableBlock.php | 14 +++++++++++ .../MiniCartShoppingButtonBlock.php | 14 +++++++++++ .../src/BlockTypes/MiniCartTitleBlock.php | 14 +++++++++++ .../src/BlockTypesController.php | 9 +++++-- 17 files changed, 156 insertions(+), 23 deletions(-) create mode 100644 plugins/woocommerce-blocks/src/BlockTypes/EmptyMiniCartContentsBlock.php create mode 100644 plugins/woocommerce-blocks/src/BlockTypes/FilledMiniCartContentsBlock.php create mode 100644 plugins/woocommerce-blocks/src/BlockTypes/MiniCartFooterBlock.php create mode 100644 plugins/woocommerce-blocks/src/BlockTypes/MiniCartItemsBlock.php create mode 100644 plugins/woocommerce-blocks/src/BlockTypes/MiniCartProductsTableBlock.php create mode 100644 plugins/woocommerce-blocks/src/BlockTypes/MiniCartShoppingButtonBlock.php create mode 100644 plugins/woocommerce-blocks/src/BlockTypes/MiniCartTitleBlock.php diff --git a/plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/empty-mini-cart-contents-block/index.tsx b/plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/empty-mini-cart-contents-block/index.tsx index 020128b2c14..a4f1b100a03 100644 --- a/plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/empty-mini-cart-contents-block/index.tsx +++ b/plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/empty-mini-cart-contents-block/index.tsx @@ -9,9 +9,11 @@ import { registerBlockType } from '@wordpress/blocks'; * Internal dependencies */ import { Edit, Save } from './edit'; -import metadata from './block.json'; -registerBlockType( metadata, { +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore -- TypeScript expects some required properties which we already +// registered in PHP. +registerBlockType( 'woocommerce/empty-mini-cart-contents-block', { icon: { src: ( ), diff --git a/plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/mini-cart-shopping-button-block/index.tsx b/plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/mini-cart-shopping-button-block/index.tsx index 929ac027764..8d7a9720f70 100644 --- a/plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/mini-cart-shopping-button-block/index.tsx +++ b/plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/mini-cart-shopping-button-block/index.tsx @@ -8,10 +8,12 @@ import { registerBlockType } from '@wordpress/blocks'; * Internal dependencies */ import { Edit, Save } from './edit'; -import metadata from './block.json'; import attributes from './attributes'; -registerBlockType( metadata, { +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore -- TypeScript expects some required properties which we already +// registered in PHP. +registerBlockType( 'woocommerce/mini-cart-shopping-button-block', { icon: { src: ( get_cart_controller(); $cart = $cart_controller->get_cart_instance(); $cart_contents_count = $cart->get_cart_contents_count(); - $cart_contents = $cart->get_cart(); $cart_contents_total = $cart->get_subtotal(); if ( $cart->display_prices_including_tax() ) { @@ -378,7 +377,7 @@ class MiniCart extends AbstractBlock { $wrapper_styles = $classes_styles['styles']; $aria_label = sprintf( - /* translators: %1$d is the number of products in the cart. %2$s is the cart total */ + /* translators: %1$d is the number of products in the cart. %2$s is the cart total */ _n( '%1$d item in cart, total price of %2$s', '%1$d items in cart, total price of %2$s', @@ -401,7 +400,7 @@ class MiniCart extends AbstractBlock { if ( is_cart() || is_checkout() ) { // It is not necessary to load the Mini Cart Block on Cart and Checkout page. - return '