Interpolation API
Opened this issue · 2 comments
virolea commented
Interpolation API
djfpaagman commented
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 commented
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.