I’m in the process of localizing my game, and I’ve got various places where I have various numbers I’d like to localize that have decimals in them. If I do:
Never done that before, and after doing a few researches and testing, it seems that it’s not working in gdscript? I’m definitely not sure about it, hopefully someone will correct me, but if that can be done, I don’t see how.
I guess that’s not an ideal solution, but if you don’t want to spend time on implementing a custom function, you could use a C# method and call it from gdscript.
Never done a method call from gdscript to C#, only the opposite, but from what I’ve read, it’s doable fairly easily. No idea of the performance though.
Hope that helps, despite not being a perfect answer!
I’m actually generating my level data in an external C program, so I could potentially do it there if i had to. If I can somehow convince Godot to do it for me, though, I’d prefer that.
Sadly it’s more complicated.
Take the number 5877.34, for instance. In some languages, it would localized as 5.877,34. In mine, it would be 5 877,34. Depending on the language, the result can vary and a simple replace would not be enough.
I think, format_number() only deals with completely different numeral systems (Arabic, Persian etc, but not as different as Japanese ) and that’s why it returns the same string. I don’t see “de”, “zh” or “ja” in the description provided by mrcdk
I guess I’ll build my own functionality for this. I might be able to farm it off to an external executable, or I might just write it inline. I may put up a proposal for it, but at the moment I’m keeping the game on Godot 4.3.stable because I’m close to shipping.