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

Interpolation API #8

Open
virolea opened this issue Sep 20, 2024 · 2 comments
Open

Interpolation API #8

virolea opened this issue Sep 20, 2024 · 2 comments
Assignees
Labels
feature New feature or request

Comments

@virolea
Copy link
Owner

virolea commented Sep 20, 2024

No description provided.

@virolea virolea added the feature New feature or request label Sep 20, 2024
@virolea virolea self-assigned this Sep 20, 2024
@djfpaagman
Copy link

I once worked on an internal tool very similar to this, cool to see you working on it as a gem!

Just wanted to drop that it probably already works out of the box if you use string substitution like so:

irb(main):001> "Hello %{name}" % { name: "Dennis" }
=> "Hello Dennis"

@virolea
Copy link
Owner Author

virolea commented Oct 4, 2024

Thanks for the input! That's a neat trick indeed. I learnt this from the ruby-gettext docs as well.

There still some thinking needed to know how to get there. In this example

_ "%{count} message", count: 2 

count is both needed for pluralization and interpolation. I'd like to have a simple interface to translation, yet it has accomodate for several features in the background.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants