diff --git a/src/views/gutenberg-blocks/class-tainacan-gutenberg-block.php b/src/views/gutenberg-blocks/class-tainacan-gutenberg-block.php index 8908bb5c3..6766416fd 100644 --- a/src/views/gutenberg-blocks/class-tainacan-gutenberg-block.php +++ b/src/views/gutenberg-blocks/class-tainacan-gutenberg-block.php @@ -52,9 +52,11 @@ function tainacan_blocks_register_tainacan_terms_list(){ wp_register_script( 'terms-list', $TAINACAN_BASE_URL . '/assets/js/block_terms_list.js', - array('wp-blocks', 'wp-element', 'wp-components', 'wp-editor', 'underscore') + array('wp-blocks', 'wp-i18n', 'wp-element', 'wp-components', 'wp-editor', 'underscore') ); + wp_set_script_translations('terms-list', 'tainacan'); + wp_register_style( 'terms-list', $TAINACAN_BASE_URL . '/assets/css/tainacan-gutenberg-block-terms-list.css', @@ -81,7 +83,7 @@ function tainacan_blocks_register_tainacan_facets_list(){ wp_register_script( 'facets-list', $TAINACAN_BASE_URL . '/assets/js/block_facets_list.js', - array('wp-blocks', 'wp-element', 'wp-components', 'wp-editor') + array('wp-blocks', 'wp-i18n', 'wp-element', 'wp-components', 'wp-editor') ); wp_register_style( @@ -90,6 +92,8 @@ function tainacan_blocks_register_tainacan_facets_list(){ array('wp-edit-blocks', 'tainacan-blocks-common-styles') ); + wp_set_script_translations('facets-list', 'tainacan'); + if (function_exists('register_block_type')) { register_block_type( 'tainacan/facets-list', array( 'editor_script' => 'facets-list', @@ -105,7 +109,7 @@ function tainacan_blocks_register_tainacan_items_list(){ wp_register_script( 'items-list', $TAINACAN_BASE_URL . '/assets/js/block_items_list.js', - array('wp-blocks', 'wp-element', 'wp-components', 'wp-editor') + array('wp-blocks', 'wp-i18n', 'wp-element', 'wp-components', 'wp-editor') ); wp_register_style( @@ -114,6 +118,8 @@ function tainacan_blocks_register_tainacan_items_list(){ array('wp-edit-blocks', 'tainacan-blocks-common-styles') ); + wp_set_script_translations('items-list', 'tainacan'); + if (function_exists('register_block_type')) { register_block_type( 'tainacan/items-list', array( 'editor_script' => 'items-list', @@ -134,9 +140,11 @@ function tainacan_blocks_register_tainacan_dynamic_items_list(){ wp_register_script( 'dynamic-items-list', $TAINACAN_BASE_URL . '/assets/js/block_dynamic_items_list.js', - array('wp-blocks', 'wp-element', 'wp-components', 'wp-editor') + array('wp-blocks', 'wp-i18n', 'wp-element', 'wp-components', 'wp-editor') ); + wp_set_script_translations('dynamic-items-list', 'tainacan'); + wp_register_style( 'dynamic-items-list', $TAINACAN_BASE_URL . '/assets/css/tainacan-gutenberg-block-dynamic-items-list.css', @@ -166,9 +174,11 @@ function tainacan_blocks_register_tainacan_faceted_search(){ wp_register_script( 'faceted-search', $TAINACAN_BASE_URL . '/assets/js/block_faceted_search.js', - array('wp-blocks', 'wp-element', 'wp-components', 'wp-editor') + array('wp-blocks', 'wp-i18n', 'wp-element', 'wp-components', 'wp-editor') ); + wp_set_script_translations('faceted-search', 'tainacan'); + wp_register_style( 'faceted-search', $TAINACAN_BASE_URL . '/assets/css/tainacan-gutenberg-block-faceted-search.css', @@ -196,9 +206,11 @@ function tainacan_blocks_register_tainacan_carousel_items_list(){ wp_register_script( 'carousel-items-list', $TAINACAN_BASE_URL . '/assets/js/block_carousel_items_list.js', - array('wp-blocks', 'wp-element', 'wp-components', 'wp-editor') + array('wp-blocks', 'wp-i18n', 'wp-element', 'wp-components', 'wp-editor') ); + wp_set_script_translations('carousel-items-list', 'tainacan'); + wp_register_style( 'carousel-items-list', $TAINACAN_BASE_URL . '/assets/css/tainacan-gutenberg-block-carousel-items-list.css', @@ -226,9 +238,11 @@ function tainacan_blocks_register_tainacan_carousel_terms_list(){ wp_register_script( 'carousel-terms-list', $TAINACAN_BASE_URL . '/assets/js/block_carousel_terms_list.js', - array('wp-blocks', 'wp-element', 'wp-components', 'wp-editor') + array('wp-blocks', 'wp-i18n', 'wp-element', 'wp-components', 'wp-editor') ); + wp_set_script_translations('carousel-terms-list', 'tainacan'); + wp_register_style( 'carousel-terms-list', $TAINACAN_BASE_URL . '/assets/css/tainacan-gutenberg-block-carousel-terms-list.css', @@ -256,9 +270,11 @@ function tainacan_blocks_register_tainacan_search_bar(){ wp_register_script( 'search-bar', $TAINACAN_BASE_URL . '/assets/js/block_search_bar.js', - array('wp-blocks', 'wp-element', 'wp-components', 'wp-editor') + array('wp-blocks', 'wp-i18n', 'wp-element', 'wp-components', 'wp-editor') ); + wp_set_script_translations('search-bar-list', 'tainacan'); + wp_register_style( 'search-bar', $TAINACAN_BASE_URL . '/assets/css/tainacan-gutenberg-block-search-bar.css', @@ -279,7 +295,7 @@ function tainacan_blocks_register_tainacan_collections_list(){ wp_register_script( 'collections-list', $TAINACAN_BASE_URL . '/assets/js/block_collections_list.js', - array('wp-blocks', 'wp-element', 'wp-components', 'wp-editor') + array('wp-blocks', 'wp-i18n', 'wp-element', 'wp-components', 'wp-editor') ); wp_register_style( @@ -288,6 +304,8 @@ function tainacan_blocks_register_tainacan_collections_list(){ array('wp-edit-blocks', 'tainacan-blocks-common-styles') ); + wp_set_script_translations('collections-list', 'tainacan'); + if (function_exists('register_block_type')) { register_block_type( 'tainacan/collections-list', array( 'editor_script' => 'collections-list', @@ -308,9 +326,11 @@ function tainacan_blocks_register_tainacan_carousel_collections_list(){ wp_register_script( 'carousel-collections-list', $TAINACAN_BASE_URL . '/assets/js/block_carousel_collections_list.js', - array('wp-blocks', 'wp-element', 'wp-components', 'wp-editor') + array('wp-blocks', 'wp-i18n', 'wp-element', 'wp-components', 'wp-editor') ); + wp_set_script_translations('carousel-collections-list', 'tainacan'); + wp_register_style( 'carousel-collections-list', $TAINACAN_BASE_URL . '/assets/css/tainacan-gutenberg-block-carousel-collections-list.css',