Fixed name of measurement systems (#1717)

Signed-off-by: Kai Kreuzer <kai@openhab.org>
pull/1719/head
Kai Kreuzer 2020-10-14 22:46:55 +02:00 committed by GitHub
parent 0d1a15ef34
commit e9ffff9f01
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 2 deletions

View File

@ -153,10 +153,10 @@ public class I18nProviderImpl
final SystemOfUnits newMeasurementSystem;
switch (ms) {
case "SI":
case SIUnits.MEASUREMENT_SYSTEM_NAME:
newMeasurementSystem = SIUnits.getInstance();
break;
case "US":
case ImperialUnits.MEASUREMENT_SYSTEM_NAME:
newMeasurementSystem = ImperialUnits.getInstance();
break;
default:

View File

@ -39,6 +39,8 @@ import tec.uom.se.unit.Units;
@NonNullByDefault
public final class ImperialUnits extends CustomUnits {
public static final String MEASUREMENT_SYSTEM_NAME = "US";
private static final ImperialUnits INSTANCE = new ImperialUnits();
/** Additionally defined units to be used in openHAB **/
@ -110,4 +112,9 @@ public final class ImperialUnits extends CustomUnits {
INSTANCE.units.add(unit);
return unit;
}
@Override
public String getName() {
return MEASUREMENT_SYSTEM_NAME;
}
}

View File

@ -36,6 +36,8 @@ import tec.uom.se.unit.Units;
@NonNullByDefault
public final class SIUnits extends CustomUnits {
public static final String MEASUREMENT_SYSTEM_NAME = "SI";
private static final SIUnits INSTANCE = new SIUnits();
public static final Unit<Temperature> CELSIUS = addUnit(Units.CELSIUS);
@ -75,4 +77,9 @@ public final class SIUnits extends CustomUnits {
INSTANCE.units.add(unit);
return unit;
}
@Override
public String getName() {
return MEASUREMENT_SYSTEM_NAME;
}
}