Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Translatable #55

Open
jnaklaas opened this issue Dec 18, 2020 · 1 comment
Open

Translatable #55

jnaklaas opened this issue Dec 18, 2020 · 1 comment

Comments

@jnaklaas
Copy link

jnaklaas commented Dec 18, 2020

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

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

@tombroucke
Copy link
Contributor

tombroucke commented Dec 22, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants