javascript - Rails translations issue with i18n-js -


i'm using http://github.com/fnando/i18n-js gem javascript translation. here translation yml:

en:   js:     test: "<strong>%{name}</strong> created board." 

in js, run "name" param "$&".

console.log(i18n.t('js.test', {name: "$&"})) 

unfortunately, show message this: %{name} created board, while expect message should be: $& created board. there problem special character "&" gem? , how solve this?

the problem in code is, interpolation not working used %{name} in translation file. have use: {{name}} instead make interpolation work.

so, change:

test: "<strong>%{name}</strong> created board." 

to this:

test: "<strong>{{name}}</strong> created board." 

and should work!


Comments

Popular posts from this blog

dns - How To Use Custom Nameserver On Free Cloudflare? -

python - Pygame screen.blit not working -

c# - Web API response xml language -