I’ve had a few users asking lately about dynamically creating their button text for Impromptu. I thought I’d take a moment to share a small bit of code to help out. The documentation shows using a quick way to name your buttons like so:

var btns = { Ok:true, Cancel: false };

But many times you need something more complex. Maybe you are supporting multiple languages and need to call a function to get the correct translation for your buttons. Heres how you might go about such considering lang() will be a function to return the appropriate text. (this was borrowed from a comment on a previous post)

var btns = {};
btns[lang("ok")] = true;
btns[lang("cancel")] = false;

Thats all there is to it, just approaching it a different way is all. I hope this helps everyone out!