Skip to content

{% schema %} checking of t: translations only seems to be checking name properties. #942

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

Open
charlespwd opened this issue May 9, 2025 · 0 comments
Labels
Bug Something isn't working

Comments

@charlespwd
Copy link
Contributor

Describe the bug
A setting of type select should throw errors if the label of its options don't exist. Right now we have no support for those.

Looks like that's also a problem for a preset's category field

Source

{% schema %}
{
  "name": "t:general.group",
  "blocks": [{ "type": "@theme" }],
  "settings": [
    {
      "type": "select",
      "id": "layout_direction",
      "label": "t:labels.layout_direction",
      "options": [
        { "value": "group--horizontal", "label": "t:options.direction.horizontal" },
        { "value": "group--vertical", "label": "t:options.direction.vertical" }
      ],
      "default": "group--vertical"
    },
    {
      "type": "select",
      "id": "alignment",
      "label": "t:labels.alignment",
      "options": [
        { "value": "group--left-aligned", "label": "t:options.alignment.left" },
        { "value": "group--center-aligned", "label": "t:options.alignment.center" },
        { "value": "group--right-aligned", "label": "t:options.alignment.right" }
      ],
      "visible_if": "{{ block.settings.layout_direction == 'group--vertical' }}"
    },
    {
      "type": "range",
      "id": "padding",
      "label": "t:labels.padding",
      "default": 0,
      "min": 0,
      "max": 100,
      "step": 1,
      "unit": "px",
    }
  ],
  "presets": [
    {
      "name": "t:general.column",
      "category": "t:categories.alignment.left",
      "settings": {
        "layout_direction": "group--vertical",
        "alignment": "group--left-aligned",
        "padding": 0
      }
    },
    {
      "name": "t:general.row",
      "category": "t:categories.layout",
      "settings": {
        "layout_direction": "group--horizontal",
        "padding": 0
      }
    }
  ]
}
{% endschema %}

Expected behaviour
I got a couple of things in there that should show errors because the labels don't exist.

Actual behaviour
name properties seem to be linted OK.
label inside select options doesn't.
category inside preset doesn't`

Debugging information

  • OS [e.g. Windows, Mac, Linux]
  • OS Version
  • Theme Check Version [e.g. 0.1.0]

Additional context
Add any other context about the problem here.

@charlespwd charlespwd added the Bug Something isn't working label May 9, 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
Projects
None yet
Development

No branches or pull requests

1 participant