s1seven / schema-tools

Tools to create, validate and render certificates using Material Identity JSON schemas
https://materialidentity.org/
Apache License 2.0
1 stars 1 forks source link

Bug: localization of value in Inspections is not applied in PDF rendering when the property value in the JSON file is a `string` #143

Closed eamon0989 closed 2 years ago

eamon0989 commented 2 years ago

Description

The language-specific rules for formatting numbers are not applied to a numeric value in Inspections. Localization of inspection value image

        {
          "PropertyId": "51",
          "Property": "Density",
          "Method": "DIN EN ISO 1183-1A",
          "Unit": "g/cm³",
          "Value": "85.56",
          "ValueType": "number",
          "Minimum": 85.1,
          "Maximum": 89.9
        },

As you can see above, the Minimum and Maximum values are localized correctly, but the Value's value is not. This is because the value of Value is a string, while the other values are numbers.

To Reproduce

Steps to reproduce the behavior: Use fixtures/valid_certificate_3.json from CoA-schemas to generate a pdf. Look in the inspections section. If the value of any of the 3 properties mentioned above is a string, localization will fail. If it is a number, it will localize correctly.

Expected behavior

Localization should be applied the same way as for the Minimum and Maximum when the type is a string, in this case, there should be a comma in between each number.

This issue is linked to the following issue in the CoA-schemas repository: https://github.com/thematerials-network/CoA-schemas/issues/46