Bug 139237 - Add a <division> tag in the description file
Summary: Add a <division> tag in the description file
Status: RESOLVED FIXED
Alias: None
Product: kgeography
Classification: Unclassified
Component: general (show other bugs)
Version: 0.4.2
Platform: unspecified Linux
: NOR wishlist (vote)
Target Milestone: ---
Assignee: Albert Astals Cid
URL:
Keywords:
: 132495 (view as bug list)
Depends on:
Blocks:
 
Reported: 2006-12-26 15:13 UTC by Anne-Marie Mahfouf
Modified: 2006-12-28 21:23 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Anne-Marie Mahfouf 2006-12-26 15:13:03 UTC
Version:           0.4.2 (using KDE 3.5.5, compiled sources)
Compiler:          Target: i586-mandriva-linux-gnu
OS:                Linux (i686) release 2.6.17-5mdv

"division" is too vague as a word and if you add a tag in the description file the correct word could be retrieved from there. "division" can be either a country, a province, a region or a department depending on the map. It would be really better to have the right word in the GUI to add accuracy to KGeography.
<division>country</division> would do it. 
Regarding the handbook, we can add a sentence saying that "division" will mean either country, province, region or department depending of the case. "division" is very difficult to translate and thus the GUI looks weird or inaccurate in French for ex.
It seems that there was already a bug report about that, not sure if it was the same as bugzilla sort of froze while I tried to look.
Comment 1 Anne-Marie Mahfouf 2006-12-26 15:34:25 UTC
<division> is already taken so it has to be another tag!
Comment 2 Albert Astals Cid 2006-12-28 21:13:17 UTC
SVN commit 617340 by aacid:

Please the mistress!
Now a map can define how its divisions are called using <divisionsName> tag
FEATURE: 139237


 M  +1 -0      data/spain.kgm  
 M  +7 -0      src/kgeography.cpp  
 M  +13 -2     src/map.cpp  
 M  +5 -2      src/map.h  
 M  +8 -0      src/mapparser.cpp  


--- trunk/KDE/kdeedu/kgeography/data/spain.kgm #617339:617340
@@ -1,6 +1,7 @@
 <map>
 	<mapFile>spain.png</mapFile>
 	<name>Spain</name>
+	<divisionsName>Autonomous communities</divisionsName>
 	<division>
 		<name>Not Spain</name>
 		<ignore>yes</ignore>
--- trunk/KDE/kdeedu/kgeography/src/kgeography.cpp #617339:617340
@@ -345,6 +345,13 @@
 	delete p_map;
 	p_map = m;
 	
+	p_askMap->setText(i18n("&Location of %1", p_map->getDivisionsString()));
+	p_askPlaceMap->setText(i18n("&Place %1 in the Map", p_map->getDivisionsString()));
+	p_askCapitalDivisions->setText(i18n("%1 by Capital", p_map->getDivisionsString()));
+	p_askDivisionCapitals->setText(i18n("&Capitals of %1", p_map->getDivisionsString()));
+	p_askFlagDivisions->setText(i18n("%1 by Flag", p_map->getDivisionsString()));
+	p_askDivisionFlags->setText(i18n("&Flags of %1", p_map->getDivisionsString()));
+	
 	QString sw = i18nc("There are two ways of dealing with the translation of \"Current map: %1\". The first option simply replaces %1 with the translated name of the relevant region. If the grammar of your language allows this, choose this option by setting the translation of this message to 1, and leave untranslated the translations of \"Current map: %1\" that have the placename embedded (or translate them as - if you wish to show the file as fully translated. The second option is to translate all messages in full - this is likely to be required in the case of highly-inflected languages like Russian. To choose this option, set the translation of this message to 0, and translate all the messages.", "0");
 	if (sw == "1")
 	{
--- trunk/KDE/kdeedu/kgeography/src/map.cpp #617339:617340
@@ -1,6 +1,6 @@
 /***************************************************************************
- *   Copyright (C) 2004 by Albert Astals Cid                               *
- *   tsdgeos@terra.es                                                      *
+ *   Copyright (C) 2004-2006 by Albert Astals Cid                          *
+ *   aacid@kde.org                                                         *
  *                                                                         *
  *   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  *
@@ -59,6 +59,11 @@
 	p_name = s;
 }
 
+void KGmap::setDivisionsString(const QString &s)
+{
+	p_divisionsString = s;
+}
+
 uint KGmap::count(bool clickDivisionMode) const
 {
 	uint count = 0;
@@ -105,6 +110,12 @@
 	return p_name;
 }
 
+QString KGmap::getDivisionsString() const
+{
+	if (p_divisionsString.isNull()) return i18n("Regions");
+	else return p_divisionsString;
+}
+
 QString KGmap::getRandomDivision(bool clickDivisionMode) const
 {
 	QList<division*> aux;
--- trunk/KDE/kdeedu/kgeography/src/map.h #617339:617340
@@ -1,6 +1,6 @@
 /***************************************************************************
- *   Copyright (C) 2004 by Albert Astals Cid                               *
- *   tsdgeos@terra.es                                                      *
+ *   Copyright (C) 2004-2006 by Albert Astals Cid                          *
+ *   aacid@kde.org                                                         *
  *                                                                         *
  *   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  *
@@ -27,6 +27,7 @@
 		void setFile(const QString &s);
 		bool setMapFile(const QString &s);
 		void setName(const QString &s);
+		void setDivisionsString(const QString &s);
 		
 		// return the number of askable divisions
 		uint count(bool clickDivisionMode) const;
@@ -37,6 +38,7 @@
 		QString getFileName() const;
 		QString getMapFile() const;
 		QString getName() const;
+		QString getDivisionsString() const;
 		QString getRandomDivision(bool clickDivisionMode) const;
 		QString getWhatIs(QRgb c, bool all) const;
 		QColor getColor(const QString &s) const;
@@ -49,6 +51,7 @@
 		QList<division*> p_divisions;
 		
 		QString p_name, p_file, p_mapFile;
+		QString p_divisionsString;
 		bool p_hasAllFlags;
 };
 
--- trunk/KDE/kdeedu/kgeography/src/mapparser.cpp #617339:617340
@@ -47,6 +47,14 @@
 					p_error = i18n("The map image file for %1 does not exist", kgmap -> getName());
 				}
 				
+				// Divisions string
+				QString divisionsString = getElementString("divisionsName", root, Optional);
+				if (!divisionsString.isNull())
+				{
+					qDebug("WUUUUUU");
+					kgmap -> setDivisionsString( divisionsString );
+				}
+				
 				QDomElement divisionTag = root.firstChildElement("division");
 				while (!divisionTag.isNull())
 				{
Comment 3 Albert Astals Cid 2006-12-28 21:23:41 UTC
*** Bug 132495 has been marked as a duplicate of this bug. ***