Temperatur etc. from Locale


Gerriet M. Denkmann
 

I want to know, given a certain NSLocale (e.g. NSLocale.currentLocale), how to represent:

Temperature (K, °C or whatever)
Distance (km, miles, furlongs, lightyears, … )
Speed (m/sec, km/h, …)
Frequency (rpm, U/min, Hz, … )

The only thing I did find out is that my locale uses NSLocaleMeasurementSystem = Metric .

Is the Locale the right place to look for this information?

There is Unicode Common Locale Data Repository, which claims to be used by “Apple (macOS, iOS, watchOS, tvOS, and several applications; Apple Mobile Device Support”.

But I did not find anything about temperature etc.

Gerriet.


Andy Lee
 

I haven't played with it myself, but maybe NSMeasurementFormatter?

--Andy

On Sep 24, 2018, at 2:35 AM, Gerriet M. Denkmann <g@mdenkmann.de> wrote:

I want to know, given a certain NSLocale (e.g. NSLocale.currentLocale), how to represent:

Temperature (K, °C or whatever)
Distance (km, miles, furlongs, lightyears, … )
Speed (m/sec, km/h, …)
Frequency (rpm, U/min, Hz, … )

The only thing I did find out is that my locale uses NSLocaleMeasurementSystem = Metric .

Is the Locale the right place to look for this information?

There is Unicode Common Locale Data Repository, which claims to be used by “Apple (macOS, iOS, watchOS, tvOS, and several applications; Apple Mobile Device Support”.

But I did not find anything about temperature etc.

Gerriet.





Gerriet M. Denkmann
 

On 24 Sep 2018, at 20:41, Andy Lee via Groups.Io <aglee=mac.com@groups.io> wrote:

I haven’t played with it myself, but maybe NSMeasurementFormatter?
Excellent. Just what I needed.

Contrary to my expectations Celsius/Fahrenheit is *not* part of Locale, but set in System Preferences → Language & Region → Temperature.

I can’t find “rounds per minute”, but probably I can make my own from NSUnitAngle.revolutions and
NSUnitDuration.minutes.

fr_FR "2,6 km" "2,6 km" "2,6 kilomètres"
de_DE "2,6 km" "2,6 km" "2,6 Kilometer"
en_IE "2.6km" "2.6 km" "2.6 kilometres"
zh_ZH "2.6公里" "2.6公里" "2.6公里"
th_TH "2.6กม." "2.6 กม." "2.6 กิโลเมตร"
en_US “1.6mi" "1.6 mi" "1.6 miles"

Kind regards,

Gerriet.