Adds wp_set_script_translations to gutenberg editor files

This commit is contained in:
mateuswetah 2020-06-17 10:28:54 -03:00
parent 268accc64a
commit bd0ab0461b
1 changed files with 30 additions and 10 deletions

View File

@ -52,9 +52,11 @@ function tainacan_blocks_register_tainacan_terms_list(){
wp_register_script( wp_register_script(
'terms-list', 'terms-list',
$TAINACAN_BASE_URL . '/assets/js/block_terms_list.js', $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( wp_register_style(
'terms-list', 'terms-list',
$TAINACAN_BASE_URL . '/assets/css/tainacan-gutenberg-block-terms-list.css', $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( wp_register_script(
'facets-list', 'facets-list',
$TAINACAN_BASE_URL . '/assets/js/block_facets_list.js', $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( wp_register_style(
@ -90,6 +92,8 @@ function tainacan_blocks_register_tainacan_facets_list(){
array('wp-edit-blocks', 'tainacan-blocks-common-styles') array('wp-edit-blocks', 'tainacan-blocks-common-styles')
); );
wp_set_script_translations('facets-list', 'tainacan');
if (function_exists('register_block_type')) { if (function_exists('register_block_type')) {
register_block_type( 'tainacan/facets-list', array( register_block_type( 'tainacan/facets-list', array(
'editor_script' => 'facets-list', 'editor_script' => 'facets-list',
@ -105,7 +109,7 @@ function tainacan_blocks_register_tainacan_items_list(){
wp_register_script( wp_register_script(
'items-list', 'items-list',
$TAINACAN_BASE_URL . '/assets/js/block_items_list.js', $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( wp_register_style(
@ -114,6 +118,8 @@ function tainacan_blocks_register_tainacan_items_list(){
array('wp-edit-blocks', 'tainacan-blocks-common-styles') array('wp-edit-blocks', 'tainacan-blocks-common-styles')
); );
wp_set_script_translations('items-list', 'tainacan');
if (function_exists('register_block_type')) { if (function_exists('register_block_type')) {
register_block_type( 'tainacan/items-list', array( register_block_type( 'tainacan/items-list', array(
'editor_script' => 'items-list', 'editor_script' => 'items-list',
@ -134,9 +140,11 @@ function tainacan_blocks_register_tainacan_dynamic_items_list(){
wp_register_script( wp_register_script(
'dynamic-items-list', 'dynamic-items-list',
$TAINACAN_BASE_URL . '/assets/js/block_dynamic_items_list.js', $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( wp_register_style(
'dynamic-items-list', 'dynamic-items-list',
$TAINACAN_BASE_URL . '/assets/css/tainacan-gutenberg-block-dynamic-items-list.css', $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( wp_register_script(
'faceted-search', 'faceted-search',
$TAINACAN_BASE_URL . '/assets/js/block_faceted_search.js', $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( wp_register_style(
'faceted-search', 'faceted-search',
$TAINACAN_BASE_URL . '/assets/css/tainacan-gutenberg-block-faceted-search.css', $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( wp_register_script(
'carousel-items-list', 'carousel-items-list',
$TAINACAN_BASE_URL . '/assets/js/block_carousel_items_list.js', $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( wp_register_style(
'carousel-items-list', 'carousel-items-list',
$TAINACAN_BASE_URL . '/assets/css/tainacan-gutenberg-block-carousel-items-list.css', $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( wp_register_script(
'carousel-terms-list', 'carousel-terms-list',
$TAINACAN_BASE_URL . '/assets/js/block_carousel_terms_list.js', $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( wp_register_style(
'carousel-terms-list', 'carousel-terms-list',
$TAINACAN_BASE_URL . '/assets/css/tainacan-gutenberg-block-carousel-terms-list.css', $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( wp_register_script(
'search-bar', 'search-bar',
$TAINACAN_BASE_URL . '/assets/js/block_search_bar.js', $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( wp_register_style(
'search-bar', 'search-bar',
$TAINACAN_BASE_URL . '/assets/css/tainacan-gutenberg-block-search-bar.css', $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( wp_register_script(
'collections-list', 'collections-list',
$TAINACAN_BASE_URL . '/assets/js/block_collections_list.js', $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( wp_register_style(
@ -288,6 +304,8 @@ function tainacan_blocks_register_tainacan_collections_list(){
array('wp-edit-blocks', 'tainacan-blocks-common-styles') array('wp-edit-blocks', 'tainacan-blocks-common-styles')
); );
wp_set_script_translations('collections-list', 'tainacan');
if (function_exists('register_block_type')) { if (function_exists('register_block_type')) {
register_block_type( 'tainacan/collections-list', array( register_block_type( 'tainacan/collections-list', array(
'editor_script' => 'collections-list', 'editor_script' => 'collections-list',
@ -308,9 +326,11 @@ function tainacan_blocks_register_tainacan_carousel_collections_list(){
wp_register_script( wp_register_script(
'carousel-collections-list', 'carousel-collections-list',
$TAINACAN_BASE_URL . '/assets/js/block_carousel_collections_list.js', $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( wp_register_style(
'carousel-collections-list', 'carousel-collections-list',
$TAINACAN_BASE_URL . '/assets/css/tainacan-gutenberg-block-carousel-collections-list.css', $TAINACAN_BASE_URL . '/assets/css/tainacan-gutenberg-block-carousel-collections-list.css',