Jump to menu

Vote up?

  1. Rory Parle

    This is a very good introduction. I realize you said at the outset that, by necessity, you couldn’t cover every detail, but I thought people might be interested in this brief observation about your sprintf function. The way you have currently coded it you’re restricted to putting the variables in the string in a specific order. That probably won’t be a problem in the particular application that you present, but in general it can lead to translators having to use odd-sounding non-standard sentence formations to coerce the variables into the order they’re provided in. What would be better is a system where instead of specifying a string like, “You are ordering s, at a total cost of <strong>%s</strong> gold pieces.”, you could instead say, “You are ordering %{1:s}, at a total cost of <strong>{2:s}</strong> gold pieces.” The numbers in the variable markers represent which variable from the list goes where. That way, translators can put the variables in wherever they need to, even multiple times per variable if they want.