Skip to content

Feature Request: Tab stops for translations #537

Open
@david-w-shopify

Description

@david-w-shopify

Is your feature request related to a problem? Please describe.
After adding a translation, going backwards to add my variables is slow. It could be faster with built in tabstops.

Describe the solution you'd like
On injecting a translation, add a tabstop for each variable that's already injected.

For example, given this in locales/en.default.json

{
  "product": {
    "add_count_product_to_cart": "Add {{ count }} {{ product }} to cart"
  }
}

The following completion would be used

{{ 'product.add_count_product_to_cart' | t: count: ${1:count}, product: ${2:product} }}

This would mean I can immediately replace the "count" and "product" variables if I need to.


As more powerful alternative, the completion could look like this

{{ 'product.add_count_product_to_cart' | t: ${1:count: ${2:count}, }${3:product: ${4:product}} }}

This would mean I can remove a variable entirely if I desire. This is useful for scenarios where a translation will be rendered in JS, rather than rendered entirely via Liquid.

I am assuming that extensions use the same snippet syntax as user configured snippets here. If they don't and it's not clear, hopefully this video will help get the idea across

Screen.Recording.2024-10-22.at.11.11.30.mov

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions