[Kstars-devel] branches/KDE/3.5/kdeedu/kstars/kstars

Jason Harris kstars at 30doradus.org
Sat Sep 24 20:08:03 CEST 2005


SVN commit 463659 by harris:

Fixing remaining issue in BR #112925.  The reported issue ("Moon not 
found" messages at startup) was actually just a symptom of the true 
problem: it wasn't just the Moon, if using a non-English language, then 
any object whose localized name starts with a different letter than its 
English name would be impossible to locate in the ObjectNameList.

This is due to an inconsistency in that class.  The class divides all 
named objects into 26 lists, to make locating an object by its name 
much faster.  The division is done by the first letter of the 
*untranslated* English name.  However, in some parts of 
objectnamelist.cpp, the list is selected by the first letter of the 
*translated* name.  Whoops.

[[Developer notes]]
Given that the lists are divided by their English name, its pretty 
confusing that the object names are stored in their translated form.  
Why not just store the names in English, since we use English object 
names throughout the code?  This class is in need of some revision for 
KDE4.

BUG: 112925
CCMAIL: kstars-devel at kde.org



 M  +1 -7      ksmoon.cpp  
 M  +6 -4      objectnamelist.cpp  


--- branches/KDE/3.5/kdeedu/kstars/kstars/ksmoon.cpp #463658:463659
@@ -27,15 +27,9 @@
 #include "kstarsdata.h"
 
 KSMoon::KSMoon(KStarsData *kd)
- : KSPlanetBase( kd, "Moon", "", 3474.8 /*diameter in km*/ ) {
+ : KSPlanetBase( kd, I18N_NOOP("Moon"), "", 3474.8 /*diameter in km*/ ) {
 	BData.setAutoDelete(true);
 	LRData.setAutoDelete(true);
-	
-	//This shouldn't be necessary, but butting "I18N_NOOP()"
-	//in the KSPlanetBase ctor arg seems to make KSMoon
-	//get localized string for Name, rather than "Moon"
-	//(see BR #112925)
-	I18N_NOOP( "Moon" );
 }
 
 KSMoon::~KSMoon() {
--- branches/KDE/3.5/kdeedu/kstars/kstars/objectnamelist.cpp #463658:463659
@@ -74,7 +74,7 @@
 	// create SkyObjectName with translated name
 	SkyObjectName *soName = new SkyObjectName( iName, object );
 	// append in localized list
-	currentIndex = getIndex( iName );
+	currentIndex = getIndex( name );
 	list[local] [currentIndex].append(soName);
 
 	// type == -1 -> constellation
@@ -88,7 +88,7 @@
 	}
 
 	// append in latin list
-	currentIndex = getIndex(iName);
+	currentIndex = getIndex(name);
 	list[latin][currentIndex].append(soName);
 	// set list unsorted
 	unsorted[currentIndex] = true;
@@ -193,6 +193,10 @@
 	if (name.isNull()) return 0;
 	// find works only in one list and not in all lists
 	setMode(oneList);
+
+	// items are stored translated (JH: Why?  this whole class is confusing...)
+	QString translatedName = i18n(name.utf8());
+
 	int index = getIndex(name);
 
 	// first item
@@ -204,8 +208,6 @@
 	if (upper == -1) return 0;
 
 	int next;
-	// items are translated stored
-	QString translatedName = i18n(name.utf8());
 
 	// it's the "binary search" algorithm
 	SkyObjectName *o;


More information about the Kstars-devel mailing list