Print at Dec 17, 2025, 1:35:26 AM View all posts in this thread on one page
Posted by YGYL at Dec 4, 2021, 6:05:00 PM
shock   Sweet Home 3D 6.5A bug was found in Sweet Home 3D
In SweetHome3D.jar inside com\eteks\sweethome3d\model\LengthUnit_zh_CN.properties
Inside should be changed to
centimerUnit=\u5398\u7c73
The original has a few extra letters in front of it

This can lead to errors in area calculation units
Please fix as soon as possible

The full content of the correct LengthUnit_zh_CN.properties
----------------------------------------------
# LengthUnit_zh_CN.properties 16 Mar. 2009
#
# Translated to Chinese (Simplified) by Zhao Si-cong
#
# Sweet Home 3D, Copyright (c) 2008 Emmanuel PUYBARET / eTeks <[email protected]>
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
# Place, Suite 330, Boston, MA 02111-1307 USA

# Units (\u00b2 is the symbol for supercript 2)
centimerUnit=\u5398\u7c73
inchUnit=\u82f1\u5bf8
millimeterUnit=\u6beb\u7c73
meterUnit=\u7c73
squareMeterUnit=m\u00b2
squareFootUnit=\u5e73\u65b9\u82f1\u5c3a

Posted by Puybaret at Dec 4, 2021, 6:39:15 PM
Re: Sweet Home 3D 6.5A bug was found in Sweet Home 3D
I checked, even double checked with a binary editor and don’t see any hidden character in the centimeterUnit line of LengthUnit_zh_CN.properties.
How do you see the bug that you encountered?
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D creator

Posted by YGYL at Dec 5, 2021, 5:45:13 AM
Re: Sweet Home 3D 6.5A bug was found in Sweet Home 3D
centimerUnit
centimeterUnit
These 2 words are not the same

Posted by YGYL at Dec 5, 2021, 5:47:19 AM
Re: Sweet Home 3D 6.5A bug was found in Sweet Home 3D
It seems that the same mistake occurs in Russian

Posted by dorin at Dec 5, 2021, 6:38:04 PM
Re: Sweet Home 3D 6.5A bug was found in Sweet Home 3D
@YGYL You've right. That is what I've discover earlier.
BUT
@Emmanuel Is something strange:
centimeterUnit must be the correct.
In this case CN & RU don't work as aspect but TW which have centimerUnit = work.
If change CN & RU to incorrect form = work.
I suspect it is also a misspelling in other place of translations.
How to verify and reproduce:
1. Open a home with rooms;
2. Set preferences to English & centimeter;
3. Menu->Tools->RoomsInfo ==> in table are mâ‚‚ => OK
4. Set preferences to Chinese or Russian and repeat step 3 ==> ftâ‚‚ => Not OK.
If change centimerUnit with centimerUnit in CN & RU files will work but it has no logic (at least for me).
----------------------------------------
A computer program does what you tell it to do, not what you want it to do. Murphy's Law
When all else fails, read the instructions. Murphy's Law
If you don't like "AS IS", DIY. Dorin's law

Posted by Puybaret at Dec 5, 2021, 8:29:21 PM
Re: Sweet Home 3D 6.5A bug was found in Sweet Home 3D
I fixed this error in LengthUnit_zh_TW.properties, but it was the only wrong file.
In all cases, surface texts shouldn't be based on centimerUnit property but on squareMeterUnit or squareFootUnit properties according to the current unit set in preferences, and to avoid wondering how to format surface texts, programs should use getAreaFormatWithUnit in LengthUnit class, like in the PlanComponent class.
Dorin, did you use the same way?
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D creator

Posted by dorin at Dec 6, 2021, 10:37:49 AM
Re: Sweet Home 3D 6.5A bug was found in Sweet Home 3D
@Emmanuel
I don't remember what I've use (it was long time ago) but probably I don't use this way.
At the moment I steel fight with roofs.
After I finish somehow this, I'll reanalyze RoomsInfo plugin and I'll tray to improve it.
Thanks for the clue!! I really need it.
----------------------------------------
A computer program does what you tell it to do, not what you want it to do. Murphy's Law
When all else fails, read the instructions. Murphy's Law
If you don't like "AS IS", DIY. Dorin's law

Posted by Puybaret at Dec 6, 2021, 11:33:38 AM
Re: Sweet Home 3D 6.5A bug was found in Sweet Home 3D
I just checked the source code of the TotalResult class you programmed, and you formatted surface texts another way in UpdateCalc method.
As you compute the text of the surface unit unitSurf 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:
if (unitName.equalsIgnoreCase("mm") || unitName.equalsIgnoreCase("cm") || unitName.equalsIgnoreCase("m")) {
should rather be:
if (preferences.getLengthUnit() == LengthUnit.MILLIMETER || preferences.getLengthUnit() == LengthUnit.CENTIMETER || preferences.getLengthUnit() == LengthUnit.METER) {

Good luck for the roofs!
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D creator

Posted by dorin at Dec 6, 2021, 2:04:05 PM
Re: Sweet Home 3D 6.5A bug was found in Sweet Home 3D
Many thanks Emmanuel!!
Today I'll take a break from roof and I'll try to fix RoomsInfo.
If succeed I'll publish a fixed version.
Thanks again, without You, I have to spend mounts to find the bug (if I find)
----------------------------------------
A computer program does what you tell it to do, not what you want it to do. Murphy's Law
When all else fails, read the instructions. Murphy's Law
If you don't like "AS IS", DIY. Dorin's law