[PC-BSD Commits] r19159 - pcbsd/current/src-qt4/pc-mounttray

svn at pcbsd.org svn at pcbsd.org
Thu Sep 13 12:49:11 PDT 2012


Author: kenmoore
Date: 2012-09-13 19:49:10 +0000 (Thu, 13 Sep 2012)
New Revision: 19159

Modified:
   pcbsd/current/src-qt4/pc-mounttray/mountTray.cpp
Log:
Fix up the string translation methodology for pc-mounttray. Have the translatable strings be in the format: QString(tr(%1 something)).arg(this is)



Modified: pcbsd/current/src-qt4/pc-mounttray/mountTray.cpp
===================================================================
--- pcbsd/current/src-qt4/pc-mounttray/mountTray.cpp	2012-09-13 17:49:23 UTC (rev 19158)
+++ pcbsd/current/src-qt4/pc-mounttray/mountTray.cpp	2012-09-13 19:49:10 UTC (rev 19159)
@@ -64,11 +64,11 @@
     
   }else if(ident==2){
     //Device mounted
-    trayIcon->showMessage( tr("Device Mounted"), tr("Device")+" \""+device->text()+"\" "+tr("has been mounted at")+" "+MOUNTDIR+device->text(), QSystemTrayIcon::NoIcon,3000 );
+    trayIcon->showMessage( tr("Device Mounted"), QString(tr("Device %1 has been mounted at %2")).arg(device->text()).arg(MOUNTDIR+device->text()), QSystemTrayIcon::NoIcon,3000 );
     
   }else if(ident==3){
     //Device unmounted
-    trayIcon->showMessage( tr("Device Unmounted"), tr("Device")+" \""+device->text()+"\" "+tr("may now be safely removed"), QSystemTrayIcon::NoIcon,3000 );
+    trayIcon->showMessage( tr("Device Unmounted"), QString(tr("Device %1 may now be safely removed")).arg(device->text()), QSystemTrayIcon::NoIcon,3000 );
     
   }else if(ident==4){
     //Device disconnected
@@ -231,7 +231,7 @@
   }else if(act==1){
     //Device connected (add new device entry)
     if( findDeviceInList(device) == -1 ){
-      device->setToolTip(device->whatsThis()+" "+tr("unmounted")+" - "+tr("May be removed"));
+      device->setToolTip( QString(tr("%1 unmounted - may be removed")).arg(device->whatsThis()) );
       devList << device;
       numAvail++;
       status = TRUE;
@@ -240,7 +240,7 @@
   }else if(act==2){
     //Mount device
     if( mountDevice(device) ){
-      device->setToolTip( device->whatsThis()+" "+tr("mounted")+" - "+MOUNTDIR+device->text().replace(" ","-") );
+      device->setToolTip( QString(tr("%1 mounted at %2")).arg(device->whatsThis()).arg(MOUNTDIR+device->text().replace(" ","-")) );
       numMount++;
       status = TRUE;
     }
@@ -248,7 +248,7 @@
   }else if(act==3){
     //Unmount device
     if( unmountDevice(device) ){
-      device->setToolTip(device->whatsThis()+" "+tr("unmounted")+" - "+tr("May be removed"));
+      device->setToolTip( QString(tr("%1 unmounted - may be removed")).arg(device->whatsThis()) );
       numMount--;
       status = TRUE;
     } 
@@ -265,7 +265,7 @@
   }else if(act==5){
     //Mount device silently
     if( mountDevice(device,FALSE) ){
-      device->setToolTip( device->whatsThis()+" "+tr("mounted")+" - "+MOUNTDIR+device->text().replace(" ","-") );
+      device->setToolTip( QString(tr("%1 mounted at %2")).arg(device->whatsThis()).arg(MOUNTDIR+device->text().replace(" ","-")) );
       numMount++;
       status = TRUE;
     }
@@ -467,7 +467,7 @@
     updateDeviceList(1, newdevice);
     if(isMounted(newdevice)){ 
       numMount++; 
-      newdevice->setToolTip( tr("Mounted")+" - "+MOUNTDIR+newdevice->text().replace(" ","-") );
+      newdevice->setToolTip( QString(tr("%1 Mounted")).arg(MOUNTDIR+newdevice->text().replace(" ","-")) );
     }else{
       newdevice->setToolTip(tr("Unmounted - May be removed"));
     }
@@ -764,9 +764,9 @@
   QAction* mount = new QAction(this);
   mount->setWhatsThis(dev);
   if( isMounted(device) ){
-    mount->setText( tr("Unmount")+" "+dev );
+    mount->setText( QString(tr("Unmount %1")).arg(dev) );
   }else{
-    mount->setText( tr("Mount")+" "+dev );
+    mount->setText( QString(tr("Mount %1")).arg(dev) );
   }
   submenu->addAction(mount);
   // - device automount



More information about the Commits mailing list