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

Localization of Block Name #261

Closed
cataras opened this issue Jul 1, 2024 · 2 comments
Closed

Localization of Block Name #261

cataras opened this issue Jul 1, 2024 · 2 comments

Comments

@cataras
Copy link

cataras commented Jul 1, 2024

Hello,

I love using acf-composer to create my blocks. You've done a great job @Log1x!

There's still one thing I can't do. Is it possible to translate the name of a block?

When I initialize my block like this: 'name' => __('Block name', 'sage'),, the block refuses to be displayed.

Thanks for your help.

@Log1x
Copy link
Owner

Log1x commented Jul 1, 2024

Someone else would have to chime in for translations but ACF Composer doesn't officially support it (mainly when caching blocks) at the moment.

For what it's worth, you need to give your block a slug if you're going to translate the name because the name is otherwise used as the slug if none is provided – so that is probably why it is breaking in your case.

Related: #244

@cataras
Copy link
Author

cataras commented Jul 8, 2024

Exactly!

It works like this 👍:

'slug' => 'block-name',
'name' => __('Block name', 'sage'),

I would have thought of that anyway...

Thanks a million!

@Log1x Log1x closed this as completed Aug 12, 2024
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