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

Modifiers for interpolated values #1754

Open
3 tasks done
lnvglr opened this issue Mar 1, 2024 · 0 comments
Open
3 tasks done

Modifiers for interpolated values #1754

lnvglr opened this issue Mar 1, 2024 · 0 comments
Labels
Status: Proposal Request for comments

Comments

@lnvglr
Copy link

lnvglr commented Mar 1, 2024

Clear and concise description of the problem

Lets say you want to translate "Passenger" as well as "Remove passenger". And let's say passengers are not the only thing you want to remove (i.e. images, links etc.).

Currently, what you have to do (it seems), is to add a source key for every scenario:

{
  "passenger": "Passenger",
  "image": "Image",
  "link": "Link",
  "remove.passenger": "Remove @.lower:passenger",
  "remove.image": "Remove @.lower:image",
  "remove.link": "Remove @.lower:link"
}

And you would use it like so: $t("remove.passenger").
But that seems awfully redundant!

Suggested solution

What if, instead, you could lowercase interpolated strings.

{
  "remove": "Remove @.lower:{value}",
  "passenger": "Passenger",
  "image": "Image",
  "link": "Link",
}

And you would use it like so $t("remove", { value: $t("passenger") } )

Alternative

No response

Additional context

This would open up endless possibilities, especially for custom modifiers

Validations

@lnvglr lnvglr added the Status: Proposal Request for comments label Mar 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Proposal Request for comments
Projects
None yet
Development

No branches or pull requests

1 participant