wp-cli / i18n-command

Provides internationalization tools for WordPress projects.
MIT License
96 stars 52 forks source link

Add new field to translate in `theme.json` #292

Closed oandregal closed 2 years ago

oandregal commented 2 years ago

Depends on https://github.com/WordPress/gutenberg/pull/37038

In https://github.com/WordPress/gutenberg/pull/37038 Gutenberg is adding a new field to translate for the font sizes stored within a theme.json. This PR adds it to the i18n command.

Setup

How to test

{
  "version": "2",
  "settings": {
    "typography": {
      "fontSizes": [
        { "slug": "small", "size": "12px", "name": "Small", "alias": "S" }
      ]
    }
  }
}
#: ...

#: theme.json
msgctxt "Font size name"
msgid "Small"
msgstr ""

#: theme.json
msgctxt "Short font size name"
msgid "S"
msgstr ""
schlessera commented 2 years ago

Thanks for the PR, @oandregal !

oandregal commented 2 years ago

ok, that was fast :sweat_smile: I was about to push a tweak to the behat tests to include this case. Also, I was waiting until the Gutenberg PR that uses it at https://github.com/WordPress/gutenberg/pull/37038 was merged, to be 100% certain this was a change we needed.

If we're aiming to release 2.5.1 these days, I guess is fine to go ahead with this change. In the worst-case scenario (Gutenberg PR doesn't get merged), we'd need to remove this key in the future, but with no urgency as everything will work as expected.