-
Notifications
You must be signed in to change notification settings - Fork 38
Provide a way to format & localize numbers #452
Comments
👍 While we're thinking about this, we should think about units too. A couple countries (namely Burma and Liberia (😈)) are still using imperial units. |
It would be very helpful for our use case to be able to do simple math in labels. We display feet everywhere on our map (I know, I know..) but we rely on Mapbox Terrain for elevation contours. These are in meters and people keep getting confused by this. Currently the text field on our contour labels is As far as I can tell, my only option is to create my own contour tileset and convert meters to feet. Another fix would be to include something like |
Unit customization and more general math functionality would be covered by #47. I think we should keep these two concepts separate, because (except for mixed numbers or non-positional systems like Roman or Chinese numerals) number formatting is all about text processing rather than arithmetic. |
This issue was moved to mapbox/mapbox-gl-js#4119 |
It’s possible for a style to localize string labels by choosing a language-specific field in the source. But when it comes to numeric types (elevations of peaks, for instance), the viewer is stuck with an unformatted number of the form ####.## using European digits. Ideally, it should be possible for a topo map to show elevations in #,###.## form for English, in # ###,## form for French, and in #,##,###.## form for various Indic languages. Meanwhile, an Arabic or Gujarati map would use the appropriate numeral system.
I’m not sure whether the number format should be controlled by the style (and thus defined in this specification) or determined by the system locale (and thus be implementation-specific). But I figured I’d start here because the conventional approach to localized strings involves changing style properties.
/cc @mikemorris @kkaefer @lucaswoj
The text was updated successfully, but these errors were encountered: