javascript - Detect the user's prefered units -


how can detect units user prefers read?

i mean celcius vs fahrenheit, meters vs miles, etc.

i can use third-party services http://freegeoip.net/json/ ip, country code, etc. use navigator.language in browser have hint of language, not sure if there safe way sure present results in right units user.

(having select units options solve user, not in scope of question.)

no it's not in windows or other os aware of. android started offering icu (either 4j or c) via api latest "nougat" release. icu , unicode cldr know several units, unit system @ moment not exposed there either.

if call api http://freegeoip.net/json/, country name or code allow decide countries adopted metric system opposed others (only 3 including us), there many countries e.g. britain units used imperial system. street signs show distance in miles while see gas station offer fuel per litre, not gallon in us.


Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -