Jump to content

The ultimate community for Ruby on Rails developers.


Ruby like string interpolation in Knockout (Javascript)

javascript knockout blog

  • Please log in to reply
No replies to this topic

#1 Ohm



  • Moderators
  • 529 posts
  • LocationCopenhagen

Posted 10 December 2013 - 01:29 PM

I just had this problem at work and thought I'd share with you guys (and the world).




The problem is that we wanted our strings to be consistent, like "Welcome %{name}" both for Ruby (Rails) use and for Javascript use.

We also wanted to interpolate the %{name} in both. In Ruby this is easy with the I18n string interpolation. In Javascript not so much.

Blog: http://ohm.sh | Twitter: @madsohm | Work: Lokalebasen.dk

Also tagged with one or more of these keywords: javascript, knockout, blog

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users