Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Fix missing translations in inspector #6737

Merged
merged 23 commits into from
Aug 1, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
89a2bc1
Try registering the "cart taxes" inner block
tarhi-saad Jul 22, 2022
713b835
Fix registering the cart taxes inner block issue
tarhi-saad Jul 22, 2022
21ffbd9
Update translation script loading
tarhi-saad Jul 22, 2022
18648ce
Remove unnecessary JS translation
tarhi-saad Jul 25, 2022
06cebc4
Put back the initial code in the 'Cart Taxes' inner block
tarhi-saad Jul 28, 2022
18e3a98
Generate `block.json`files for inner blocks
tarhi-saad Jul 28, 2022
310dd42
Set the folder name exactly the same as the inner block name
tarhi-saad Jul 28, 2022
a24deee
Update imports after folder renaming
tarhi-saad Jul 28, 2022
49e207b
Get block name directly from the JSON metadata
tarhi-saad Jul 28, 2022
b0101b0
Revert folder naming change of `Cart taxes` inner block
tarhi-saad Jul 28, 2022
477896a
Fix missing translations for the `Cart Subtotal` Block
tarhi-saad Jul 28, 2022
f62033f
Register only the client-side settings on the client
tarhi-saad Jul 29, 2022
466ecd1
Add schema validation to `block.json`
tarhi-saad Jul 29, 2022
c5670f6
Use the same `editor_script` as the parent block
tarhi-saad Jul 29, 2022
83a8b43
Add C&C inner blocks in Cart.php & Checkout.php
tarhi-saad Jul 29, 2022
7c2aefd
Fix all Cart inner blocks missing translations
tarhi-saad Jul 29, 2022
a9e0d3c
Create the "AbstractInnerBlock" class
tarhi-saad Aug 1, 2022
686fe50
Update the "Inner Blocks" PHP classes
tarhi-saad Aug 1, 2022
0a9cf4a
Fix PHP lint erros & update function description
tarhi-saad Aug 1, 2022
602ea19
Fix missing translations bug for all Checkout Inner Blocks
tarhi-saad Aug 1, 2022
bbc73ec
Merge branch 'trunk' into fix/6244-missing-translations-in-inspector
tarhi-saad Aug 1, 2022
eb6dd53
Update src/BlockTypes/Checkout.php
tarhi-saad Aug 1, 2022
b220e49
skip lazy loaded scripts
senadir Aug 1, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/**
* External dependencies
*/
import { __ } from '@wordpress/i18n';
import { totals } from '@woocommerce/icons';
import { Icon } from '@wordpress/icons';
import { registerFeaturePluginBlockType } from '@woocommerce/block-settings';
Expand All @@ -12,7 +13,9 @@ import { Edit, Save } from './edit';
import attributes from './attributes';
import metadata from './block.json';

registerFeaturePluginBlockType( metadata, {
registerFeaturePluginBlockType( 'woocommerce/cart-order-summary-taxes-block', {
// When a block is registered server side, we should add the block metadata in the settings.
...metadata,
icon: {
src: (
<Icon
Expand All @@ -21,7 +24,20 @@ registerFeaturePluginBlockType( metadata, {
/>
),
},
attributes,
attributes: {
...metadata.attributes,
...attributes,
},
title: __( 'Taxes', 'woo-gutenberg-products-block' ),
description: __(
'Shows the cart taxes row.',
'woo-gutenberg-products-block'
),
// description: _x(
// 'Shows the cart taxes row.',
// 'block description',
// 'woo-gutenberg-products-block'
// ),
tarhi-saad marked this conversation as resolved.
Show resolved Hide resolved
edit: Edit,
save: Save,
} );
3 changes: 3 additions & 0 deletions bin/webpack-entries.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ const blocks = {
'stock-filter': {},
'active-filters': {},
cart: {},
'cart-order-summary-taxes-block': {
customDir: 'cart/inner-blocks/cart-order-summary-taxes',
},
tarhi-saad marked this conversation as resolved.
Show resolved Hide resolved
checkout: {},
'mini-cart': {},
'mini-cart-contents': {
Expand Down
31 changes: 31 additions & 0 deletions src/BlockTypes/CartOrderSummaryTaxesBlock.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php
namespace Automattic\WooCommerce\Blocks\BlockTypes;

/**
* CartOrderSummaryTaxesBlock class.
*/
class CartOrderSummaryTaxesBlock extends AbstractBlock {
/**
* Block name.
*
* @var string
*/
protected $block_name = 'cart-order-summary-taxes-block';

/**
* API version name.
*
* @var string
*/
protected $api_version = '2';

/**
* Register script and style assets for the block type before it is registered.
*
* This registers the scripts; it does not enqueue them.
*/
protected function register_block_type_assets() {
parent::register_block_type_assets();
$this->register_chunk_translations( [ $this->block_name ] );
}
}
1 change: 1 addition & 0 deletions src/BlockTypesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ protected function get_block_types() {
if ( Package::feature()->is_feature_plugin_build() ) {
$block_types[] = 'Checkout';
$block_types[] = 'Cart';
$block_types[] = 'CartOrderSummaryTaxesBlock';
tarhi-saad marked this conversation as resolved.
Show resolved Hide resolved
}

if ( Package::feature()->is_experimental_build() ) {
Expand Down