Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

theme-check(ValidJSON) mistakenly highlights plural with html as error #798

Open
frej-hobbii opened this issue May 14, 2024 · 3 comments
Open
Labels
Bug Something isn't working

Comments

@frej-hobbii
Copy link

Describe the bug
When adding a locale that has html content inside, the theme check highlights it as an error, even though it works as expected in liquid.

When combining _html postfix to render the locale string as HTML, and a plural, the linting gets confused.

locale

  "ticker": {
    "ticker_physical_stores_html": {
      "one": "<strong>{{ count }} huge</strong> store",
      "other": "<strong>{{ count }} huge</strong> stores"
    }
  },

liquid

<div>{{ 'ticker.ticker_physical_stores_html' | t: count: 3 }}</div>
Screenshot 2024-05-14 at 10 30 22 Screenshot 2024-05-14 at 10 30 40

The CLI theme check works as expected, resulting in no errors

Screenshot 2024-05-14 at 10 45 21

Expected behaviour
The VS code extension's theme check should work the same as the CLI

Actual behaviour
False negative is thrown

Debugging information

  • OS: Mac
  • OS Version: Sonoma 14.1.1
  • Theme Check Version shopify.theme-check-vscode Shopify Liquid v2.3.2

Additional context
Add any other context about the problem here.

@mgmanzella
Copy link
Contributor

👋 hi @frej-hobbii , thanks for reporting this issue 🙏 you're seeing this behavior because of this keyname: ticker_physical_stores_html

in our translation schemas a keyname with _html postfix expects string types, not JSON. changing the name of the key will solve your issue:
Screenshot 2024-05-15 at 3 35 15 PM

@steffenagger
Copy link

@mgmanzella that's not really a solution.
While this does make the theme-check happy, removing the _html suffix will result in the html inside the translation-strings being escaped.
Can you elaborate on how to achieve pluralized translations containing html, while making the theme-check happy?
Or perhaps reopen the issue.

pluralized translations
prevent translations from being escaped

@mgmanzella mgmanzella reopened this Jun 13, 2024
@mgmanzella mgmanzella added the Bug Something isn't working label Jun 17, 2024
@mgmanzella
Copy link
Contributor

👋 thanks for the clarification, you're right and the fix for this would be a change in theme liquid docs to add this use case in the schema that validates this json

@charlespwd charlespwd transferred this issue from Shopify/theme-tools Oct 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants