[wp-trac] [WordPress Trac] #54797: Allow languages path in register_block_type
WordPress Trac
noreply at wordpress.org
Tue Feb 15 15:44:36 UTC 2022
#54797: Allow languages path in register_block_type
--------------------------------------+-----------------------
Reporter: Rahe | Owner: gziolo
Type: defect (bug) | Status: assigned
Priority: normal | Milestone: 6.0
Component: I18N | Version: trunk
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests | Focuses:
--------------------------------------+-----------------------
Comment (by gziolo):
> When a plugin provides a custom path to the translations folder,
example: languages, it doesn't get passed to wp_set_script_translations
called inside the register_block_script_handle helper function.
I added a new patch that allows setting the equivalent of
[https://developer.wordpress.org/plugins/internationalization/how-to-
internationalize-your-plugin/#domain-path Domain Path] like for the
plugin. Exactly the same rules apply:
> The domain path defines the location for a plugin’s translation. This
has a few uses, notably so that WordPress knows where to find the
translation even when the plugin is disabled. This defaults to the folder
in which your plugin is found.
>
> For example, if the translation is located in a folder called languages
within your plugin, then the Domain Path is `/languages` and must be
written with the first slash.
`block.json`
{{{
"textdomain": "my-plugin",
"domainpath" "/languages",
}}}
We will have to include similar documentation in Gutenberg in
https://github.com/WordPress/gutenberg/blob/trunk/docs/reference-guides
/block-api/block-metadata.md with the note that this API is available
starting from WordPress 6.0.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/54797#comment:12>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list