[wp-trac] [WordPress Trac] #50732: Block Directory: Support installing blocks in languages other than English
WordPress Trac
noreply at wordpress.org
Wed Jul 22 07:27:22 UTC 2020
#50732: Block Directory: Support installing blocks in languages other than English
--------------------------+---------------------
Reporter: ryelle | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: 5.5
Component: Editor | Version: trunk
Severity: normal | Resolution:
Keywords: needs-patch | Focuses:
--------------------------+---------------------
Changes (by swissspidy):
* keywords: => needs-patch
Comment:
Ugh, bummer that this was missed :-(
Not sure how the block installation currently works, but here are my two
cents:
First of all, the translations should get installed together with the
block (if not already the case). The text domain should be known at that
point (part of block.json, equals the plugin slug, etc.)
Second, we should not fetch the JSON file directly as it prevents
legitimate use cases where the JSON translations are filtered by
developers - see `load_script_translations` and the
`pre_load_script_translations` and `load_script_translation_file` filters.
So we indeed need to go through the REST API, ideally via a `GET /wp/v2
/script-translations?handle=foo&locale=es_ES` route that calls
`WP_Scripts::get_translations` (like `WP_Scripts::print_translations` but
without the printing) which calls `load_script_textdomain` with the right
arguments.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/50732#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list