#5779 closed task (blessed) (worksforme)
theme.json strings not extracted for translation
Reported by: | oandregal | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Component: | Translate Site & Plugins | Keywords: | |
Cc: |
Description
https://core.trac.wordpress.org/ticket/53175 landed support for theme.json
in WordPress 5.8, which is used by both core and themes to provide a number of settings to the block editor. The presets visible to users are among those settings: color palette, font sizes, duotone, etc.
Before the introduction of theme.json
, themes would mark these strings for being extracted in their functions.php file. Now, those strings should be taken from the theme.json
file instead, as we do with block.json strings https://meta.trac.wordpress.org/ticket/5737
How to test
- Went to https://translate.wordpress.org/ and selected the 5.7.x line.
- Searched for something that was present in a previous release but used a different source for translation (the block-editor package): "font size name".
- It's there up for translation. However, I've noticed that the context for the font values is font size name (all in lower case, as defined before) and not Font size name (capital, as defined in the [theme-i18.json]https://github.com/WordPress/wordpress-develop/blob/master/src/wp-includes/theme-i18n.json#L6).
- Searched for something that is new to 5.8: "duotone", "duotone name", or a specific value such as "dark grayscale".
- I can't find anything.
How to fix
As far as I understand, we need to do a couple of things:
- Add support for string extraction to the
wp i18n
command. See issue at: https://github.com/wp-cli/i18n-command/issues/224 - Update meta with that new behaviour.
Change History (12)
This ticket was mentioned in Slack in #core-editor by nosolosw. View the logs.
4 years ago
#3
@
4 years ago
- Type changed from defect to task
Went to https://translate.wordpress.org/ and selected the 5.7.x line.
Why are you expecting strings from WordPress 5.8 in a project named 5.7.x?
Note that you have linked to theme-i18n.json
file and not theme.json
(both exists).
#4
@
4 years ago
Why are you expecting strings from WordPress 5.8 in a project named 5.7.x?
Where should I look for this? I haven't found a 5.8 project so I presumed the latest would be used instead?
Note that you have linked to theme-i18n.json file and not theme.json (both exists).
theme-i18.json
is used as a helper to know which paths from theme.json
need translation plus provide the translation context for them.
This ticket was mentioned in Slack in #core-editor by nosolosw. View the logs.
4 years ago
This ticket was mentioned in Slack in #core-editor by nosolosw. View the logs.
4 years ago
This ticket was mentioned in Slack in #core-editor by paaljoachim. View the logs.
4 years ago
#8
@
3 years ago
Just checked the current status of this:
- the PR related to the i18n-command has been merged https://github.com/wp-cli/i18n-command/pull/254 and released as part of the 2.2.9 version for that package https://github.com/wp-cli/i18n-command/releases/tag/v2.2.9
- Following the instructions in the description (but using the 5.8.x) line, I can see the strings up for translation, so it's working as expected.
Can anyone confirm the meta setup has been updated with the latest version of i18n-command? cc @ocean90
#9
@
3 years ago
- Resolution set to fixed
- Status changed from new to closed
This was fixed a while ago.
#10
@
3 years ago
- Resolution fixed deleted
- Status changed from closed to reopened
@ocean90 I was checking this and wanted to share that this is working for WordPress core but it isn't for plugins and themes.
- WordPress core. It should show up for translation the strings whose key is "name" under the following sections: duotone, gradients, palette, fontSizes. I've searched for theme.json and all the values show up on the translate site properly.
- Plugins. Checked for the Gutenberg plugin. It should show up for translation the strings whose key is "name" under the following sections: palette, gradients, duotone, fontSizes. I've https://translate.wordpress.org/projects/wp-plugins/gutenberg/dev/gl/default/?filters[term=theme.json&filters[term_scope]=scope_any&filters[status]=either&filters[user_login]=&sort[by]=references&sort[how]=desc&sorts=Apply+Sorting searched for theme.json] and what I see is that only the font size names and two colors show up on the translation site.
- Themes. Checked for TT1-blocks. It should show up for translation the strings whose key is "name" under the following sections: palette, gradients, fontSizes, fontFamilies. It should also show the string whose key is "title" under the the customTemplates section. I've searched for theme.json and what I see is that no value is shown on the translation site.
The PR to implement this in wp-cli landed a while ago but the wp-cli version that contains it (2.5.1) hasn't been released yet. Thought I'd mention it, although I don't know if that's what's happening here or there's any other issue at play.
#11
@
3 years ago
- Resolution set to worksforme
- Status changed from reopened to closed
The internationalization process is working as expected, so I'm going to close it (not sure why I can't mark this as "fixed" so I'm marking it as "worksforme").
I've been looking at this with the help of @akirk and this is what happens:
- How to search for strings coming from "theme.json":
- term: "theme.json"
- term scope: "any"
- status: "Current/waiting/fuzzy + untranslated (All)". This is important. I've used "any" in some searches, which doesn't show you the strings for which there's no translation (so I wasn't getting results when there were some). This explains the weird results I got for Gutenberg.
Doing that search I can confirm Gutenberg and other themes with theme.json I've checked work as expected, such as BlockBase and Mayland (blocks).
Now, there's a different issue with a few themes that also have theme.json: their latest submission happened before the i18n process was set up to extract strings coming from theme.json. Hence, they don't have any strings coming from that source. This is the case of TT1-blocks and Armando, for example. As soon as they publish an update to the repo, the strings should come up.
#12
@
5 weeks ago
Related ticket https://meta.trac.wordpress.org/ticket/7866
I've prepared a pull request to add support for this in wp-cli at https://github.com/wp-cli/i18n-command/pull/254