Re: Sweet Home 3D 6.5A bug was found in Sweet Home 3D

by Puybaret » Mon Dec 06, 2021 11:33 am

I just checked the source code of the [font=courier new]TotalResult[/font] class you programmed, and you formatted surface texts another way in [font=courier new]UpdateCalc[/font] method.
As you compute the text of the surface unit [font=courier new]unitSurf[/font] from the name of the current length unit, this can lead to errors for languages where this name is localized (like Chinese or Russian).

A quick fix could consist of testing the current unit and not its name. Therefore, the line:

Code: Select all

if (unitName.equalsIgnoreCase("mm") || unitName.equalsIgnoreCase("cm") || unitName.equalsIgnoreCase("m")) {
should rather be:

Code: Select all

if (preferences.getLengthUnit() == LengthUnit.MILLIMETER || preferences.getLengthUnit() == LengthUnit.CENTIMETER || preferences.getLengthUnit() == LengthUnit.METER) {
Good luck for the roofs!