[Kstars-devel] [kstars] /: Fixing i18n use in qDebug macros. Debug messages are not supposed to be translatable. Please bear that in mind next time you add any debug messages.

Jasem Mutlaq mutlaqja at ikarustech.com
Wed May 4 20:39:40 UTC 2016


Git commit 54e889025260a2494cfdf9f2f0aa95624c104b3e by Jasem Mutlaq.
Committed on 04/05/2016 at 20:37.
Pushed by mutlaqja into branch 'master'.

Fixing i18n use in qDebug macros. Debug messages are not supposed to be translatable. Please bear that in mind next time you add any debug messages.

CCMAIL:kstars-devel at kde.org
BUGS:361892

M  +2    -2    datahandlers/catalogdb.cpp
M  +1    -1    kstars/auxiliary/colorscheme.cpp
M  +1    -1    kstars/auxiliary/fov.cpp
M  +1    -1    kstars/auxiliary/imageexporter.cpp
M  +1    -1    kstars/kstarsactions.cpp
M  +8    -6    kstars/kstarsdata.cpp
M  +3    -5    kstars/kstarsdbus.cpp
M  +5    -3    kstars/main.cpp
M  +2    -2    kstars/printing/foveditordialog.cpp
M  +1    -1    kstars/skyobjects/ksplanet.cpp
M  +1    -1    kstars/skyobjects/ksplanetbase.cpp
M  +2    -2    kstars/skyobjects/skyline.cpp
M  +1    -1    kstars/skyobjects/skyobject.cpp
M  +5    -5    kstars/time/simclock.cpp
M  +6    -6    kstars/time/timezonerule.cpp
M  +4    -4    kstars/tools/modcalcsidtime.cpp
M  +1    -1    kstars/tools/modcalcvlsr.cpp
M  +1    -1    kstars/tools/observinglist.cpp
M  +1    -1    kstars/widgets/timespinbox.cpp

http://commits.kde.org/kstars/54e889025260a2494cfdf9f2f0aa95624c104b3e

diff --git a/datahandlers/catalogdb.cpp b/datahandlers/catalogdb.cpp
index 809d521..9f70be3 100644
--- a/datahandlers/catalogdb.cpp
+++ b/datahandlers/catalogdb.cpp
@@ -29,7 +29,7 @@ bool CatalogDB::Initialize() {
   bool first_run = false;
   if (!testdb.exists())
   {
-      qDebug()<< i18n("DSO DB does not exist!");
+      qDebug() << "DSO DB does not exist!";
       first_run = true;
   }
   skydb_.setDatabaseName(dbfile);
@@ -37,7 +37,7 @@ bool CatalogDB::Initialize() {
           qWarning() << i18n("Unable to open DSO database file!");
           qWarning() << LastError();
   } else {
-      qDebug() << i18n("Opened the DSO Database. Ready!");
+      qDebug() << "Opened the DSO Database. Ready!";
       if (first_run == true) {
           FirstRun();
       }
diff --git a/kstars/auxiliary/colorscheme.cpp b/kstars/auxiliary/colorscheme.cpp
index 6e54459..7bebe45 100644
--- a/kstars/auxiliary/colorscheme.cpp
+++ b/kstars/auxiliary/colorscheme.cpp
@@ -160,7 +160,7 @@ bool ColorScheme::load( const QString &name ) {
         }
 
         if ( ! ok ) {
-            qDebug() << i18n( "Unable to load color scheme named %1. Also tried %2.", name, filename );
+            qDebug() << QString("Unable to load color scheme named %1. Also tried %2.").arg(name).arg(filename);
             return false;
         }
     }
diff --git a/kstars/auxiliary/fov.cpp b/kstars/auxiliary/fov.cpp
index 43a6711..551a86e 100644
--- a/kstars/auxiliary/fov.cpp
+++ b/kstars/auxiliary/fov.cpp
@@ -190,7 +190,7 @@ void FOV::writeFOVs(const QList<FOV*> fovs)
     f.setFileName( QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QLatin1Char('/') + "fov.dat" ) ;
 
     if ( ! f.open( QIODevice::WriteOnly ) ) {
-        qDebug() << i18n( "Could not open fov.dat." );
+        qDebug() << "Could not open fov.dat.";
         return;
     }
     QTextStream ostream(&f);
diff --git a/kstars/auxiliary/imageexporter.cpp b/kstars/auxiliary/imageexporter.cpp
index 6e92185..7af38e1 100644
--- a/kstars/auxiliary/imageexporter.cpp
+++ b/kstars/auxiliary/imageexporter.cpp
@@ -159,7 +159,7 @@ bool ImageExporter::exportRasterGraphics(const QString &fileName)
 
     else
     {
-        qDebug() << i18n("Image saved to file: %1", fileName);
+        qDebug() << "Image saved to file: " << fileName;
         return true;
     }
 }
diff --git a/kstars/kstarsactions.cpp b/kstars/kstarsactions.cpp
index c7fb7b7..b3d02a8 100644
--- a/kstars/kstarsactions.cpp
+++ b/kstars/kstarsactions.cpp
@@ -1215,7 +1215,7 @@ void KStars::slotMapProjection() {
         Options::setProjection( SkyMap::Gnomonic );
 
     //DEBUG
-    qDebug() << i18n( "Projection system: %1", Options::projection() );
+    qDebug() << "Projection system: " << Options::projection();
 
     m_SkyMap->forceUpdate();
 }
diff --git a/kstars/kstarsdata.cpp b/kstars/kstarsdata.cpp
index 9994695..199fdd6 100644
--- a/kstars/kstarsdata.cpp
+++ b/kstars/kstarsdata.cpp
@@ -528,9 +528,10 @@ bool KStarsData::openUrlFile(const QString &urlfile, QFile & file) {
             if ( file.open( QIODevice::ReadOnly ) ) fileFound = true;
 
         } else {
-            if ( KSUtils::openDataFile( file, urlfile ) ) {
-                //if ( locale->language() != "en_US" ) qDebug() << i18n( "No localized URL file; using default English file." );
-                if ( QLocale().language() != QLocale::English ) qDebug() << i18n( "No localized URL file; using default English file." );
+            if ( KSUtils::openDataFile( file, urlfile ) )
+            {
+                if ( QLocale().language() != QLocale::English )
+                    qDebug() << "No localized URL file; using default English file.";
                 // we found urlfile, we need to copy it to locale
                 localeFile.setFileName( QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QLatin1Char('/') + urlfile ) ;
                 if (localeFile.open(QIODevice::WriteOnly)) {
@@ -545,7 +546,7 @@ bool KStarsData::openUrlFile(const QString &urlfile, QFile & file) {
                     localeFile.close();
                     file.reset();
                 } else {
-                    qDebug() << i18n( "Failed to copy default URL file to locale folder, modifying default object links is not possible" );
+                    qDebug() << "Failed to copy default URL file to locale folder, modifying default object links is not possible";
                 }
                 fileFound = true;
             }
@@ -712,7 +713,7 @@ bool KStarsData::executeScript( const QString &scriptname, SkyMap *map ) {
 
     QFile f( scriptname );
     if ( !f.open( QIODevice::ReadOnly) ) {
-        qDebug() << i18n( "Could not open file %1", f.fileName() );
+        qDebug() << "Could not open file " << f.fileName();
         return false;
     }
 
@@ -838,7 +839,8 @@ bool KStarsData::executeScript( const QString &scriptname, SkyMap *map ) {
                         ok = colorScheme()->load( filename );
                     }
             
-                    if ( ! ok ) qDebug() << i18n( "Unable to load color scheme named %1. Also tried %2.", csName, filename ) << endl;
+                    if ( ! ok )
+                        qDebug() << QString("Unable to load color scheme named %1. Also tried %2.").arg(csName).arg(filename);
                 }
 
             } else if ( fn[0] == "zoom" && fn.size() == 2 ) {
diff --git a/kstars/kstarsdbus.cpp b/kstars/kstarsdbus.cpp
index 358efbf..8e4a6e2 100644
--- a/kstars/kstarsdbus.cpp
+++ b/kstars/kstarsdbus.cpp
@@ -171,7 +171,7 @@ void KStars::waitForKey( const QString &k ) {
         while ( !data()->resumeKey.isEmpty() )
             qApp->processEvents();
     } else {
-        qDebug() << i18n( "Error [D-Bus waitForKey()]: Invalid key requested." );
+        qDebug() << "Error [D-Bus waitForKey()]: Invalid key requested.";
     }
 }
 
@@ -228,11 +228,9 @@ void KStars::setGeoLocation( const QString &city, const QString &province, const
 
     if ( !cityFound ) {
         if ( province.isEmpty() )
-            qDebug() << i18n( "Error [D-Bus setGeoLocation]: city %1, %2 not found in database.",
-                              city, country );
+            qDebug() << QString("Error [D-Bus setGeoLocation]: city %1, %2 not found in database.").arg(city).arg(country);
         else
-            qDebug() << i18n( "Error [D-Bus setGeoLocation]: city %1, %2, %3 not found in database.",
-                              city, province, country );
+            qDebug() << QString("Error [D-Bus setGeoLocation]: city %1, %2, %3 not found in database.").arg(city).arg(province).arg(country);
     }
 }
 
diff --git a/kstars/main.cpp b/kstars/main.cpp
index 3ef3f14..1f92432 100644
--- a/kstars/main.cpp
+++ b/kstars/main.cpp
@@ -109,7 +109,7 @@ int main(int argc, char *argv[])
 
     if ( parser.isSet( "dump" ) )
     {
-        qDebug() << i18n( "Dumping sky image" );
+        qDebug() << "Dumping sky image";
 
         //parse filename and image format
         const char* format = "PNG";
@@ -200,8 +200,10 @@ int main(int argc, char *argv[])
         map->exportSkyImage( &sky );
         qApp->processEvents();
 
-        if ( ! sky.save( fname, format ) ) qWarning() << i18n( "Unable to save image: %1 ", fname ) ;
-        else qDebug() << i18n( "Saved to file: %1", fname );
+        if ( ! sky.save( fname, format ) )
+            qWarning() << "Unable to save image: " << fname;
+        else
+            qDebug() << "Saved to file: %1" << fname;
 
         delete map;
         delete dat;
diff --git a/kstars/printing/foveditordialog.cpp b/kstars/printing/foveditordialog.cpp
index fb047ae..8985b98 100644
--- a/kstars/printing/foveditordialog.cpp
+++ b/kstars/printing/foveditordialog.cpp
@@ -166,12 +166,12 @@ void FovEditorDialog::slotSaveImage()
 
         if(!m_ParentWizard->getFovSnapshotList()->at(m_CurrentIndex)->getPixmap().save(fname, format))
         {
-            qDebug() << i18n("Error: Unable to save image: %1 ", fname);
+            qDebug() << "Error: Unable to save image: " << fname;
         }
 
         else
         {
-            qDebug() << i18n("Image saved to file: %1", fname);
+            qDebug() << "Image saved to file: " << fname;
         }
     }
 
diff --git a/kstars/skyobjects/ksplanet.cpp b/kstars/skyobjects/ksplanet.cpp
index 624480f..c5bf88f 100644
--- a/kstars/skyobjects/ksplanet.cpp
+++ b/kstars/skyobjects/ksplanet.cpp
@@ -144,7 +144,7 @@ KSPlanet::KSPlanet( int n )
             KSPlanetBase::init( i18n("Neptune"), "neptune", KSPlanetBase::planetColor[KSPlanetBase::NEPTUNE], 49572. );
             break;
         default:
-            qDebug() << i18n("Error: Illegal identifier in KSPlanet constructor: %1", n) << endl;
+            qDebug() << "Error: Illegal identifier in KSPlanet constructor: " << n;
             break;
     }
 }
diff --git a/kstars/skyobjects/ksplanetbase.cpp b/kstars/skyobjects/ksplanetbase.cpp
index 2f8d7a6..0fc5a4b 100644
--- a/kstars/skyobjects/ksplanetbase.cpp
+++ b/kstars/skyobjects/ksplanetbase.cpp
@@ -215,7 +215,7 @@ void KSPlanetBase::setRearth( const KSPlanetBase *Earth ) {
     }
 
     if ( ! Earth  ) {
-        qDebug() << i18n( "KSPlanetBase::setRearth():  Error: Need an Earth pointer.  (" ) << name() << ")";
+        qDebug() << "KSPlanetBase::setRearth():  Error: Need an Earth pointer.  (" << name() << ")";
         Rearth = 1.0;
         return;
     }
diff --git a/kstars/skyobjects/skyline.cpp b/kstars/skyobjects/skyline.cpp
index ba6280d..62f311f 100644
--- a/kstars/skyobjects/skyline.cpp
+++ b/kstars/skyobjects/skyline.cpp
@@ -37,7 +37,7 @@ void SkyLine::append( SkyPoint *p ) {
 
 void SkyLine::setPoint( int i, SkyPoint *p ) {
     if ( i < 0 || i >= m_pList.size() ) {
-        qDebug() << i18n("SkyLine index error: no such point: %1", i );
+        qDebug() << "SkyLine index error: no such point: " << i;
         return;
     }
     *m_pList[i] = *p;
@@ -45,7 +45,7 @@ void SkyLine::setPoint( int i, SkyPoint *p ) {
 
 dms SkyLine::angularSize( int i ) const{
     if ( i < 0 || i+1 >= m_pList.size() ) {
-        qDebug() << i18n("SkyLine index error: no such segment: %1", i );
+        qDebug() << "SkyLine index error: no such segment: " << i;
         return dms();
     }
 
diff --git a/kstars/skyobjects/skyobject.cpp b/kstars/skyobjects/skyobject.cpp
index 84c3d97..0d4fbd5 100644
--- a/kstars/skyobjects/skyobject.cpp
+++ b/kstars/skyobjects/skyobject.cpp
@@ -463,7 +463,7 @@ void SkyObject::saveUserLog( const QString &newLog ) {
 
     //Open file for writing
     if ( !file.open( QIODevice::WriteOnly ) ) {
-        qDebug() << i18n( "Cannot write to user log file" );
+        qDebug() << "Cannot write to user log file";
         return;
     }
 
diff --git a/kstars/time/simclock.cpp b/kstars/time/simclock.cpp
index 91849d0..3536d36 100644
--- a/kstars/time/simclock.cpp
+++ b/kstars/time/simclock.cpp
@@ -107,7 +107,7 @@ void SimClock::stop() {
     }
 
     if (!ManualMode && tmr.isActive()) {
-        qDebug() << i18n( "Stopping the timer" );
+        qDebug() << "Stopping the timer";
         tmr.stop();
         emit clockToggled(true);
     }
@@ -123,7 +123,7 @@ void SimClock::start() {
         //emit timeChanged() in order to restart calls to updateTime()
         emit timeChanged();
     } else if ( !ManualMode && !tmr.isActive()) {
-        qDebug() << i18n( "Starting the timer" );
+        qDebug() << "Starting the timer";
         sysmark.start();
         julianmark = UTC.djd();
         lastelapsed = 0;
@@ -145,16 +145,16 @@ void SimClock::setUTC(const KStarsDateTime &newtime) {
             lastelapsed = 0;
         }
 
-        qDebug() << i18n( "Setting clock:  UTC: %1  JD: %2" ,  UTC.toString(), QLocale().toString( (double) UTC.djd(), 'f' , 2 ) ) << endl;
+        qDebug() << QString("Setting clock:  UTC: %1  JD: %2").arg(UTC.toString()).arg(QLocale().toString( (double) UTC.djd(), 'f' , 2 ) );
         emit timeChanged();
     } else {
-        qDebug() << i18n( "Cannot set SimClock:  Invalid Date/Time." );
+        qDebug() << "Cannot set SimClock:  Invalid Date/Time.";
     }
 }
 
 void SimClock::setClockScale(float s) {
     if (Scale != s ) {
-        qDebug() << i18n( "New clock scale: %1 sec", s );
+        qDebug() << "New clock scale: " << s << " sec";
         Scale = s;
         if (tmr.isActive()) {
             julianmark = UTC.djd();
diff --git a/kstars/time/timezonerule.cpp b/kstars/time/timezonerule.cpp
index 978d632..a4dee32 100644
--- a/kstars/time/timezonerule.cpp
+++ b/kstars/time/timezonerule.cpp
@@ -62,10 +62,10 @@ void TimeZoneRule::setEmpty() {
 
 void TimeZoneRule::setDST( bool activate ) {
     if ( activate ) {
-        qDebug() << i18n( "Daylight Saving Time active" );
+        qDebug() << "Daylight Saving Time active";
         dTZ = HourOffset;
     } else {
-        qDebug() << i18n( "Daylight Saving Time inactive" );
+        qDebug() << "Daylight Saving Time inactive";
         dTZ = 0.0;
     }
 }
@@ -238,7 +238,7 @@ void TimeZoneRule::nextDSTChange_LTime( const KStarsDateTime &date ) {
         result = KStarsDateTime( QDate( y, StartMonth, findStartDay( result ) ), StartTime );
     }
 
-    qDebug() << i18n( "Next Daylight Savings Time change (Local Time): " ) << result.toString();
+    qDebug() << "Next Daylight Savings Time change (Local Time): " << result.toString();
     next_change_ltime = result;
 }
 
@@ -272,7 +272,7 @@ void TimeZoneRule::previousDSTChange_LTime( const KStarsDateTime &date ) {
         result = KStarsDateTime( QDate( y, RevertMonth, findRevertDay( result ) ), RevertTime );
     }
 
-    qDebug() << i18n( "Previous Daylight Savings Time change (Local Time): " ) << result.toString();
+    qDebug() << "Previous Daylight Savings Time change (Local Time): " << result.toString();
     next_change_ltime = result;
 }
 
@@ -281,7 +281,7 @@ void TimeZoneRule::nextDSTChange( const KStarsDateTime &local_date, const double
     // just decrement timezone offset and hour offset
     KStarsDateTime result = local_date.addSecs( int( (TZoffset + deltaTZ()) * -3600) );
 
-    qDebug() << i18n( "Next Daylight Savings Time change (UTC): " ) << result.toString();
+    qDebug() << "Next Daylight Savings Time change (UTC): " << result.toString();
     next_change_utc = result;
 }
 
@@ -294,7 +294,7 @@ void TimeZoneRule::previousDSTChange( const KStarsDateTime &local_date, const do
     if ( result.date().month() == RevertMonth )
         result = result.addSecs( int(HourOffset * -3600) );
 
-    qDebug() << i18n( "Previous Daylight Savings Time change (UTC): " ) << result.toString();
+    qDebug() << "Previous Daylight Savings Time change (UTC): " << result.toString();
     next_change_utc = result;
 }
 
diff --git a/kstars/tools/modcalcsidtime.cpp b/kstars/tools/modcalcsidtime.cpp
index d5cb0a2..55e5218 100644
--- a/kstars/tools/modcalcsidtime.cpp
+++ b/kstars/tools/modcalcsidtime.cpp
@@ -255,13 +255,13 @@ void modCalcSidTime::processLines( QTextStream &istream ) {
                 if ( locationFields.size() == 1 ) locationFields.insert( 1, "" );
                 if ( locationFields.size() == 2 ) locationFields.insert( 1, "" );
                 if ( locationFields.size() != 3 ) {
-                    qDebug() << i18n("Error: could not parse location string: ") << locationString;
+                    qDebug() << "Error: could not parse location string: " << locationString;
                     continue;
                 }
 
                 geoBatch = KStarsData::Instance()->locationNamed( locationFields[0], locationFields[1], locationFields[2] );
                 if ( ! geoBatch ) {
-                    qDebug() << i18n("Error: location not found in database: ") << locationString;
+                    qDebug() << "Error: location not found in database: " << locationString;
                     continue;
                 }
             }
@@ -274,7 +274,7 @@ void modCalcSidTime::processLines( QTextStream &istream ) {
                 if ( dt.isValid() ) break;
             }
             if ( ! dt.isValid() ) {
-                qDebug() << i18n("Error: did not find a valid date string in: ") << line;
+                qDebug() << "Error: did not find a valid date string in: " << line;
                 continue;
             }
         }
@@ -287,7 +287,7 @@ void modCalcSidTime::processLines( QTextStream &istream ) {
             }
         }
         if ( ! inTime.isValid() ) {
-            qDebug() << i18n("Error: did not find a valid time string in: ") << line;
+            qDebug() << "Error: did not find a valid time string in: " << line;
             continue;
         }
 
diff --git a/kstars/tools/modcalcvlsr.cpp b/kstars/tools/modcalcvlsr.cpp
index 471b867..18350a0 100644
--- a/kstars/tools/modcalcvlsr.cpp
+++ b/kstars/tools/modcalcvlsr.cpp
@@ -171,7 +171,7 @@ void modCalcVlsr::slotCompute()
         }
 
     default: //oops
-        qDebug() << i18n("Error: do not know which velocity to use for input.");
+        qDebug() << "Error: do not know which velocity to use for input.";
         break;
     }
 }
diff --git a/kstars/tools/observinglist.cpp b/kstars/tools/observinglist.cpp
index 453e5b9..bae5f54 100644
--- a/kstars/tools/observinglist.cpp
+++ b/kstars/tools/observinglist.cpp
@@ -531,7 +531,7 @@ void ObservingList::slotNewSelection() {
             else
                 ui->dssMetadataLabel->setText( i18n( "No image available. Click on the placeholder image to download one." ) );
         } else {
-            qDebug() << i18n( "Object %1 not found in list.", newName );
+            qDebug() << "Object " << newName << " not found in list.";
         }
     } else {
         if ( selectedItems.size() == 0 ) {//Nothing selected
diff --git a/kstars/widgets/timespinbox.cpp b/kstars/widgets/timespinbox.cpp
index 51735f2..7564068 100644
--- a/kstars/widgets/timespinbox.cpp
+++ b/kstars/widgets/timespinbox.cpp
@@ -217,7 +217,7 @@ float TimeSpinBox::timeScale( void ) const {
 }
 
 void TimeSpinBox::reportChange() {
-    qDebug() << i18n( "Reporting new timestep value: " ) << timeScale();
+    qDebug() << "Reporting new timestep value: " << timeScale();
     emit scaleChanged( timeScale() );
 }
 


More information about the Kstars-devel mailing list