clear and add "tr"
authorJakub Jaszczynski <j.j.jaszczynski@gmail.com>
Mon, 30 Aug 2010 13:41:17 +0000 (15:41 +0200)
committerJakub Jaszczynski <j.j.jaszczynski@gmail.com>
Mon, 30 Aug 2010 13:41:17 +0000 (15:41 +0200)
trunk/src/plugins/google/src/GooglePlugin.cpp
trunk/src/plugins/google/src/GoogleSettingsDialog.cpp
trunk/src/plugins/xdxf/src/xdxfplugin.cpp

index d05b1cc..ff2228b 100644 (file)
@@ -28,7 +28,7 @@
 #include "GoogleDictDialog.h"
 
 GooglePlugin::GooglePlugin(QObject *parent): CommonDictInterface(parent),
-                    _name(tr("")),_infoNote(tr("")) {
+                    _name(""),_infoNote("") {
     _settings = new Settings();
     _settings->setValue("lang_to","");
     _settings->setValue("lang_from","");
index 80b2d53..640937d 100644 (file)
@@ -55,8 +55,8 @@ GoogleSettingsDialog::GoogleSettingsDialog(QWidget *parent,
                 QIcon::fromTheme("object-flip-vertical"),tr(""));
     #endif
 
-    langFromLabel = new QLabel("From:");
-    langToLabel = new QLabel(" To: ");
+    langFromLabel = new QLabel(tr("From:"));
+    langToLabel = new QLabel(tr(" To: "));
     connectInfoLabel = new QLabel(tr("Google plugin make use of internet "
                                      "conection, so it may cost You."));
 
index a59363b..d814594 100644 (file)
@@ -93,9 +93,9 @@ QList<Translation*> XdxfPlugin::searchWordListCache(QString word, int limit) {
     db.setDatabaseName(cacheFilePath);
     if(!db.open()) {
         qDebug() << "Database error" << db.lastError().text() << endl;
-        Q_EMIT notify(Notify::Warning, QString("Cache database cannot be "
+        Q_EMIT notify(Notify::Warning, QString(tr("Cache database cannot be "
                 "opened for %1 dictionary. Searching in xdxf file. "
-                "You may want to recache.").arg(name()));
+                "You may want to recache.").arg(name())));
         return searchWordListFile(word, limit);
     }
 
@@ -149,7 +149,7 @@ QList<Translation*> XdxfPlugin::searchWordListFile(QString word, int limit) {
     if(!dictionaryFile.open(QFile::ReadOnly | QFile::Text)) {
         qDebug()<<"Error: could not open file";
         Q_EMIT notify(Notify::Warning,
-                QString("Xdxf file cannot be read for %1").arg(name()));
+                QString(tr("Xdxf file cannot be read for %1").arg(name())));
         return translations.toList();
     }
 
@@ -203,9 +203,9 @@ QString XdxfPlugin::searchCache(QString key) {
 
     if(!db.open()) {
         qDebug() << "Database error" << db.lastError().text() << endl;
-        Q_EMIT notify(Notify::Warning, QString("Cache database cannot be "
+        Q_EMIT notify(Notify::Warning, QString(tr("Cache database cannot be "
                 "opened for %1 dictionary. Searching in xdxf file. "
-                "You may want to recache.").arg(name()));
+                "You may want to recache.").arg(name())));
         return searchFile(key);
     }
 
@@ -228,7 +228,7 @@ QString XdxfPlugin::searchFile(QString key) {
     QString resultString("");
     if(!dictionaryFile.open(QFile::ReadOnly | QFile::Text)) {
         Q_EMIT notify(Notify::Warning,
-                QString("Xdxf file cannot be read for %1").arg(name()));
+                QString(tr("Xdxf file cannot be read for %1").arg(name())));
         qDebug()<<"Error: could not open file";
         return "";
     }
@@ -251,15 +251,15 @@ QString XdxfPlugin::searchFile(QString key) {
             while(reader.name()!="ar" && !reader.atEnd()) {
                 if(reader.name()!="" && reader.name()!="k") {
                     if(reader.tokenType()==QXmlStreamReader::EndElement)
-                        temp+=tr("</");
+                        temp+="</";
                     if(reader.tokenType()==QXmlStreamReader::StartElement)
-                        temp+=tr("<");
+                        temp+="<";
                     temp+=reader.name().toString();
                     if(reader.name().toString()=="c" &&
                             reader.tokenType()==QXmlStreamReader::StartElement)
-                       temp= temp + tr(" c=\"") + reader.attributes().
-                               value(tr("c")).toString() + tr("\"");
-                    temp+=tr(">");
+                       temp= temp + " c=\"" + reader.attributes().
+                               value("c").toString() + "\"";
+                    temp+=">";
                 }
                 temp+= reader.text().toString().replace("<","&lt;").
                         replace(">","&gt;");
@@ -267,8 +267,8 @@ QString XdxfPlugin::searchFile(QString key) {
             }
             if(temp.at(0)==QChar('\n'))
                 temp.remove(0,1);
-            resultString+=tr("<key>") + a +tr("</key>");
-            resultString+=tr("<t>") + temp + tr("</t>");
+            resultString+="<key>" + a +"</key>";
+            resultString+="<t>" + temp + "</t>";
             match=false;
         }
         this->thread()->yieldCurrentThread();
@@ -383,7 +383,7 @@ void XdxfPlugin::getDictionaryInfo() {
     QFile dictionaryFile(path);
     if(!dictionaryFile.open(QFile::ReadOnly | QFile::Text)) {
        Q_EMIT notify(Notify::Warning,
-               QString("Xdxf file cannot be read dictionary"));
+               QString(tr("Xdxf file cannot be read dictionary")));
         qDebug()<<"Error: could not open file";
         return;
     }
@@ -404,7 +404,7 @@ void XdxfPlugin::getDictionaryInfo() {
         _infoNote=reader.readElementText();
 
     QString format = "png";
-    QString initialPath = QDir::currentPath() + tr("/xdxf.") + format;
+    QString initialPath = QDir::currentPath() + "/xdxf." + format;
 
     _infoNote="path=\""+initialPath+"\"> \n" + _name + " [" + _langFrom + "-" + _langTo + "] (" + _type + ")";
     dictionaryFile.close();
@@ -423,8 +423,8 @@ int XdxfPlugin::countWords() {
     QFile dictionaryFile(path);
     if(!dictionaryFile.open(QFile::ReadOnly | QFile::Text)) {
         Q_EMIT notify(Notify::Warning,
-                QString("Xdxf file cannot be read for %1 dictionary")
-                .arg(name()));
+                QString(tr("Xdxf file cannot be read for %1 dictionary")
+                .arg(name())));
         qDebug()<<"Error: could not open file";
         return -1;
     }
@@ -459,8 +459,8 @@ bool XdxfPlugin::makeCache(QString) {
     if (!dictionaryFile.open(QFile::ReadOnly | QFile::Text)) {
         Q_EMIT updateCachingProgress(100, 0);
         Q_EMIT notify(Notify::Warning,
-                QString("Xdxf file cannot be read for %1 dictionary")
-                .arg(name()));
+                QString(tr("Xdxf file cannot be read for %1 dictionary")
+                .arg(name())));
         return 0;
     }
     QXmlStreamReader reader(&dictionaryFile);
@@ -470,9 +470,9 @@ bool XdxfPlugin::makeCache(QString) {
     if(!db.open()) {
         qDebug() << "Database error" << db.lastError().text() << endl;
         Q_EMIT updateCachingProgress(100, 0);
-        Q_EMIT notify(Notify::Warning, QString("Cache database cannot be "
+        Q_EMIT notify(Notify::Warning, QString(tr("Cache database cannot be "
                 "opened for %1 dictionary. Searching in xdxf file. "
-                "You may want to recache.").arg(name()));
+                "You may want to recache.").arg(name())));
         return false;
     }
     QCoreApplication::processEvents();
@@ -480,7 +480,7 @@ bool XdxfPlugin::makeCache(QString) {
     cur.exec("PRAGMA synchronous = 0");
     cur.exec("drop table dict");
     QCoreApplication::processEvents();
-    cur.exec("create table dict(word text, normalized text ,translation text)");
+    cur.exec("create table dict(word text, normalized text ,tanslation text)");
     int counter = 0;
     cur.exec("BEGIN;");
 
@@ -513,20 +513,20 @@ bool XdxfPlugin::makeCache(QString) {
             while(reader.name()!="ar" && !reader.atEnd()) {
                 if(reader.name()!="" && reader.name()!="k") {
                     if(reader.tokenType()==QXmlStreamReader::EndElement)
-                        temp+=tr("</");
+                        temp+="</";
                     if(reader.tokenType()==QXmlStreamReader::StartElement)
-                        temp+=tr("<");
+                        temp+="<";
                     temp+=reader.name().toString();
                     if(reader.name().toString()=="c" && reader.tokenType()==QXmlStreamReader::StartElement)
-                       temp= temp + tr(" c=\"") + reader.attributes().value(tr("c")).toString() + tr("\"");
-                    temp+=tr(">");
+                       temp= temp + " c=\"" + reader.attributes().value("c").toString() + "\"";
+                    temp+=">";
                 }
                 temp+= reader.text().toString().replace("<","&lt;").replace(">","&gt;");;
                 reader.readNext();
             }
             if(temp.at(0)==QChar('\n'))
                 temp.remove(0,1);
-            temp=tr("<key>") + a + tr("</key>") + tr("<t>") + temp+ tr("</t>");
+            temp="<key>" + a + "</key>" + "<t>" + temp+ "</t>";
             match=false;
             cur.prepare("insert into dict values(?,?,?)");
             cur.addBindValue(a);
@@ -554,7 +554,7 @@ bool XdxfPlugin::makeCache(QString) {
     {
         Q_EMIT updateCachingProgress(100, timer.restart());
         Q_EMIT notify(Notify::Warning,
-                QString("Database caching error, please try againg."));
+                QString(tr("Database caching error, please try againg.")));
         db.close();
         return false;
     }