String.format with float - in german (comma as the decimal separator)

im doing something like this string.format( "%.3f" 3.12554 )

in english i get 3.126 in german i also get 3.126 - note the decimal is still a period, it should be a comma (and yes, it rounded up as well, which i did not think it would do)

string.format( "%,3f" 3.12554 ) - fails, it wont take a comma in the formatting so i cant customise that part.

am i doing something really stupid or is there really no way to get locale specific formatted float values?

its a problem because i convert into and out of strings (numbers in tooltips) - and tonumber already fails on thousand separators, but i can easily strip those out via a custom function. what i cannot do is have lua/wow giving me both a period and a comma as the decimal separator at the same time.

or is there some other way to do this?

Kind of a rough work-around and someone might have something better, but this’d do it.

gsub(string.format("%.3f", 3.12554), '.', ',')

http://lua-users.org/wiki/LuaLocales
not sure if they’re available in the wow api

How PitBull4 does it:
https://github.com/nebularg/PitBull4/blob/master/Modules/LuaTexts/ScriptEnv.lua#L251