Regional Number Separator (TADS 3) (Adv3Lite?)

Hey, forum~

So, I’m aware that some countries separate the digits of their numbers differently. The main one is numbers are formatted as 1,000.53 in the USA, while in Germany (I think? Been a while since I ever had to worry about German number formatting) they’re formatted as 1.000,53.

Is there a way to access the number separators of the player’s region in TADS 3 (adv3Lite)?

Alternatively, should I just go with Wikipedia’s format of 1 000.53 instead?

(This is for my custom-data-format project, so I can’t use the usual string conversion tools; gotta make my own.)

1 Like

In Italy, we use 1.000,00 (that is, dot for thousands, comma for the decimal separator, the exact opposite of US usage)

Usually the issue is solved with a variable/macro containing the regional separator, the logic being, roughly:

#if defined USA:
$THOUSAND = ‘,’
$FRACTION = '."
#elseif
$THOUSAND = '."
$FRACTION = ‘,’

side note, in east asia, the separator is not between 10³, but between 10^4…

Best regards from Italy,
dott. Piergiorgio.

2 Likes

So, essentially, TADS 3 does not have anything built-in for this, and I would need to completely implement it for myself?

Just checking for understanding. The logic you presented is clear and rather clever, but I’m guessing there’s no “USA” value injected by the interpreter when it runs the game in the states?

There isn’t. But, personally, I’d find it rather jarring for an English-language game to suddenly use German number formatting conventions just because I’m in Germany. So I’d say switching this is something for the author to worry about if they want to write a game in another language.

1 Like

well, this can be an interesting puzzle if the setting is nazi germany and the PC a GI

(dunno if asking for q cheque was actually part of gestapo’s bag of tricks… but this led toward cruel rating, appropriate for the type of NPC, whose are definitively cruel ones…)

Best regards from Italy,
dott. Piergiorgio.

1 Like

Ah! And this is my typical Java utility design instincts creating problems for me again! :laughing:

Player expectations!! I must not break player expectations! Thank you for reminding me! I’ll stick to the number separators used in my game’s language, then…!

If only I wasn’t a science fiction writer…! :smile:

Although I can’t see why a similar kind of puzzle couldn’t appear in a future setting; the player would just need more context.

Also, this is a neat idea for anyone looking into writing a WWII espionage game lol.

It would be great if TADS could fetch locale settings from the underlying OS and use that for number / date / currency formatting. I think that would require extending the VM, though.

2 Likes