Proper way to handle comma as decimal point

So far I have been developing this URCap, with the language set to English, now I tried to set it to Danish, and that makes 0.5 values turn into 0,5 and that is causing problems when using them in a script.

What is the proper way to handle this? Do I go over all variables and do a replace(",", “.”); on them before using them in the script generator?