Is there a way to localize Temperature in Java? Like temperature format will be based on the locale?
Because for example, for Norwegian language temperature format should be 14 °C. There should be a space before degrees symbol. But other languages should be 14°C.
The following example demonstrates temperature localization, including customizable rounding and formatting of decimal values by locale specific properties.
MyResources_DE.properties:
MyResources_NR.properties:
MyResources_en_US.properties:
This can be verified by the following unit test:
Note that by contract, all provided temperature values should have the same base scale (here it's kelvin).