Joined: Feb 5, 2013
Post Count: 136
Status:
Offline
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 <info@eteks.com> # # 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
France
Joined: Nov 7, 2005
Post Count: 9388
Status:
Offline
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 developer
----------------------------------------
[Edit 1 times,
last edit by Puybaret at Dec 5, 2021, 8:08:47 PM]
Romania
Joined: Apr 24, 2014
Post Count: 592
Status:
Offline
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 (Greer's Third Law) When all else fails, read the instructions.Murphy's Law
France
Joined: Nov 7, 2005
Post Count: 9388
Status:
Offline
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 developer
Romania
Joined: Apr 24, 2014
Post Count: 592
Status:
Offline
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 (Greer's Third Law) When all else fails, read the instructions.Murphy's Law
France
Joined: Nov 7, 2005
Post Count: 9388
Status:
Offline
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")) {
Romania
Joined: Apr 24, 2014
Post Count: 592
Status:
Offline
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 (Greer's Third Law) When all else fails, read the instructions.Murphy's Law