Inspection values were not localizing correctly for the Value, Minimum, and Maximum properties if the type was a string instead of a number. This is due to a check in localizeNumber that checks if the value is of type number, otherwise returning the original value.
else if (format === 'Number' && typeof value === 'number') {
return localizeNumber(value, locales);
}
My code localizes the number before it is passed to computeTextStyle, ensuring that it is correctly localized even if it is a string.
Description
Inspection values were not localizing correctly for the
Value
,Minimum
, andMaximum
properties if the type was astring
instead of anumber
. This is due to a check inlocalizeNumber
that checks if the value is of typenumber
, otherwise returning the original value.My code localizes the number before it is passed to
computeTextStyle
, ensuring that it is correctly localized even if it is astring
.Fixes #143 Fixes thematerials-network/CoA-schemas#46
Before:
After:
As you can see in the screenshot, the values for
Value
,Minimum
andMaximum
are now correctly localized (they contain commas instead of dots).Type of change
Checklist: