sprintf.js is a complete open source JavaScript sprintf implementation.