Skip to content
Discussion options

You must be logged in to vote

That's intentional rather than a bug. The unit formatting in spatial-k is locale-independent on purpose:

  • format() writes exactly what parse() / parseOrNull() reads back, and the parser only accepts . as the decimal separator. The KDoc on LengthFormat spells it out: "A comma is never a decimal separator."
  • Some presets target machine-readable formats, e.g. LengthFormat.Osm for OpenStreetMap tags, where 3.5 m is valid and 3,5 m isn't.
  • It's common Kotlin Multiplatform code, and the stdlib has no locale-aware number formatting there, so following the device locale would need platform-specific code on every target.

So it's best to treat toString() / format() as a stable, round-trippable repre…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by sargunv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants