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

ValidSchema check errors on nested translation keys #722

Open
david-w-shopify opened this issue Jan 20, 2025 · 1 comment
Open

ValidSchema check errors on nested translation keys #722

david-w-shopify opened this issue Jan 20, 2025 · 1 comment
Labels
Bug Something isn't working SEV-2 High Severity

Comments

@david-w-shopify
Copy link

david-w-shopify commented Jan 20, 2025

Describe the bug
When using the locales object in a section schema, Theme Check raises an error if the translation is an object rather than a string, despite being renderable on the frontend.

Image

Image

Despite this being accepted by the platform, and renderable by Liquid, in the /themes/:id/language UI the nested keys only use the last portion of the key (desktop or mobile) in this case. So whilst I'd argue this is still a valid schema, I do think it's still worth at least warning users about to discourage a poor edit experience for merchants.

Source

// section/test-section.liquid

<p>{{ 'sections.test-section.title' | t }}</p>
<p>{{ 'sections.test-section.description.desktop' | t }}</p>
<p>{{ 'sections.test-section.description.mobile' | t }}</p>

{% schema %}
{
  "name": "Section",
  "locales": {
    "en": {
      "title": "Title",
      "description": {
        "desktop": "Lorem ipsum dolor sit amet consectetur, adipisicing elit.",
        "mobile": "Lorem ipsum dolor sit amet"
      }
    }
  }
}
{% endschema %}

Expected behaviour
No errors

Actual behaviour
The description object in the schema has a ValidSchema error

Debugging information

  • OS: Mac
  • OS Version: Sequoia 15.2
  • Theme Check Version: 3.73.2
@david-w-shopify
Copy link
Author

I've done some more investigation and this also raises an error for pluralised locales, e.g.

<p>{{ 'sections.test-section.title' | t }}</p>
<p>{{ 'sections.test-section.description' | t: count: 1 }}</p>

{% schema %}
{
  "name": "Section",
  "locales": {
    "en": {
      "title": "Title",
      "description": {
        "one": "Some thing",
        "other": "Some things"
      }
    }
  }
}
{% endschema %}

For the sake of pluralisation I think this ought to be reviewed.

@aswamy aswamy added Bug Something isn't working SEV-2 High Severity labels Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working SEV-2 High Severity
Projects
None yet
Development

No branches or pull requests

2 participants