cli icon indicating copy to clipboard operation
cli copied to clipboard

[Bug]: Theme Check - locale keys with _html and pluralisation.

Open pocallaghan-function opened this issue 1 year ago • 0 comments

Please confirm that you have:

  • [x] Searched existing issues to see if your issue is a duplicate. (If you’ve found a duplicate issue, feel free to add additional information in a comment on it.)
  • [x] Reproduced the issue in the latest CLI version.

In which of these areas are you experiencing a problem?

Theme

Expected behavior

It should be possible to use pluralisation with html keys without a ValidJSON error getting triggered.

Actual behavior

A ValidJSON error is triggered.

Verbose output

info ─────────────────────────────────────────────────────────────────────────

locales/en.default.json

Incorrect type. Expected "string".

208 "count_html": { 209 "one": "There is <span class="count">{{ count }} item", 210 "other": "There are <span class="count">{{ count }} items" 211 }

Reproduction steps

  1. Add this to your locales file:
  "example": {
    "count_html": {
      "one": "There is <span class=\"count\">{{ count }}</span> item",
      "other": "There are <span class=\"count\">{{ count }}</span> items"
    }
  },
  1. Add this to your liquid file:
      {{ 'example.count_html' | t: count: 1 }}<br/>
      {{ 'example.count_html' | t: count: 2 }}<br/>
  1. Run shopify theme check

The file is reported as invalid, however if you preview the theme the pluralisation clearly works.

Operating System

Mac OS Sonoma

Shopify CLI version (check your project's package.json if you're not sure)

3.68.0

Shell

zsh

Node version (run node -v if you're not sure)

No response

What language and version are you using in your application?

No response

pocallaghan-function avatar Oct 07 '24 16:10 pocallaghan-function