Title: Add Device number format · Issue #10588 · NativeScript/NativeScript · GitHub
Open Graph Title: Add Device number format · Issue #10588 · NativeScript/NativeScript
X Title: Add Device number format · Issue #10588 · NativeScript/NativeScript
Description: Is your feature request related to a problem? Please describe. I'd like to more easily & accurately identify the user's preferred number format, to use when formatting numbers in my app to match this. Describe the solution you'd like I'd...
Open Graph Description: Is your feature request related to a problem? Please describe. I'd like to more easily & accurately identify the user's preferred number format, to use when formatting numbers in my app to match th...
X Description: Is your feature request related to a problem? Please describe. I'd like to more easily & accurately identify the user's preferred number format, to use when formatting numbers in my app...
Opengraph URL: https://github.com/NativeScript/NativeScript/issues/10588
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Add Device number format","articleBody":"### Is your feature request related to a problem? Please describe.\r\n\r\nI'd like to more easily & accurately identify the user's preferred number format, to use when formatting numbers in my app to match this.\r\n\r\n\r\n\r\n\r\n### Describe the solution you'd like\r\n\r\nI'd like to see NativeScript's [Device class](https://docs.nativescript.org/core/device) contain a numberFormat property to expose their OS-level user preference:\r\n\r\n_Identifying the user's preference is the goal here_; not actually reformatting of numbers. Once I have that, I can handle formatting numbers within my app to match their preference.\r\n\r\nFrom iOS Settings -> General -> Language & Region -> Number Format:\r\n\r\n\r\n\r\n### Describe alternatives you've considered\r\n\r\nI've tried:\r\n- Using `Intl.NumberFormatter` in NativeScript (v8.7.2), but it is broken and always uses a comma thousands separator. The [Intl class is not supported currently apparently](https://github.com/NativeScript/NativeScript/issues/10297#issuecomment-2095041966).\r\n- I've considered npm's `Intl` class, but it hasn't been updated in 8 years, and I found errors, _shockingly_, even in the current NodeJS Intl class for thousands and fractional separators for certain regions. _This class is also not consistent with iOS's number formatting for certain regions._\r\n- I ended up using a Node script to create base data set of thousands and fractional separators, and then manually correcting and handling scenarios such as french-speaking Canada vs English speaking Canada. \r\n\r\nHowever, all of the above are error prone, require maintenance, and are not guaranteed to respect/match the user's system-level preference on iOS. \r\n\r\nThe ideal solution would be to get this from the user's iOS system preferences, so we can format it to what the user expects.\r\n\r\n### Anything else?\r\n\r\n_No response_\r\n\r\n### Please accept these terms\r\n\r\n- [X] I have searched the [existing issues](https://github.com/NativeScript/NativeScript/issues) as well as [StackOverflow](https://stackoverflow.com/questions/tagged/nativescript) and this has not been posted before\r\n- [X] I agree to follow this project's [Code of Conduct](https://github.com/NativeScript/NativeScript/blob/master/tools/notes/CONTRIBUTING.md#coc)","author":{"url":"https://github.com/jasongitmail","@type":"Person","name":"jasongitmail"},"datePublished":"2024-07-21T18:33:04Z","url":"https://github.com/NativeScript/NativeScript/issues/10588"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:e1eda888-c488-9a0b-d905-4f5d611d2b0c |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9516:37820D:14971AE:1B5B9E4:6B011DDA |
| html-safe-nonce | ea1c92ffae18330aa610b8b0538968b761f6e71350fef4d64ffb1e57490f86d8 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NTE2OjM3ODIwRDoxNDk3MUFFOjFCNUI5RTQ6NkIwMTFEREEiLCJ2aXNpdG9yX2lkIjoiODgyNDM0ODA4NDgzNTI2MTkxNCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 0dc0b1886dd5c249838f908b9b8aa058679d81baac298a35955298c3155eb956 |
| hovercard-subject-tag | issue:2421553811 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/NativeScript/NativeScript/10588/issue_layout |
| twitter:image | https://opengraph.githubassets.com/a2c6069f99faee8581bbcd13b19eb99971e115c20bb3354bf0c8b72d9d1a27c8/NativeScript/NativeScript/issues/10588 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/a2c6069f99faee8581bbcd13b19eb99971e115c20bb3354bf0c8b72d9d1a27c8/NativeScript/NativeScript/issues/10588 |
| og:image:alt | Is your feature request related to a problem? Please describe. I'd like to more easily & accurately identify the user's preferred number format, to use when formatting numbers in my app to match th... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jasongitmail |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| turbo-cache-control | no-preview |
| go-import | github.com/NativeScript/NativeScript git https://github.com/NativeScript/NativeScript.git |
| octolytics-dimension-user_id | 7392261 |
| octolytics-dimension-user_login | NativeScript |
| octolytics-dimension-repository_id | 31492490 |
| octolytics-dimension-repository_nwo | NativeScript/NativeScript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 31492490 |
| octolytics-dimension-repository_network_root_nwo | NativeScript/NativeScript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width