Making WordPress.org

Opened 4 years ago

Closed 3 years ago

Last modified 5 weeks ago

#5779 closed task (blessed) (worksforme)

theme.json strings not extracted for translation

Reported by: oandregal's profile 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".
  • 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:

Change History (12)

#1 @oandregal
4 years ago

I've prepared a pull request to add support for this in wp-cli at https://github.com/wp-cli/i18n-command/pull/254

This ticket was mentioned in Slack in #core-editor by nosolosw. View the logs.


4 years ago

#3 @ocean90
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 @oandregal
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 @oandregal
3 years ago

Just checked the current status of this:

  • 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 @ocean90
3 years ago

  • Resolution set to fixed
  • Status changed from new to closed

This was fixed a while ago.

#10 @oandregal
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.

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 @oandregal
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.

Note: See TracTickets for help on using tickets.