The documentation for javascript translation in django only gives examples of pluralised interpolation. I want to do something simple like below:
var format = gettext("Displaying %(count)s / %(total)s")
var text = interpolate(format, {"count": 5, "total": 10})
which should set text
to Displaying 5 / 10
But this isn't working for me. I get Displaying %(count)s / %(total)s
as the value for for text
.
Does anyone know how to do this simple sort of interpolation?
You're missing true
argument:
var text = interpolate(format, {"count": 5, "total": 10}, true);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With