sage-acf-wp-blocks icon indicating copy to clipboard operation
sage-acf-wp-blocks copied to clipboard

Translatable

Open jnaklaas opened this issue 4 years ago • 1 comments

Could we do something like this in order to make the block title translatable?

{{-- Title: __('My custom block') Description: __('This is my custom block!') --}}

jnaklaas avatar Dec 18 '20 11:12 jnaklaas

If translation is a must, you could add a filter:

add_filter('sage/blocks/my-custom-block/register-data', function ($data) {
    $data['title'] = __('My custom block title', 'sage');
    $data['description'] = __('My custom block description', 'sage');
    return $data;
});

As an alternative, you can use the acf/register_block_type_args filter in the same way if you want to add translations in only one function.

tombroucke avatar Dec 22 '20 16:12 tombroucke