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 · 1 comment
Open
3 tasks done

Modifiers for interpolated values #1754

lnvglr opened this issue Mar 1, 2024 · 1 comment
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
@lnvglr
Copy link
Author

lnvglr commented Oct 11, 2024

Is there a perspective that this may get implemented at some point in the future?
Or did I miss something?

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