Our records show that you have outstanding author rewards points. Please confirm your latest payment information and redeem your points balance via the Author Reward Store.
X

The "100k" and "1.2m" used by many addons to abbreviate large number values are based on the International System of Units. Indeed, its common abbreviation "SI" comes from the French, so it shouldn't be confusing at all. :p

That's exactly what it means, Ketho. Youre "logic thinking" is correct.

a = b == "." and "," or "."

If a is a decimal, we want b to be a comma, but if b is a comma, then we want a to be a decimal. The number "one million point zero five" would be represented either as "1,000,000.05" or "1.000.000,05" depending on the locale, but no locale uses the same character for both purposes, so if "a" is one, then "b" must be the other.

That said, I've been using the following function to group digits, which is much simpler than some of the solutions posted in this thread:

local function GroupDigits(num)
if not num then return 0 end
if abs(num) < 10000 then return num end
local neg = num < 0 and "-" or ""
local left, mid, right = tostring(abs(num)):match("^([^%d]*%d)(%d*)(.-)$")
return ("%s%s%s%s"):format(neg, left, mid:reverse():gsub("(%d%d%d)", "%1,"):reverse(), right)
end

You could add localization to it thusly:

local decimal = ("%.1f"):format(1/5):match("([^0-9])")
local thousands = decimal == "." and "," or "."
local function GroupDigits(num)
if not num then return 0 end
if abs(num) < 10000 then return num end
local neg = num < 0 and "-" or ""
local left, mid, right = tostring(abs(num)):match("^([^%d]*%d)(%d*)(.-)$")
return ("%s%s%s%s"):format(neg, left, mid:reverse():gsub("(%d%d%d)", "%1" .. thousands):reverse(), right)
end

It only works with whole numbers, but if you're dealing with unit health or pretty much any other numeric value returned by the WoW API, that's all you're getting anyway.

If a is a decimal, we want b to be a comma, but if b is a comma, then we want a to be a decimal. The number "one million point zero five" would be represented either as "1,000,000.05" or "1.000.000,05" depending on the locale, but no locale uses the same character for both purposes, so if "a" is one, then "b" must be the other.

That said, I've been using the following function to group digits, which is much simpler than some of the solutions posted in this thread:

You could add localization to it thusly:

It only works with whole numbers, but if you're dealing with unit health or pretty much any other numeric value returned by the WoW API, that's all you're getting anyway.