#52301 closed enhancement (fixed)
Blocks: Add i18n support to register_block_type_from_metadata
| Reported by: | gziolo | Owned by: | gziolo |
|---|---|---|---|
| Priority: | normal | Milestone: | 5.7 |
| Component: | Editor | Version: | 5.7 |
| Severity: | normal | Keywords: | has-patch has-unit-tests |
| Cc: | Focuses: |
Description (last modified by )
Related issue in Gutenberg: https://github.com/WordPress/gutenberg/issues/23636.
Related PR in WP-CLI from @swissspidy: https://github.com/wp-cli/i18n-command/pull/210.
Description
There are some issues related to internationalization (i18n) support in the introduced block.json metadata files that still need to be resolved.
There is a proposal in block registration document that we still need to implement:
https://github.com/WordPress/gutenberg/blob/master/docs/designers-developers/developers/block-api/block-metadata.md#internationalization-not-implemented
The good news is that WP-CLI has implemented (https://github.com/wp-cli/i18n-command/pull/210) native support for translatable strings extraction from block.json file in i18n command. It was based on the aforementioned document.
Code
Change History (11)
This ticket was mentioned in PR #868 on WordPress/wordpress-develop by gziolo.
6 years ago
#1
lukecarbis commented on PR #868:
6 years ago
#3
This PR will need eyes from the documentation team.
hellofromtonya commented on PR #868:
6 years ago
#7
Merged in changeset https://core.trac.wordpress.org/changeset/49981 and https://core.trac.wordpress.org/changeset/49982
ZebulanStanphill commented on PR #868:
6 years ago
#8
Shouldn't textdomain be textDomain to match the camelCase already being used for editorScript and editorStyle?
6 years ago
#9
@ZebulanStanphill, I know it's confusing. In the written language it's two words so you would expect text_domain in PHP and textDomain in JavaScript, but in practice, it' was mostly textdomain in PHP codebase so followed it. Related docs:
- https://github.com/WordPress/gutenberg/blob/master/docs/designers-developers/developers/block-api/block-metadata.md#text-domain
- https://developer.wordpress.org/plugins/internationalization/how-to-internationalize-your-plugin/#text-domains
- https://developer.wordpress.org/reference/functions/load_plugin_textdomain/
#10
@
5 years ago
Related documentation changes in Gutenberg: https://github.com/WordPress/gutenberg/pull/29023.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Trac ticket: https://core.trac.wordpress.org/ticket/52301
Related issue in Gutenberg: https://github.com/WordPress/gutenberg/issues/23636.
Related PR in WP-CLI from @swissspidy: https://github.com/wp-cli/i18n-command/pull/210.
## Description
There are some issues related to internationalization (i18n) support in the introduced
block.jsonmetadata files that still need to be resolved.There is a proposal in block registration document that we still need to implement:
https://github.com/WordPress/gutenberg/blob/master/docs/designers-developers/developers/block-api/block-metadata.md#internationalization-not-implemented
The good news is that WP-CLI has implemented (https://github.com/wp-cli/i18n-command/pull/210) native support for translatable strings extraction from
block.jsonfile ini18ncommand. It was based on the aforementioned document.