Open bobbingwide opened 1 year ago
The l10n
solution needs to be modified to support ACF's PHP blocks which don't require NPM to build them.
As with other block plugins the strings to be translated come from:
To generate the .pot
file to obtain the strings from block.json
we can run
wp i18n make-pot . languages/acf-field-block.pot
To translate the strings we need to run l10n
.
l10n.php
needs to be modified to not run makeoik
.maybe_do_makeoik()
, which currently checks for folders called node_modules
and src
can alternatively check for a folder called blocks
.blocks
folder is currently used in acf-field-block, acf-oik-blocks and oik-testimonials.It's not necessary to generate the .json
files that are normally used during localization of the block
since there is no block JavaScript.
Were it necessary we'd need to run
wp i18n make-json languages --no-purge
We need to call load_plugin_textdomain()
to load the language files prior to calling acf_add_local_field_group()
and the block.json
file needs the textdomain
attribute set to acf-field-block
.
Requirements
The acf-field-block plugin should be enabled as a free plugin downloadable from wordpress.org. It should therefore be:
Solution
PHP
acf-field-block
l10n
block.json