summaryrefslogtreecommitdiffstats
path: root/kbabel/datatools
diff options
context:
space:
mode:
Diffstat (limited to 'kbabel/datatools')
-rw-r--r--kbabel/datatools/Makefile.am39
-rw-r--r--kbabel/datatools/accelerators/Makefile.am19
-rw-r--r--kbabel/datatools/accelerators/kbabel_accelstool.desktop105
-rw-r--r--kbabel/datatools/accelerators/main.cc137
-rw-r--r--kbabel/datatools/accelerators/main.h56
-rw-r--r--kbabel/datatools/arguments/Makefile.am19
-rw-r--r--kbabel/datatools/arguments/kbabel_argstool.desktop106
-rw-r--r--kbabel/datatools/arguments/main.cc277
-rw-r--r--kbabel/datatools/arguments/main.h55
-rw-r--r--kbabel/datatools/context/Makefile.am19
-rw-r--r--kbabel/datatools/context/kbabel_contexttool.desktop100
-rw-r--r--kbabel/datatools/context/main.cc115
-rw-r--r--kbabel/datatools/context/main.h52
-rw-r--r--kbabel/datatools/equations/Makefile.am19
-rw-r--r--kbabel/datatools/equations/kbabel_equationstool.desktop104
-rw-r--r--kbabel/datatools/equations/main.cc113
-rw-r--r--kbabel/datatools/equations/main.h50
-rw-r--r--kbabel/datatools/length/Makefile.am19
-rw-r--r--kbabel/datatools/length/kbabel_lengthtool.desktop98
-rw-r--r--kbabel/datatools/length/main.cc142
-rw-r--r--kbabel/datatools/length/main.h54
-rw-r--r--kbabel/datatools/length/test.po46
-rw-r--r--kbabel/datatools/not-translated/Makefile.am19
-rw-r--r--kbabel/datatools/not-translated/kbabel_nottranslatedtool.desktop97
-rw-r--r--kbabel/datatools/not-translated/main.cc129
-rw-r--r--kbabel/datatools/not-translated/main.h55
-rw-r--r--kbabel/datatools/not-translated/test.po48
-rw-r--r--kbabel/datatools/pluralforms/Makefile.am19
-rw-r--r--kbabel/datatools/pluralforms/kbabel_pluralformstool.desktop101
-rw-r--r--kbabel/datatools/pluralforms/main.cc129
-rw-r--r--kbabel/datatools/pluralforms/main.h53
-rw-r--r--kbabel/datatools/punctuation/Makefile.am19
-rw-r--r--kbabel/datatools/punctuation/kbabel_punctuationtool.desktop101
-rw-r--r--kbabel/datatools/punctuation/main.cc157
-rw-r--r--kbabel/datatools/punctuation/main.h47
-rw-r--r--kbabel/datatools/regexp/Makefile.am21
-rw-r--r--kbabel/datatools/regexp/kbabel_regexptool.desktop92
-rw-r--r--kbabel/datatools/regexp/main.cc181
-rw-r--r--kbabel/datatools/regexp/main.h73
-rw-r--r--kbabel/datatools/regexp/regexplist.xml303
-rw-r--r--kbabel/datatools/setfuzzy/Makefile.am19
-rw-r--r--kbabel/datatools/setfuzzy/kbabel_setfuzzytool.desktop98
-rw-r--r--kbabel/datatools/setfuzzy/main.cc98
-rw-r--r--kbabel/datatools/setfuzzy/main.h47
-rw-r--r--kbabel/datatools/whitespace/Makefile.am19
-rw-r--r--kbabel/datatools/whitespace/kbabel_whitespacetool.desktop98
-rw-r--r--kbabel/datatools/whitespace/main.cc144
-rw-r--r--kbabel/datatools/whitespace/main.h55
-rw-r--r--kbabel/datatools/whitespace/test.po92
-rw-r--r--kbabel/datatools/xml/Makefile.am19
-rw-r--r--kbabel/datatools/xml/kbabel_xmltool.desktop105
-rw-r--r--kbabel/datatools/xml/main.cc206
-rw-r--r--kbabel/datatools/xml/main.h59
53 files changed, 4447 insertions, 0 deletions
diff --git a/kbabel/datatools/Makefile.am b/kbabel/datatools/Makefile.am
new file mode 100644
index 00000000..07600eac
--- /dev/null
+++ b/kbabel/datatools/Makefile.am
@@ -0,0 +1,39 @@
+## Makefile.am for kbabeldict
+
+# this has all of the subdirectories that make will recurse into. if
+# there are none, comment this out
+SUBDIRS = arguments accelerators context equations pluralforms xml \
+not-translated whitespace length setfuzzy punctuation regexp
+
+#pkgincludedir = $(includedir)/kbabel
+
+# this is the program that gets installed. it's name is used for all
+# of the other Makefile.am variables
+#lib_LTLIBRARIES = libkbabeltools.la
+
+# set the include path for X, qt and KDE
+INCLUDES = $(all_includes)
+
+
+# which sources should be compiled for kbabeldict
+#libkbabeltools_la_SOURCES = toolaction.cpp kactionselector.cpp toolselectionwidget.cpp
+#libkbabeltools_la_LIBADD = $(LIB_KDECORE) $(LIB_KIO)
+#libkbabeltools_la_LDFLAGS = $(all_libraries) -module -version-info 1:0:0 -no-undefined
+
+# these are the headers for your project
+#noinst_HEADERS = kactionselector.h toolselectionwidget.h
+#pkginclude_HEADERS = toolaction.h
+
+# let automoc handle all of the meta source files (moc)
+METASOURCES = AUTO
+
+# KDE_OPTIONS = nofinal
+#rcdir = $(kde_datadir)/kbabel
+#rc_DATA = kbabelui.rc
+
+#api:
+# mkdir -p API && kdoc -d API -u $$PWD/API -p -lkdeui -lkdecore -lqt -ldcop *.h
+
+#distclean-local:
+# rm -r -f API
+
diff --git a/kbabel/datatools/accelerators/Makefile.am b/kbabel/datatools/accelerators/Makefile.am
new file mode 100644
index 00000000..f204e78a
--- /dev/null
+++ b/kbabel/datatools/accelerators/Makefile.am
@@ -0,0 +1,19 @@
+
+INCLUDES = -I$(srcdir)/../../common -I../../common $(all_includes)
+kbabel_accelstool_la_LIBADD = $(LIB_KIO) ../../common/libkbabelcommon.la
+
+####### Files
+
+kde_module_LTLIBRARIES = kbabel_accelstool.la
+
+kbabel_accelstool_la_SOURCES = main.cc
+
+kbabel_accelstool_la_LDFLAGS = $(all_libraries) -avoid-version -module -no-undefined
+
+noinst_HEADERS = main.h
+
+kbabel_accelstool_la_METASOURCES = AUTO
+
+service_DATA = kbabel_accelstool.desktop
+servicedir = $(kde_servicesdir)
+
diff --git a/kbabel/datatools/accelerators/kbabel_accelstool.desktop b/kbabel/datatools/accelerators/kbabel_accelstool.desktop
new file mode 100644
index 00000000..ffe5bb15
--- /dev/null
+++ b/kbabel/datatools/accelerators/kbabel_accelstool.desktop
@@ -0,0 +1,105 @@
+[Desktop Entry]
+Name=Accelerator Validation for KBabel
+Name[bg]=Валидност на ускорител - KBabel
+Name[bs]=Provjera akceleratora za KBabel
+Name[ca]=Validació dels acceleradors per a KBabel
+Name[cs]=Validace akcelerátorů pro KBabel
+Name[cy]=Dilysiad Cyflymydd i KBabel
+Name[da]=Accelerator-validering for KBabel
+Name[de]=Kurzbefehl-Überprüfung für KBabel
+Name[el]=Έλεγχος εγκυρότητας πλήκτρων επιτάχυνσης για το KBabel
+Name[es]=Validación de accesos rápidos para KBabel
+Name[et]=KBabeli kiirklahvide kontrollija
+Name[eu]=Bizkortzaile balidazioa KBabel-entzat
+Name[fa]=اعتبارسنجی شتاب‌ده برای KBabel
+Name[fi]=Pikavalintojen tarkistus KBabelissa
+Name[fr]=Validation des accélérateurs clavier pour KBabel
+Name[ga]=Bailíochtú na nAicearraí le haghaidh KBabel
+Name[gl]=Validación de Aceleradores para KBabel
+Name[hi]=के-बेबल के लिए त्वरक वेलिडेशन
+Name[hu]=Gyorsbillentyű-ellenőrző a KBabelhez
+Name[is]=Flýtilyklastaðfestir fyrir KBabel
+Name[it]=Convalida dei tasti acceleratori per KBabel
+Name[ja]=KBabel アクセラレータ検証
+Name[ka]=KBabel-ის აქსელერატორი დამმოწმებელი
+Name[kk]=KBabel-дің акселераторларды тексеруі
+Name[lt]= KBabel prieigos klavišų žymių patikros įrankis
+Name[ms]=Pengesahan Kekunci Pintas untuk KBabel
+Name[nb]=Sjekk av snarveistaster i KBabel
+Name[nds]=Tastkombinatschoonprööv för KBabel
+Name[ne]=केब्याबलका लागि गतिबर्धक प्रमाणीकरण
+Name[nl]=Sneltoetsvalidatie voor KBabel
+Name[nn]=Sjekk av snarvegstastar i KBabel
+Name[pa]=ਕਬਬੇਲ ਲਈ ਪਰਵੇਸ਼ਕ ਪਰਮਾਣਕ
+Name[pl]=Sprawdzanie klawiszy skrótu w KBabel
+Name[pt]=Validação de Aceleradores para o KBabel
+Name[pt_BR]=Validação de Acelerador para o KBabel
+Name[ru]=Проверка акселераторов для KBabel
+Name[sk]=Kontrola akcelerátorov pre KBabel
+Name[sl]=Pospeševalni potrjevalnik za KBabel
+Name[sr]=Овера тастера за брзи приступ за KBabel
+Name[sr@Latn]=Overa tastera za brzi pristup za KBabel
+Name[sv]=Validering av snabbtangenter för Kbabel
+Name[ta]= Kபாபேலுக்கு தருமதிப்பு செல்லுபடிச் சோதனை
+Name[tg]=Тафтиши акселаторҳо барои KBabel
+Name[tr]=KBabel için Hızlandırma Onayı
+Name[uk]=Перевірка акселератора для KBabel
+Name[zh_CN]=KBabel 的快捷键检查器
+Name[zh_TW]=KBabel 的快速鍵檢查器
+ValidationString=accelerator
+X-KDE-Library=kbabel_accelstool
+Type=Service
+Commands=validate
+Comment=Check Accelerators
+Comment[bg]=Проверка на ускорителите
+Comment[bs]=Provjeri akceleratore
+Comment[ca]=Comprova els acceleradors
+Comment[cs]=Zkontrolovat akcelerátory
+Comment[cy]=Gwirio Cyflymyddion
+Comment[da]=Tjek acceleratorer
+Comment[de]=Kurzbefehle prüfen
+Comment[el]=Έλεγχος πλήκτρων επιτάχυνσης
+Comment[es]=Comprobar teclas rápidas
+Comment[et]=Kiirklahvide kontroll
+Comment[eu]=Egiaztatu bizkortzaileak
+Comment[fa]=بررسی شتاب‌دهها
+Comment[fi]=Tarkista pikavalinnat
+Comment[fr]=Vérification des accélérateurs clavier
+Comment[ga]=Seiceáil Aicearraí
+Comment[gl]=Verificación de Aceleradores
+Comment[he]=בודק מזנקים
+Comment[hi]=त्वरक जांच करें
+Comment[hu]=A gyorsbillentyűk ellenőrzése
+Comment[is]=Athuga flýtilykla
+Comment[it]=Controlla tasti acceleratori
+Comment[ja]=アクセラレータを検証
+Comment[ka]=აქსელერაციის შემოწმება
+Comment[kk]=Акселераторларды тексеру
+Comment[lt]=Patikrinti prieigos klavišų žymes
+Comment[ms]=Periksa Kekunci Pintas
+Comment[nb]=Sjekk snarveistastene
+Comment[nds]=Tastkombinatschonen pröven
+Comment[ne]=गतिबर्धक जाँच गर्नुहोस्
+Comment[nl]=Sneltoetsen controleren
+Comment[nn]=Sjekk snarvegstastar
+Comment[pa]=ਪਰਵੇਸ਼ਕ ਜਾਂਚ
+Comment[pl]=Sprawdzenie klawiszy skrótu
+Comment[pt]=Verificação de Aceleradores
+Comment[pt_BR]=Verifica Aceleradores
+Comment[ru]=Проверка акселераторов
+Comment[sk]=Kontrola akcelerátorov
+Comment[sl]=Preveri pospeševalnike
+Comment[sr]=Провери тастере за брзи приступ
+Comment[sr@Latn]=Proveri tastere za brzi pristup
+Comment[sv]=Kontrollera snabbtangenter
+Comment[ta]=தருமதிப்பு சரிபார்ப்பு
+Comment[tg]=Тафтиши акселаторҳо
+Comment[tr]=Hızlandırıcıları Denetle
+Comment[uk]=Перевірити акселератори
+Comment[zh_CN]=检查快捷键
+Comment[zh_TW]=檢查快速鍵
+Shortcuts=Ctrl+H
+ServiceTypes=KBabelValidator,KDataTool
+DataType=CatalogItem
+DataMimeTypes=application/x-kbabel-catalogitem
+ReadOnly=true
diff --git a/kbabel/datatools/accelerators/main.cc b/kbabel/datatools/accelerators/main.cc
new file mode 100644
index 00000000..4d94354e
--- /dev/null
+++ b/kbabel/datatools/accelerators/main.cc
@@ -0,0 +1,137 @@
+/* This file is part of KBabel
+ based Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
+ 2002 Stanislav Visnovsky <visnovsky@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+ In addition, as a special exception, the copyright holders give
+ permission to link the code of this program with any edition of
+ the Qt library by Trolltech AS, Norway (or with modified versions
+ of Qt that use the same license as Qt), and distribute linked
+ combinations including the two. You must obey the GNU General
+ Public License in all respects for all of the code used other than
+ Qt. If you modify this file, you may extend this exception to
+ your version of the file, but you are not obligated to do so. If
+ you do not wish to do so, delete this exception statement from
+ your version.
+
+*/
+
+#include <resources.h>
+#include "catalogitem.h"
+#include "catalogsettings.h"
+#include "main.h"
+
+#include <kconfig.h>
+#include <kdebug.h>
+#include <kgenericfactory.h>
+#include <klibloader.h>
+#include <klocale.h>
+
+/***************************************************
+ *
+ * Factory
+ *
+ ***************************************************/
+
+K_EXPORT_COMPONENT_FACTORY( kbabel_accelstool, KGenericFactory<AcceleratorTool> ( "kbabeldatatool" ) )
+
+using namespace KBabel;
+
+AcceleratorTool::AcceleratorTool( QObject* parent, const char* name, const QStringList & )
+ : KDataTool( parent, name ), _cache_origin( 0 )
+{
+ // bogus translation just for allowing the translation
+ i18n("what check found errors","accelerator");
+}
+
+bool AcceleratorTool::run( const QString& command, void* data, const QString& datatype, const QString& mimetype )
+{
+ if ( command != "validate" )
+ {
+ kdDebug(KBABEL) << "Accelerator Tool does only accept the command 'validate'" << endl;
+ kdDebug(KBABEL) << " The commands " << command << " is not accepted" << endl;
+ return FALSE;
+ }
+
+ // Check wether we can accept the data
+ if ( datatype != "CatalogItem" )
+ {
+ kdDebug(KBABEL) << "Accelerator Tool only accepts datatype CatalogItem" << endl;
+ return FALSE;
+ }
+
+ if ( mimetype != "application/x-kbabel-catalogitem" )
+ {
+ kdDebug(KBABEL) << "Accelerator Tool only accepts mimetype application/x-kbabel-catalogitem" << endl;
+ return FALSE;
+ }
+
+ if( command == "validate" )
+ {
+ CatalogItem* item = (CatalogItem*)(data);
+
+ if( _cache_origin != item->project() )
+ {
+ _context = item->project()->miscSettings().contextInfo;
+ _marker = item->project()->miscSettings().accelMarker;
+ _cache_origin = item->project();
+ }
+
+ bool hasError = false;
+
+ if(!item->isUntranslated())
+ {
+ // FIXME: this should care about plural forms in msgid
+ QString lineid=item->msgid().first();
+ lineid.replace( _context, "");
+ lineid.replace(QRegExp("\\n"),"");
+ lineid.simplifyWhiteSpace();
+ QString regStr(_marker);
+ regStr+="[^\\s]";
+ QRegExp reg(regStr);
+
+ QStringList str = item->msgstr(true);
+ for( QStringList::Iterator form = str.begin() ; form != str.end(); form++ )
+ {
+ QString linestr=(*form);
+ linestr.simplifyWhiteSpace();
+
+ int n = lineid.contains(reg);
+ if( _marker == '&' )
+ n = n - lineid.contains(QRegExp("(&[a-z,A-Z,\\-,0-9,#]*;)|(&&(?!&+))"));
+ int m = linestr.contains(reg);
+ if( _marker == '&' )
+ m = m - linestr.contains(QRegExp("(&[a-z,A-Z,\\-,0-9,#]*;)|(&&(?!&+))"));
+ hasError = hasError || ( n<=1 && m != n);
+ }
+ }
+
+ if(hasError)
+ {
+ item->appendError( "Accelerator" );
+ }
+ else
+ {
+ item->removeError( "Accelerator" );
+ }
+
+ return !hasError;
+ }
+ return FALSE;
+}
+
+#include "main.moc"
diff --git a/kbabel/datatools/accelerators/main.h b/kbabel/datatools/accelerators/main.h
new file mode 100644
index 00000000..559fe112
--- /dev/null
+++ b/kbabel/datatools/accelerators/main.h
@@ -0,0 +1,56 @@
+/* This file is part of KBabel
+ based on Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
+ 2002 Stanislav Visnovsky <visnovsky@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+ In addition, as a special exception, the copyright holders give
+ permission to link the code of this program with any edition of
+ the Qt library by Trolltech AS, Norway (or with modified versions
+ of Qt that use the same license as Qt), and distribute linked
+ combinations including the two. You must obey the GNU General
+ Public License in all respects for all of the code used other than
+ Qt. If you modify this file, you may extend this exception to
+ your version of the file, but you are not obligated to do so. If
+ you do not wish to do so, delete this exception statement from
+ your version.
+
+*/
+
+#ifndef __main_h__
+#define __main_h__
+
+#include "kbproject.h"
+
+#include <kdatatool.h>
+
+#include <qregexp.h>
+
+class AcceleratorTool : public KDataTool
+{
+ Q_OBJECT
+
+public:
+ AcceleratorTool( QObject* parent, const char* name, const QStringList & );
+ virtual bool run( const QString& command, void* data, const QString& datatype, const QString& mimetype);
+
+private:
+ QRegExp _context;
+ QChar _marker;
+ KBabel::Project::Ptr _cache_origin;
+};
+
+#endif
diff --git a/kbabel/datatools/arguments/Makefile.am b/kbabel/datatools/arguments/Makefile.am
new file mode 100644
index 00000000..5585d438
--- /dev/null
+++ b/kbabel/datatools/arguments/Makefile.am
@@ -0,0 +1,19 @@
+
+INCLUDES = -I$(srcdir)/../../common -I../../common $(all_includes)
+kbabel_argstool_la_LIBADD = $(LIB_KIO) ../../common/libkbabelcommon.la
+
+####### Files
+
+kde_module_LTLIBRARIES = kbabel_argstool.la
+
+kbabel_argstool_la_SOURCES = main.cc
+
+kbabel_argstool_la_LDFLAGS = $(all_libraries) -avoid-version -module -no-undefined
+
+noinst_HEADERS = main.h
+
+kbabel_argstool_la_METASOURCES = AUTO
+
+service_DATA = kbabel_argstool.desktop
+servicedir = $(kde_servicesdir)
+
diff --git a/kbabel/datatools/arguments/kbabel_argstool.desktop b/kbabel/datatools/arguments/kbabel_argstool.desktop
new file mode 100644
index 00000000..e90ba652
--- /dev/null
+++ b/kbabel/datatools/arguments/kbabel_argstool.desktop
@@ -0,0 +1,106 @@
+[Desktop Entry]
+Name=Argument Validation for KBabel
+Name[bg]=Валидност на аргументите - KBabel
+Name[bs]=Provjera argumenata za KBabel
+Name[ca]=Validació dels arguments per a KBabel
+Name[cs]=Validace argumentů pro KBabel
+Name[cy]= Dilysiant Ymresymiad i KBabel
+Name[da]=Argument-validering for KBabel
+Name[de]=Argument-Überprüfung für KBabel
+Name[el]=Έλεγχος εγκυρότητας ορισμάτων για το KBabel
+Name[es]=Validació de argumentos para KBabel
+Name[et]=KBabeli argumentide kontrollija
+Name[eu]=Argumentu balidazioa KBabel-entzat
+Name[fa]=اعتبارسنجی نشانوند برای KBabel
+Name[fi]=Argumenttien tarkistus KBabelissa
+Name[fr]=Validation d'un argument pour KBabel
+Name[ga]=Bailíochtú Argóintí le haghaidh KBabel
+Name[gl]=Validación de Argumentos para KBabel
+Name[hi]=के-बेबल के लिए आर्गुमेंट वेलिडेशन
+Name[hu]=Argumentumellenőrző a KBabelhez
+Name[is]=Viðfangastaðfestir fyrir KBabel
+Name[it]=Convalida argomenti per KBabel
+Name[ja]=KBabel 引数検証
+Name[ka]=KBabel-ის არგუმენტთა დამმოწმებელი
+Name[kk]=KBabel-дың аргументтерін тексеруі
+Name[lt]=Kbabel argumentų patikros įrankis
+Name[ms]=Pengesahan Argumen untuk KBabel
+Name[nb]=Argumentsjekk for KBabel
+Name[nds]=Argumentenprööv för KBabel
+Name[ne]=केब्याबलका लागि विषय प्रमाणीकरण
+Name[nl]=Argumentenvalidatie voor KBabel
+Name[nn]=Argumentsjekk for KBabel
+Name[pa]=ਕੇਬਬੇਲ ਲਈ ਆਰਗੂਮਿੰਟ ਪੜਤਾਲ
+Name[pl]=Sprawdzenie argumentów w KBabel
+Name[pt]=Validação de Argumentos para o KBabel
+Name[pt_BR]=Validação de Argumentos para o KBabel
+Name[ru]=Проверка аргументов для KBabel
+Name[sk]=Kontrola argumentov pre KBabel
+Name[sl]=Argumentni potrjevalnik za KBabel
+Name[sr]=Овера аргумената за KBabel
+Name[sr@Latn]=Overa argumenata za KBabel
+Name[sv]=Validering av parametrar för Kbabel
+Name[ta]= Kபாபேலுக்கு தருமதிப்பு செல்லுபடிச் சோதனை
+Name[tg]=Тафтиши далелҳо барои KBabel
+Name[tr]=KBabel için Hızlandırma Argümanı
+Name[uk]=Перевірка аргументів для KBabel
+Name[zh_CN]=KBabel 的参数检查器
+Name[zh_TW]=KBabel 的參數檢查器
+X-KDE-Library=kbabel_argstool
+Type=Service
+Commands=validate
+Comment=Check Arguments
+Comment[bg]=Проверка на аргументите
+Comment[bs]=Provjeri argumente
+Comment[ca]=Comprova els arguments
+Comment[cs]=Zkontrolovat argumenty
+Comment[cy]=Gwirio Ymresymiadau
+Comment[da]=Tjek argumenter
+Comment[de]=Argumente prüfen
+Comment[el]=Έλεγχος ορισμάτων
+Comment[eo]=Kontroli argumentojn
+Comment[es]=Comprobar argumentos
+Comment[et]=Argumentide kontroll
+Comment[eu]=Egiaztatu argumentuak
+Comment[fa]=بررسی نشانوندها
+Comment[fi]=Tarkista argumentit
+Comment[fr]=Vérification des arguments
+Comment[ga]=Seiceáil Argóintí
+Comment[gl]=Verificación dos argumentos
+Comment[he]=בודק ארגומנטים
+Comment[hi]=आर्गुमेंट जांच करें
+Comment[hu]=Az argumentumok ellenőrzése
+Comment[is]=Athuga viðföng
+Comment[it]=Controlla argomenti
+Comment[ja]=引数を検証
+Comment[ka]=არგუმენტების შემოწმება
+Comment[kk]=Аргументтерді тексеру
+Comment[lt]=Patikrinti argumentus
+Comment[ms]=Periksa Argumen
+Comment[nb]=Sjekk argumenter
+Comment[nds]=Argumenten pröven
+Comment[ne]=विषय जाँच गर्नुहोस्
+Comment[nl]=Argumenten controleren
+Comment[nn]=Sjekk argument
+Comment[pa]=ਆਰਗੂਮਿੰਟ ਜਾਂਚ
+Comment[pl]=Sprawdzenie argumentów
+Comment[pt]=Verificação dos argumentos
+Comment[pt_BR]=Verifica Argumentos
+Comment[ru]=Проверить аргументы
+Comment[sk]=Kontrola argumentov
+Comment[sl]=Preveri argumente
+Comment[sr]=Провери аргументе
+Comment[sr@Latn]=Proveri argumente
+Comment[sv]=Kontrollera parametrar
+Comment[ta]= தருமதிப்புகளை சரிபார்ப்பு
+Comment[tg]=Тафтиш кардани далелҳо
+Comment[tr]=Argümanların Denetimi
+Comment[uk]=Перевірити аргументи
+Comment[zh_CN]=检查参数
+Comment[zh_TW]=檢查參數
+Shortcuts=Ctrl+D
+ValidationString=arguments
+ServiceTypes=KDataTool,KBabelValidator
+DataType=CatalogItem
+DataMimeTypes=application/x-kbabel-catalogitem
+ReadOnly=true
diff --git a/kbabel/datatools/arguments/main.cc b/kbabel/datatools/arguments/main.cc
new file mode 100644
index 00000000..92c9765c
--- /dev/null
+++ b/kbabel/datatools/arguments/main.cc
@@ -0,0 +1,277 @@
+/* This file is part of KBabel
+ based Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
+ 2002-2003 Stanislav Visnovsky <visnovsky@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+ In addition, as a special exception, the copyright holders give
+ permission to link the code of this program with any edition of
+ the Qt library by Trolltech AS, Norway (or with modified versions
+ of Qt that use the same license as Qt), and distribute linked
+ combinations including the two. You must obey the GNU General
+ Public License in all respects for all of the code used other than
+ Qt. If you modify this file, you may extend this exception to
+ your version of the file, but you are not obligated to do so. If
+ you do not wish to do so, delete this exception statement from
+ your version.
+
+*/
+
+#include <resources.h>
+#include "catalogitem.h"
+#include "catalogsettings.h"
+#include "main.h"
+
+#include <kconfig.h>
+#include <kdebug.h>
+#include <kgenericfactory.h>
+#include <klocale.h>
+#include <kmessagebox.h>
+
+/***************************************************
+ *
+ * Factory
+ *
+ ***************************************************/
+
+K_EXPORT_COMPONENT_FACTORY( kbabel_argstool, KGenericFactory<ArgumentTool> ( "kbabeldatatool" ) )
+
+using namespace KBabel;
+
+ArgumentTool::ArgumentTool( QObject* parent, const char* name, const QStringList & )
+ : KDataTool( parent, name ), _cache_origin( 0 )
+{
+ i18n( "what check found errors","arguments");
+}
+
+bool ArgumentTool::run( const QString& command, void* data, const QString& datatype, const QString& mimetype )
+{
+ if ( command != "validate" )
+ {
+ kdDebug(KBABEL) << "Argument Tool does only accept the command 'validate' and 'shortcut'" << endl;
+ kdDebug(KBABEL) << " The commands " << command << " is not accepted" << endl;
+ return FALSE;
+ }
+
+ // Check wether we can accept the data
+ if ( datatype != "CatalogItem" )
+ {
+ kdDebug(KBABEL) << "Argument Tool only accepts datatype CatalogItem" << endl;
+ return FALSE;
+ }
+
+ if ( mimetype != "application/x-kbabel-catalogitem" )
+ {
+ kdDebug(KBABEL) << "Argument Tool only accepts mimetype application/x-kbabel-catalogitem" << endl;
+ return FALSE;
+ }
+
+ if( command == "validate" )
+ {
+ CatalogItem* item = (CatalogItem*)(data);
+
+ if( item->isNoCformat() ) return true;
+ bool hasError = false;
+
+ if( _cache_origin != item->project() )
+ {
+ _context = item->project()->miscSettings().contextInfo;
+ _checkPlurals = item->project()->identitySettings().checkPluralArgument;
+ _cache_origin = item->project();
+ }
+
+ if(!item->isUntranslated())
+ {
+
+ QString formatChars="dioxXucsfeEgGp%";
+
+ if( _checkPlurals ) formatChars+="n";
+
+ // FIXME: this should care about plural forms in msgid
+ QString line=item->msgid().first();
+ QStringList argList;
+
+// if( isPluralForm() )
+ {
+ // FIXME: this is KDE specific
+ if( line.startsWith("_n:" ))
+ {
+ // truncate text after first \n to get args only once
+ line = line.mid(0,line.find("\\n"));
+ }
+ }
+ line.replace(_context, "");
+ line.replace(QRegExp("\\n"),"");
+ line.simplifyWhiteSpace();
+
+ // flag, for GNU only we can allow reordering
+ bool non_gnu = (item->pluralForm() == KDESpecific);
+
+ int index=line.find(QRegExp("%."));
+
+ while(index>=0)
+ {
+ int endIndex=line.find(QRegExp("[^\\d]"),index+1);
+ if(endIndex<0)
+ {
+ endIndex=line.length();
+ }
+ else if( formatChars.contains(line[endIndex]) )
+ {
+ endIndex++;
+ }
+
+ if(endIndex - index > 1 ) {
+ QString arg = line.mid(index,endIndex-index);
+ if( arg.contains( QRegExp("\\d") ) ) {
+ non_gnu = true;
+ }
+ argList.append(arg);
+
+ }
+
+ index=line.find(QRegExp("%."),endIndex);
+ }
+
+ if( item->pluralForm()==KDESpecific)
+ {
+ // FIXME: this is KDE specific
+ if( _checkPlurals && line.startsWith("_n:" ) && !argList.contains("%n") )
+ {
+ argList.append("%n");
+ }
+ }
+
+ // generate for each plural form to be checked separately
+ line=item->msgstr().first();
+ QStringList lines;
+
+ // FIXME; this is KDE specific
+ if( item->pluralForm() == KDESpecific )
+ {
+ lines = QStringList::split("\\n",line);
+ }
+ else
+ {
+ lines.append(line);
+ }
+
+ QStringList argCache = argList;
+ QStringList foundArgs;
+
+ for(QStringList::Iterator i = lines.begin() ; i!=lines.end() ; i++)
+ {
+ // initialize for the next plural form
+ foundArgs.clear();
+ argList = argCache;
+
+ line=(*i);
+
+ line.replace(QRegExp("\\n"),"");
+
+ QRegExp argdesc(
+ "%((["+formatChars+"])"
+ +"|(\\d)+"
+ +"|(\\d)+\\$(["+formatChars+"])"
+ +")" ) ;
+ index = -1;
+
+ do {
+
+ index = argdesc.search( line, index+1 );
+
+ if( index == -1 ) break;
+
+ // do not add a redundant argument, if it is non GNU
+ if( !non_gnu || !foundArgs.contains( argdesc.cap(0) ) )
+ foundArgs.append( argdesc.cap( 0 ) );
+ } while( true );
+
+ // now, compare the list
+ argList = argCache;
+
+ if( non_gnu ) {
+ for ( QStringList::Iterator it = foundArgs.begin(); it != foundArgs.end(); ++it ) {
+ if( argList.find( *it ) == argList.end() ) {
+ hasError = true;
+ break;
+ } else {
+ argList.remove( *it );
+ }
+ }
+
+ if( ! argList.isEmpty() ) {
+ hasError = true;
+ }
+ }
+ else
+ {
+ // handle GNU with replacements
+ QStringList::Iterator oit = argList.begin();
+ for ( QStringList::Iterator it = foundArgs.begin(); it != foundArgs.end(); ++it , ++oit) {
+ if( *it == *oit ) {
+ // argument is the same, mark as used
+ *oit = QString::null;
+ } else {
+ // try to strip replacement
+ int index = (*it).find( '$' );
+ if( index == -1 ) {
+ // there is no replacement, this is wrong
+ hasError = true;
+ break;
+ }
+ QString place = (*it).mid( 1, index-1 );
+ QString arg = (*it).right( index );
+ arg[0] = '%';
+ QStringList::Iterator a = argList.at( place.toInt()-1 );
+ if( a != argList.end() && (*a) == arg )
+ {
+ (*a) = QString::null;
+ }
+ else
+ {
+ // duplicate or index is too high
+ hasError = true;
+ }
+ }
+ }
+
+ for ( QStringList::Iterator it = argList.begin(); it != argList.end(); ++it) {
+ if( ! (*it).isNull () ) {
+ // argument is the same, mark as used
+ hasError = true;
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ if(hasError)
+ {
+ item->appendError( "Arguments" );
+ }
+ else
+ {
+ item->removeError( "Arguments" );
+ }
+
+ return !hasError;
+ }
+ return FALSE;
+}
+
+#include "main.moc"
diff --git a/kbabel/datatools/arguments/main.h b/kbabel/datatools/arguments/main.h
new file mode 100644
index 00000000..a05cce49
--- /dev/null
+++ b/kbabel/datatools/arguments/main.h
@@ -0,0 +1,55 @@
+/* This file is part of KBabel
+ based on Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
+ 2002-2003 Stanislav Visnovsky <visnovsky@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+ In addition, as a special exception, the copyright holders give
+ permission to link the code of this program with any edition of
+ the Qt library by Trolltech AS, Norway (or with modified versions
+ of Qt that use the same license as Qt), and distribute linked
+ combinations including the two. You must obey the GNU General
+ Public License in all respects for all of the code used other than
+ Qt. If you modify this file, you may extend this exception to
+ your version of the file, but you are not obligated to do so. If
+ you do not wish to do so, delete this exception statement from
+ your version.
+
+*/
+
+#ifndef __main_h__
+#define __main_h__
+
+#include "kbproject.h"
+
+#include <kdatatool.h>
+
+#include <qregexp.h>
+
+class ArgumentTool : public KDataTool
+{
+ Q_OBJECT
+
+public:
+ ArgumentTool( QObject* parent, const char* name, const QStringList & );
+ virtual bool run( const QString& command, void* data, const QString& datatype, const QString& mimetype);
+private:
+ KBabel::Project::Ptr _cache_origin;
+ QRegExp _context;
+ bool _checkPlurals;
+};
+
+#endif
diff --git a/kbabel/datatools/context/Makefile.am b/kbabel/datatools/context/Makefile.am
new file mode 100644
index 00000000..4d4a7c0e
--- /dev/null
+++ b/kbabel/datatools/context/Makefile.am
@@ -0,0 +1,19 @@
+
+INCLUDES = -I$(srcdir)/../../common -I../../common $(all_includes)
+kbabel_contexttool_la_LIBADD = $(LIB_KIO) ../../common/libkbabelcommon.la
+
+####### Files
+
+kde_module_LTLIBRARIES = kbabel_contexttool.la
+
+kbabel_contexttool_la_SOURCES = main.cc
+
+kbabel_contexttool_la_LDFLAGS = $(all_libraries) -avoid-version -module -no-undefined
+
+noinst_HEADERS = main.h
+
+kbabel_contexttool_la_METASOURCES = AUTO
+
+service_DATA = kbabel_contexttool.desktop
+servicedir = $(kde_servicesdir)
+
diff --git a/kbabel/datatools/context/kbabel_contexttool.desktop b/kbabel/datatools/context/kbabel_contexttool.desktop
new file mode 100644
index 00000000..482fefcf
--- /dev/null
+++ b/kbabel/datatools/context/kbabel_contexttool.desktop
@@ -0,0 +1,100 @@
+[Desktop Entry]
+Name=Translated Context Info Validation for KBabel
+Name[bg]=Валидност на контекстната информация - KBabel
+Name[bs]=Provjera prevedenih kontekst informacija za KBabel
+Name[ca]=Validació de la informació al context traduït per a KBabel
+Name[cs]=Validace přeložených kontextových informací
+Name[cy]=Dilysiant Gwybodaeth Cyd-destun wedi'i cyfieithu i KBabel
+Name[da]=Oversat sammenhængsinfo-validering for KBabel
+Name[de]=Kontextinfo-Überprüfung für KBabel
+Name[el]=Έλεγχος εγκυρότητας μεταφρασμένων σχετικών πληροφοριών για το KBabel
+Name[es]=Validación de información de contexto traducida para KBabel
+Name[et]=KBabeli tõlgitud kontekstiinfo kontrollija
+Name[eu]=Itzulitako kontestuen informazioaren balidazioa KBabel-entzat
+Name[fa]=اعتبارسنجی اطلاعات متن ترجمه‌شده برای KBabel
+Name[fi]=Käännetyn kontekstitiedon tarkistus KBabelissa
+Name[fr]=Validation des informations de contexte de traduction pour KBabel
+Name[gl]=Validación da Información de Contexto para KBabel
+Name[hi]=के-बेबल के लिए अनूदित कॉन्टेक्स्ट जानकारी वेलिडेशन
+Name[hu]=Ellenőrző a fordítási kontextushoz a KBabelben
+Name[is]=Staðfesting þýddra samhengisupplýsinga fyrir KBabel
+Name[it]=Convalida delle informazioni di contesto tradotte per KBabel
+Name[ja]=KBabel 翻訳された文脈情報を検索
+Name[ka]=თარგმნის კონტექსტის ინფორმაცია KBabel-სთვის
+Name[kk]=KBabel-дың аударылған контекстік мәліметін тексеру
+Name[lt]=KBabel išverstos kontekstinės informacijos patikros įrankis
+Name[ms]=Pengesahan Info Konteks Telah Diterjemah untuk KBabel
+Name[nb]=Sjekk av oversatt sammenhengsinformasjon i KBabel
+Name[nds]=Prööv op översett Infokontext för KBabel
+Name[ne]=केब्याबलका लागि अनुबाद गरिएको प्रसङ्ग सूचना प्रमाणीकरण
+Name[nl]=Vertaalde contextinformatie-validatie voor KBabel
+Name[nn]=Sjekk av omsett samanhengsinformasjon i KBabel
+Name[pl]=Sprawdzanie kontekstu tłumaczonej informacji dla KBabel
+Name[pt]=Validação da Informação de Contexto do KBabel
+Name[pt_BR]=Validação de Informações de Contexto Traduzidas para o KBabel
+Name[ru]=Проверка переведённой контекстной информации для KBabel
+Name[sk]=Kontrola kontextu v preklade pre KBabel
+Name[sl]=Potrjevalnik informacij prevedene vsebine za KBabel
+Name[sr]=Овера преведених контекстних информација за KBabel
+Name[sr@Latn]=Overa prevedenih kontekstnih informacija za KBabel
+Name[sv]=Validering av översatt sammanhangsinformation för Kbabel
+Name[ta]= Kபாபேலுக்கு மொழிபெயர்ப்பு சூழல் தகவல் செல்லுபடியாக்கம்
+Name[tg]=Тафтиши ахбороти тарҷумашудаи матнӣ барои KBabel
+Name[tr]=KBabel için Çevrilen Bağlam Bilgisi Denetimi
+Name[uk]=Перевірка інформації контексту перекладу для KBabel
+Name[zh_CN]=KBabel 的上下文信息翻译检查器
+Name[zh_TW]=KBabel 的已翻譯內容資訊確認
+ValidationString=context information
+X-KDE-Library=kbabel_contexttool
+Type=Service
+Commands=validate
+Comment=Look for Translated Context Info
+Comment[bg]=Търсене на контекстна информация за преведените
+Comment[bs]=Potraži prevedene kontekstne informacije
+Comment[ca]=Mira la informació al context traduït
+Comment[cs]=Vyhledat přeložené kontextové informace
+Comment[cy]=Chwilio am Gwybodaeth Cyd-destun wedi'i cyfieithu
+Comment[da]=Kig efter oversat sammenhængsinfo
+Comment[de]=Suche nach übersetzter Kontextinformation
+Comment[el]=Έλεγχος για μεταφρασμένες σχετικές πληροφορίες
+Comment[es]=Buscar información de contexto traducida
+Comment[et]=Tõlgitud kontekstiinfo otsimine
+Comment[eu]=Bilatu itzulitako kontestuaren informazioa
+Comment[fa]=جستجوی اطلاعات متن ترجمه‌شده
+Comment[fi]=Etsi käännettyä kontekstitietoa
+Comment[fr]=Analyse les informations de contexte de traduction
+Comment[gl]=Verificar a información de contexto
+Comment[hi]=अनूदित कॉन्टेक्स्ट जानकारी के लिए देखें
+Comment[hu]=A kontextusfordítások kiszűrése
+Comment[is]=Leita að þýddum samhengisupplýsingum
+Comment[it]=Cerca informazioni di contesto tradotte
+Comment[ja]=翻訳された文脈情報を検索
+Comment[ka]=თარგმნის კონტექსტის ინფორმაციის ძიება
+Comment[kk]=Аударылған контекстік мәліметін қарау
+Comment[lt]=Ieškoti išverstos kontekstinės informacijos
+Comment[ms]=Cari Info Konteks Telah Diterjemah
+Comment[nb]=Se etter oversatt kontekstinformasjon
+Comment[nds]=Op översett Kontextinformatschonen pröven
+Comment[ne]=अनुबाद गरिएको प्रसङ्ग सूचना अवलोकन
+Comment[nl]=Vertaalde contextinformatie zoeken
+Comment[nn]=Sjå etter omsett samanhengsinformasjon
+Comment[pl]=Sprawdzenie kontekstu tłumaczonej informacji
+Comment[pt]=Verificar a existência de traduções da informação de contexto
+Comment[pt_BR]=Procura por Informações de Contexto Traduzidas
+Comment[ru]=Поиск переведённой контекстной информации
+Comment[sk]=Hľadanie preloženej kontextovej informácie
+Comment[sl]=Vpogled v Informacije prevedene vsebine
+Comment[sr]=Изглед за преведене контекстне информације
+Comment[sr@Latn]=Izgled za prevedene kontekstne informacije
+Comment[sv]=Leta efter översatt sammanhangsinformation
+Comment[ta]= மொழிபெயர்ப்பு சூழல் தகவலை பார்
+Comment[tg]=Ҷустуҷӯи ахбороти тарҷумашудаи матнӣ
+Comment[tr]=Çevrilen Bağlam Bilgisi için Görünüş
+Comment[uk]=Пошук за інформацією контексту перекладу
+Comment[zh_CN]=查找翻译的上下文信息
+Comment[zh_TW]=尋找已翻譯的內容資訊
+Shortcuts=Ctrl+L
+ServiceTypes=KDataTool,KBabelValidator
+DataType=CatalogItem
+DataMimeTypes=application/x-kbabel-catalogitem
+ReadOnly=true
diff --git a/kbabel/datatools/context/main.cc b/kbabel/datatools/context/main.cc
new file mode 100644
index 00000000..19af3afd
--- /dev/null
+++ b/kbabel/datatools/context/main.cc
@@ -0,0 +1,115 @@
+/* This file is part of KBabel
+ based Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
+ 2002 Stanislav Visnovsky <visnovsky@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+ In addition, as a special exception, the copyright holders give
+ permission to link the code of this program with any edition of
+ the Qt library by Trolltech AS, Norway (or with modified versions
+ of Qt that use the same license as Qt), and distribute linked
+ combinations including the two. You must obey the GNU General
+ Public License in all respects for all of the code used other than
+ Qt. If you modify this file, you may extend this exception to
+ your version of the file, but you are not obligated to do so. If
+ you do not wish to do so, delete this exception statement from
+ your version.
+
+*/
+
+#include <resources.h>
+#include "catalogitem.h"
+#include "catalogsettings.h"
+#include "main.h"
+
+#include <kconfig.h>
+#include <kdebug.h>
+#include <kgenericfactory.h>
+#include <klibloader.h>
+#include <klocale.h>
+#include <kmessagebox.h>
+
+/***************************************************
+ *
+ * Factory
+ *
+ ***************************************************/
+
+K_EXPORT_COMPONENT_FACTORY( kbabel_contexttool, KGenericFactory<ContextTool> ( "kbabeldatatool" ) )
+
+using namespace KBabel;
+
+ContextTool::ContextTool( QObject* parent, const char* name, const QStringList & )
+ : KDataTool( parent, name ), _cache_origin( 0 )
+{
+ i18n("what check found errors","context info");
+}
+
+bool ContextTool::run( const QString& command, void* data, const QString& datatype, const QString& mimetype )
+{
+ if ( command != "validate" )
+ {
+ kdDebug(KBABEL) << "Context Tool does only accept the command 'validate' and 'shortcut'" << endl;
+ kdDebug(KBABEL) << " The commands " << command << " is not accepted" << endl;
+ return FALSE;
+ }
+
+ // Check wether we can accept the data
+ if ( datatype != "CatalogItem" )
+ {
+ kdDebug(KBABEL) << "Context Tool only accepts datatype CatalogItem" << endl;
+ return FALSE;
+ }
+
+ if ( mimetype != "application/x-kbabel-catalogitem" )
+ {
+ kdDebug(KBABEL) << "Context Tool only accepts mimetype application/x-kbabel-catalogitem" << endl;
+ return FALSE;
+ }
+
+ if( command == "validate" )
+ {
+ CatalogItem* item = (CatalogItem*)(data);
+
+ if( _cache_origin != item->project() )
+ {
+ _context = item->project()->miscSettings().contextInfo;
+ _cache_origin = item->project();
+ }
+
+ bool hasError = false;
+
+ if(!item->isUntranslated() && item->msgid().first().contains(_context)
+ && item->msgstr().first().contains(_context) )
+ {
+ hasError = true;
+ }
+
+ if(hasError)
+ {
+ item->appendError( "context info" );
+ }
+ else
+ {
+ item->removeError( "context info" );
+ }
+
+ return !hasError;
+ }
+ return FALSE;
+}
+
+#include "main.moc"
diff --git a/kbabel/datatools/context/main.h b/kbabel/datatools/context/main.h
new file mode 100644
index 00000000..99035691
--- /dev/null
+++ b/kbabel/datatools/context/main.h
@@ -0,0 +1,52 @@
+/* This file is part of KBabel
+ based on Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
+ 2002 Stanislav Visnovsky <visnovsky@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+ In addition, as a special exception, the copyright holders give
+ permission to link the code of this program with any edition of
+ the Qt library by Trolltech AS, Norway (or with modified versions
+ of Qt that use the same license as Qt), and distribute linked
+ combinations including the two. You must obey the GNU General
+ Public License in all respects for all of the code used other than
+ Qt. If you modify this file, you may extend this exception to
+ your version of the file, but you are not obligated to do so. If
+ you do not wish to do so, delete this exception statement from
+ your version.
+
+*/
+
+#ifndef __main_h__
+#define __main_h__
+
+#include "kbproject.h"
+
+#include <kdatatool.h>
+
+class ContextTool : public KDataTool
+{
+ Q_OBJECT
+
+public:
+ ContextTool( QObject* parent, const char* name, const QStringList & );
+ virtual bool run( const QString& command, void* data, const QString& datatype, const QString& mimetype);
+private:
+ KBabel::Project::Ptr _cache_origin;
+ QRegExp _context;
+};
+
+#endif
diff --git a/kbabel/datatools/equations/Makefile.am b/kbabel/datatools/equations/Makefile.am
new file mode 100644
index 00000000..9b49892d
--- /dev/null
+++ b/kbabel/datatools/equations/Makefile.am
@@ -0,0 +1,19 @@
+
+INCLUDES = -I$(srcdir)/../../common -I../../common $(all_includes)
+kbabel_equationstool_la_LIBADD = $(LIB_KIO) ../../common/libkbabelcommon.la
+
+####### Files
+
+kde_module_LTLIBRARIES = kbabel_equationstool.la
+
+kbabel_equationstool_la_SOURCES = main.cc
+
+kbabel_equationstool_la_LDFLAGS = $(all_libraries) -avoid-version -module -no-undefined
+
+noinst_HEADERS = main.h
+
+kbabel_equationstool_la_METASOURCES = AUTO
+
+service_DATA = kbabel_equationstool.desktop
+servicedir = $(kde_servicesdir)
+
diff --git a/kbabel/datatools/equations/kbabel_equationstool.desktop b/kbabel/datatools/equations/kbabel_equationstool.desktop
new file mode 100644
index 00000000..cc3544a5
--- /dev/null
+++ b/kbabel/datatools/equations/kbabel_equationstool.desktop
@@ -0,0 +1,104 @@
+[Desktop Entry]
+Name=Equation Validation for KBabel
+Name[bg]=Валидност на изравняването - KBabel
+Name[bs]=Provjera jednakosti za KBabel
+Name[ca]=Validació de les equacions per a KBabel
+Name[cs]=Validace rovnic
+Name[cy]=Dilysiant Hafaliad i KBabel
+Name[da]=Lignings-validering for KBabel
+Name[de]=Formel-Überprüfung für KBabel
+Name[el]=Έλεγχος εγκυρότητας εξισώσεων για το KBabel
+Name[es]=Validación de ecuaciones para KBabel
+Name[et]=KBabeli võrduste kontrollija
+Name[eu]=Ekuazioen balidazioa KBabel-entzat
+Name[fa]=اعتبارسنجی معادله برای KBabel
+Name[fi]=Yhtälöiden tarkistus KBabelissa
+Name[fr]=Validateur de similitudes pour KBabel
+Name[ga]=Bailíochtú Cothromóidí le haghaidh KBabel
+Name[gl]=Validación de ecuacións para KBabel
+Name[hi]=के-बेबल के लिए समीकरण वेलिडेशन
+Name[hu]=Egyenletellenőrző a KBabelhez
+Name[is]=Jöfnustaðfesting fyrir KBabel
+Name[it]=Convalida delle equazioni per KBabel
+Name[ja]=KBabel 等式検証
+Name[ka]=KBabel-ს ფორმულათა დამოწმება
+Name[kk]=KBabel-дың баламаларын тексеруі
+Name[lt]=KBabel lygybių patikros įrankis
+Name[ms]=Pengesahan Persamaan untuk KBabel
+Name[nb]=Likningssjekk for KBabel
+Name[nds]=Gliekenprööv för KBabel
+Name[ne]=केब्याबलका लागि समीकरण प्रमाणीकरण
+Name[nl]=Vergelijkingenvalidatie voor KBabel
+Name[nn]=Likningssjekk for KBabel
+Name[pl]=Sprawdzenie równań w KBabel
+Name[pt]=Validação de Equações para o KBabel
+Name[pt_BR]=Validação de Equação para o KBabel
+Name[ru]=Проверка уравнений для KBabel
+Name[sk]=Kontrola rovníc pre KBabel
+Name[sl]=Potrjevalnik enačb za KBabel
+Name[sr]=Овера једначина за KBabel
+Name[sr@Latn]=Overa jednačina za KBabel
+Name[sv]=Validering av ekvationer för Kbabel
+Name[ta]= Kபாபேலுக்கு சமன்பாடு செல்லுபடிச் சோதனை
+Name[tg]=Тафтиши баробар барои KBabel
+Name[tr]=KBabel için Denklem Denetimi
+Name[uk]=Перевірка рівнянь для KBabel
+Name[zh_CN]=KBabel 的等式检查器
+Name[zh_TW]=KBabel 的等式檢查器
+X-KDE-Library=kbabel_equationstool
+Type=Service
+Commands=validate
+Comment=Check Equations
+Comment[bg]=Проверка на изравняването
+Comment[bs]=Provjeri jednakosti
+Comment[ca]=Comprova les equacions
+Comment[cs]=Zkontrolovat rovnice
+Comment[cy]=Gwirio Hafaliadau
+Comment[da]=Tjek ligninger
+Comment[de]=Formeln prüfen
+Comment[el]=Έλεγχος εξισώσεων
+Comment[es]=Comprobar ecuaciones
+Comment[et]=Võrduste kontroll
+Comment[eu]=Egiaztatu ekuazioak
+Comment[fa]=بررسی معادله‌ها
+Comment[fi]=Tarkista yhtälöt
+Comment[fr]=Vérifier les identités
+Comment[ga]=Seiceáil Cothromóidí
+Comment[gl]=Verifica as ecuacións
+Comment[he]=בודק משוואות
+Comment[hi]=समीकरण जांच करें
+Comment[hu]=Az egyenletek ellenőrzése
+Comment[is]=Athuga jöfnur
+Comment[it]=Controlla equazioni
+Comment[ja]= 等式を検証
+Comment[ka]=ფორმულათა შემოწმება
+Comment[kk]=Баламаларды тексеру
+Comment[lt]=Tikrinti lygybes
+Comment[ms]=Periksa Persamaan
+Comment[nb]=Sjekk likninger
+Comment[nds]=Glieken pröven
+Comment[ne]=समीकरण जाँच गर्नुहोस्
+Comment[nl]=Vergelijkingen controleren
+Comment[nn]=Sjekk likningar
+Comment[pa]=ਸਮੀਕਰਨ ਜਾਂਚ
+Comment[pl]=Sprawdzenie równań
+Comment[pt]=Verifica as equações
+Comment[pt_BR]=Verifica Equações
+Comment[ru]=Проверить уравнения
+Comment[sk]=Kontrola rovníc
+Comment[sl]=Preveri enačbe
+Comment[sr]=Провери једначине
+Comment[sr@Latn]=Proveri jednačine
+Comment[sv]=Kontrollera ekvationer
+Comment[ta]= சமன்பாடு சரிபார்ப்பு
+Comment[tg]=Тафтиш кардани баробарҳо
+Comment[tr]=Denklemleri Denetle
+Comment[uk]=Перевірити рівняння
+Comment[zh_CN]=检查等式
+Comment[zh_TW]=檢查等式
+ServiceTypes=KDataTool,KBabelValidator
+Shortcuts=Ctrl+J
+ValidationString=equations
+DataType=CatalogItem
+DataMimeTypes=application/x-kbabel-catalogitem
+ReadOnly=true
diff --git a/kbabel/datatools/equations/main.cc b/kbabel/datatools/equations/main.cc
new file mode 100644
index 00000000..bab01785
--- /dev/null
+++ b/kbabel/datatools/equations/main.cc
@@ -0,0 +1,113 @@
+/* This file is part of KBabel
+ based Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
+ 2002 Stanislav Visnovsky <visnovsky@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+ In addition, as a special exception, the copyright holders give
+ permission to link the code of this program with any edition of
+ the Qt library by Trolltech AS, Norway (or with modified versions
+ of Qt that use the same license as Qt), and distribute linked
+ combinations including the two. You must obey the GNU General
+ Public License in all respects for all of the code used other than
+ Qt. If you modify this file, you may extend this exception to
+ your version of the file, but you are not obligated to do so. If
+ you do not wish to do so, delete this exception statement from
+ your version.
+
+*/
+
+#include <resources.h>
+#include "catalogitem.h"
+#include "catalogsettings.h"
+#include "main.h"
+
+#include <kconfig.h>
+#include <kdebug.h>
+#include <kgenericfactory.h>
+#include <klibloader.h>
+#include <klocale.h>
+#include <kmessagebox.h>
+
+/***************************************************
+ *
+ * Factory
+ *
+ ***************************************************/
+
+K_EXPORT_COMPONENT_FACTORY( kbabel_equationstool, KGenericFactory<EquationsTool> ( "kbabeldatatool" ) )
+
+using namespace KBabel;
+
+EquationsTool::EquationsTool( QObject* parent, const char* name, const QStringList & )
+ : KDataTool( parent, name ), _equation("^[a-zA-Z0-9]+=.+")
+{
+ i18n("what check found errors","equations");
+}
+
+bool EquationsTool::run( const QString& command, void* data, const QString& datatype, const QString& mimetype )
+{
+ if ( command != "validate" )
+ {
+ kdDebug(KBABEL) << "Equations Tool does only accept the command 'validate' and 'shortcut'" << endl;
+ kdDebug(KBABEL) << " The commands " << command << " is not accepted" << endl;
+ return FALSE;
+ }
+
+ // Check wether we can accept the data
+ if ( datatype != "CatalogItem" )
+ {
+ kdDebug(KBABEL) << "Equations Tool only accepts datatype CatalogItem" << endl;
+ return FALSE;
+ }
+
+ if ( mimetype != "application/x-kbabel-catalogitem" )
+ {
+ kdDebug(KBABEL) << "Equations Tool only accepts mimetype application/x-kbabel-catalogitem" << endl;
+ return FALSE;
+ }
+
+ if( command == "validate" )
+ {
+ CatalogItem* item = (CatalogItem*)(data);
+
+ bool hasError = false;
+
+ if(!item->isUntranslated() && !item->msgid().first().contains('\n')
+ && item->msgid().first().contains(_equation))
+ {
+ int index = item->msgid().first().find('=');
+ QString left = item->msgid().first().left(index);
+ index = item->msgstr().first().find('=');
+ if(left != item->msgstr().first().left(index))
+ hasError = true;
+ }
+
+ if(hasError)
+ {
+ item->appendError( "equations" );
+ }
+ else
+ {
+ item->removeError( "equations" );
+ }
+
+ return !hasError;
+ }
+ return FALSE;
+}
+
+#include "main.moc"
diff --git a/kbabel/datatools/equations/main.h b/kbabel/datatools/equations/main.h
new file mode 100644
index 00000000..6edff1c6
--- /dev/null
+++ b/kbabel/datatools/equations/main.h
@@ -0,0 +1,50 @@
+/* This file is part of KBabel
+ based on Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
+ 2002 Stanislav Visnovsky <visnovsky@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+ In addition, as a special exception, the copyright holders give
+ permission to link the code of this program with any edition of
+ the Qt library by Trolltech AS, Norway (or with modified versions
+ of Qt that use the same license as Qt), and distribute linked
+ combinations including the two. You must obey the GNU General
+ Public License in all respects for all of the code used other than
+ Qt. If you modify this file, you may extend this exception to
+ your version of the file, but you are not obligated to do so. If
+ you do not wish to do so, delete this exception statement from
+ your version.
+
+*/
+
+#ifndef __main_h__
+#define __main_h__
+
+#include <qregexp.h>
+#include <kdatatool.h>
+
+class EquationsTool : public KDataTool
+{
+ Q_OBJECT
+
+public:
+ EquationsTool( QObject* parent, const char* name, const QStringList & );
+ virtual bool run( const QString& command, void* data, const QString& datatype, const QString& mimetype);
+private:
+ QRegExp _equation;
+};
+
+#endif
diff --git a/kbabel/datatools/length/Makefile.am b/kbabel/datatools/length/Makefile.am
new file mode 100644
index 00000000..62231402
--- /dev/null
+++ b/kbabel/datatools/length/Makefile.am
@@ -0,0 +1,19 @@
+
+INCLUDES = -I$(srcdir)/../../common -I../../common $(all_includes)
+kbabel_lengthtool_la_LIBADD = $(LIB_KIO) ../../common/libkbabelcommon.la
+
+####### Files
+
+kde_module_LTLIBRARIES = kbabel_lengthtool.la
+
+kbabel_lengthtool_la_SOURCES = main.cc
+
+kbabel_lengthtool_la_LDFLAGS = $(all_libraries) -avoid-version -module -no-undefined
+
+noinst_HEADERS = main.h
+
+kbabel_lengthtool_la_METASOURCES = AUTO
+
+service_DATA = kbabel_lengthtool.desktop
+servicedir = $(kde_servicesdir)
+
diff --git a/kbabel/datatools/length/kbabel_lengthtool.desktop b/kbabel/datatools/length/kbabel_lengthtool.desktop
new file mode 100644
index 00000000..2171f44e
--- /dev/null
+++ b/kbabel/datatools/length/kbabel_lengthtool.desktop
@@ -0,0 +1,98 @@
+[Desktop Entry]
+Name=Translated Message Length Validator for KBabel
+Name[bg]=Валидност на дължината на преведените съобщения - KBabel
+Name[bs]=Provjera dužine prevedenih poruka za KBabel
+Name[ca]=Un validador per a KBabel de la llargària dels missatges traduïts
+Name[cs]=Validátor délky přeložených zpráv
+Name[cy]=Dilysydd Hyd Neges wedi'i Gyfieithu ar gyfer KBabel
+Name[da]=Oversat beskedlængde godkender for KBabel
+Name[de]=Überprüfung der übersetzten Nachrichtenlänge für KBabel
+Name[el]=Ελεγκτής εγκυρότητας μήκους μεταφρασμένων μηνυμάτων για το KBabel
+Name[eo]=Longeckontrolilo por tradukitaj mesaĝoj
+Name[es]=Validador de longitud de mensajes traducidos para KBabel
+Name[et]=KBabeli tõlgitud teadete pikkuse kontrollija
+Name[eu]=Itzulitako mezu luzera balidatzailea KBabel-entzat
+Name[fa]=اعتبارسنج طول پیام ترجمه‌شده برای KBabel
+Name[fi]=Käännetyn viestin pituuden tarkistus KBabelissa
+Name[fr]=Un validateur de longueur de message pour KBabel
+Name[gl]=Validador do tamaño da mensaxe traducida para KBabel
+Name[hu]=Üzenethossz-ellenőrző a KBabelhez
+Name[is]=Staðfestir á lengd þýddra skeyta fyrir KBabel
+Name[it]=Convalidatore di KBabel per la lunghezza dei messaggi tradotti
+Name[ja]=KBabel 翻訳メッセージの長さを検証
+Name[ka]=ნათარგმნი შეტყობინებების სიგრძის დამოწმება KBabel-სთვის
+Name[kk]=KBabel-дың аударылған жазулардың ұзындығын тексеруі
+Name[lt]=KBabel išverstų pranešimų ilgio patikros įrankis
+Name[nb]=Sjekk av lengden på oversatte strenger i KBabel
+Name[nds]=Textlängde-Prööv för KBabel
+Name[ne]=केब्याबलका लागि अनुबाद गरिएको सन्देश लम्बाइ प्रमाणितकर्ता
+Name[nl]=Vertaalde-tekstlengte-validatie voor KBabel
+Name[nn]=Sjekk av lengda på omsette strengar i KBabel
+Name[pl]=Sprawdzenie długości przetłumaczonego komunikatu w KBabel
+Name[pt]=Validador do Tamanho da Mensagem Traduzida para o KBabel
+Name[pt_BR]=Um Validador de Tamanho de Mensagem Traduzida para o KBabel
+Name[ru]=Проверка длины переведённых сообщений для KBabel
+Name[sk]=Kontrola dĺžky preložených textov pre KBabel
+Name[sl]=Potrjevalnik dolžin prevedenih sporočil za KBabel
+Name[sr]=Оверивач дужине преведених порука за KBabel
+Name[sr@Latn]=Overivač dužine prevedenih poruka za KBabel
+Name[sv]=Validering av meddelandelängd för översättningar i Kbabel
+Name[ta]= Kபாபேலுக்கான மொழிபெயர்ப்பு செய்தி அளவு மதிப்பீட்டாளர்
+Name[tg]=Утилитаи тафтиши дарозии ахборҳои тарҷумакунанда барои KBabel
+Name[tr]=KBabel için Çevrilen Mesaj Uzunluk Kontrolü
+Name[uk]=Перевірка довжини перекладених фраз для KBabel
+Name[zh_CN]=KBabel 已翻译消息的长度检查器
+Name[zh_TW]=KBabel 的已翻譯訊息長度檢查器
+ValidationString=length checking
+X-KDE-Library=kbabel_lengthtool
+Type=Service
+Commands=validate
+Comment=Check Translated Message Length
+Comment[bg]=Проверка дължината на преведените съобщения
+Comment[bs]=Provjeri dužinu prevedenih poruka
+Comment[ca]=Comprova la llargària del missatge traduït
+Comment[cs]=Zkontrolovat délku přeložené zprávy
+Comment[cy]=Gwirio hyd neges wedi'i gyfieithu
+Comment[da]=Tjek oversat beskedlængde
+Comment[de]=Prüfung der übersetzten Nachrichtenlänge
+Comment[el]=Έλεγχος μήκους μεταφρασμένων μηνυμάτων
+Comment[eo]=Kontrolu longecon de tradukita mesaĝo
+Comment[es]=Comprobar longitud de los mensajes traducidos
+Comment[et]=Tõlgitud teate pikkuse kontroll
+Comment[eu]=Egiaztatu itzulitako mezuen luzera
+Comment[fa]=بررسی طول پیام ترجمه‌شده
+Comment[fi]=Tarkista käännetyn viestin pituus
+Comment[fr]=Vérifie la longueur des messages traduits
+Comment[gl]=Verificación do tamaño da mensaxe traducida
+Comment[hi]=अनूदित संदेश लंबाई जाँचें
+Comment[hu]=A lefordított üzenetek hosszának ellenőrzése
+Comment[is]=Athuga lengd þýddra skeyta
+Comment[it]=Controlla la lunghezza dei messaggi tradotti
+Comment[ja]=翻訳メッセージの長さを検証
+Comment[ka]=ნათარგმნი შეტყობინებების სიგრძის შემოწმება
+Comment[kk]=Аударылған жазулардың ұзындығын тексеру
+Comment[lt]=Tikrinti išverstų pranešimų ilgį
+Comment[nb]=Sjekk lengden på oversatte strenger
+Comment[nds]=Översett Textlängde pröven
+Comment[ne]=अनुबाद गरिएको सन्देश लम्बाइ जाँच गर्नुहोस्
+Comment[nl]=Lengte van vertaalde tekst controleren
+Comment[nn]=Sjekk lengda på omsette strengar
+Comment[pl]=Sprawdzenie długości przetłumaczonego komunikatu
+Comment[pt]=Verificação do Tamanho da Mensagem Traduzida
+Comment[pt_BR]=Verifica o Comprimento da Mensagem Traduzida
+Comment[ru]=Проверить длину переведённых сообщений
+Comment[sk]=Kontrola dĺžky preložených textov
+Comment[sl]=Preveri dolžino prevedenih sporočil
+Comment[sr]=Провери дужину преведених порука
+Comment[sr@Latn]=Proveri dužinu prevedenih poruka
+Comment[sv]=Kontrollera meddelandelängd för översättningar
+Comment[ta]= மொழிபெயர் செய்தி நீளம் சரிபார்ப்பு
+Comment[tg]=Тафтиш кардани дарозии хабарҳои тарҷумашуда
+Comment[tr]=Çevrilen Mesaj Uzunluğunu Denetle
+Comment[uk]=Перевірити довжину перекладених фраз
+Comment[zh_CN]=检查已翻译消息的长度
+Comment[zh_TW]=檢查已翻譯訊息長度
+ServiceTypes=KDataTool,KBabelValidator
+DataType=CatalogItem
+DataMimeTypes=application/x-kbabel-catalogitem
+ReadOnly=true
diff --git a/kbabel/datatools/length/main.cc b/kbabel/datatools/length/main.cc
new file mode 100644
index 00000000..ee595dc9
--- /dev/null
+++ b/kbabel/datatools/length/main.cc
@@ -0,0 +1,142 @@
+/* This file is part of KBabel
+ based Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
+ 2002 Stanislav Visnovsky <visnovsky@kde.org>
+ 2003 Dwayne Bailey <dwayne@translate.org.za>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+ In addition, as a special exception, the copyright holders give
+ permission to link the code of this program with any edition of
+ the Qt library by Trolltech AS, Norway (or with modified versions
+ of Qt that use the same license as Qt), and distribute linked
+ combinations including the two. You must obey the GNU General
+ Public License in all respects for all of the code used other than
+ Qt. If you modify this file, you may extend this exception to
+ your version of the file, but you are not obligated to do so. If
+ you do not wish to do so, delete this exception statement from
+ your version.
+
+*/
+
+#include <resources.h>
+#include "catalog.h"
+#include "catalogitem.h"
+#include "catalogsettings.h"
+#include "main.h"
+#include <math.h>
+
+#include <kconfig.h>
+#include <kdebug.h>
+#include <kgenericfactory.h>
+#include <klibloader.h>
+#include <klocale.h>
+#include <kmessagebox.h>
+
+/***************************************************
+ *
+ * Factory
+ *
+ ***************************************************/
+
+K_EXPORT_COMPONENT_FACTORY( kbabel_lengthtool, KGenericFactory<LengthTool> ( "kbabeldatatool" ) )
+
+using namespace KBabel;
+
+LengthTool::LengthTool( QObject* parent, const char* name, const QStringList & )
+ : KDataTool( parent, name ), _cache_origin( 0 )
+{
+ i18n("which check found errors","translation has inconsistent length");
+}
+
+bool LengthTool::run( const QString& command, void* data, const QString& datatype, const QString& mimetype )
+{
+
+ if ( command != "validate" )
+ {
+ kdDebug(KBABEL) << "Length Tool only accepts the 'validate' command" << endl;
+ kdDebug(KBABEL) << " The command " << command << " is not accepted" << endl;
+ return false;
+ }
+
+ // Check wether we can accept the data
+ if ( datatype != "CatalogItem" )
+ {
+ kdDebug(KBABEL) << "Length Tool only accept the CatalogItem datatype" << endl;
+ return false;
+ }
+
+ if ( mimetype != "application/x-kbabel-catalogitem" )
+ {
+ kdDebug(KBABEL) << "Length Tool only accept the 'application/x-kbabel-catalogitem' mimetype" << endl;
+ return false;
+ }
+
+ if( command == "validate" )
+ {
+
+ CatalogItem* item = (CatalogItem*)(data);
+ bool hasError = false;
+ QStringList str, id;
+
+ if(!item->isUntranslated()) {
+
+ if( _cache_origin != item->project() )
+ {
+ _context = item->project()->miscSettings().contextInfo;
+ _plurals = item->project()->miscSettings().singularPlural;
+ _cache_origin = item->project();
+ }
+
+ //Ensure KDE plural forms are in a StringList
+ if( item->pluralForm() == KDESpecific ) {
+ str = QStringList::split( "\\n", item->msgstr().first(), true );
+ id = QStringList::split( "\\n",
+ item->msgid().first().replace( QRegExp(_plurals), ""), true );
+ } else {
+ str = item->msgstr();
+ id = item->msgid();
+ }
+
+ //Check for translations that are too short or too long
+ //This may not be totally correct but we check both
+ //the singular and plural forms against each translated plural.
+ //FIXME: replace 10% check with configurable setting or a statistical
+ //based expected length relationship
+ int idlen, strlen;
+ for( QStringList::Iterator i = id.begin() ; i != id.end() ; i++ ) {
+ QString iditem = (*i);
+ idlen = iditem.replace( QRegExp(_context),"").length();
+ for( QStringList::Iterator j = str.begin() ; j != str.end() ; j++ ) {
+ QString stritem = (*j);
+ strlen = stritem.length();
+ hasError = hasError || (strlen < (0.1 * idlen))
+ || (strlen > (10 * idlen));
+ }
+ }
+
+ }
+
+ if(hasError)
+ item->appendError( "translation has inconsistant length" );
+ else
+ item->removeError( "translation has inconsistant length" );
+
+ return !hasError;
+ }
+ return false;
+}
+
+#include "main.moc"
diff --git a/kbabel/datatools/length/main.h b/kbabel/datatools/length/main.h
new file mode 100644
index 00000000..225c91ad
--- /dev/null
+++ b/kbabel/datatools/length/main.h
@@ -0,0 +1,54 @@
+/* This file is part of KBabel
+ based on Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
+ 2002 Stanislav Visnovsky <visnovsky@kde.org>
+ 2003 Dwayne Bailey <dwayne@translate.org.za>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+ In addition, as a special exception, the copyright holders give
+ permission to link the code of this program with any edition of
+ the Qt library by Trolltech AS, Norway (or with modified versions
+ of Qt that use the same license as Qt), and distribute linked
+ combinations including the two. You must obey the GNU General
+ Public License in all respects for all of the code used other than
+ Qt. If you modify this file, you may extend this exception to
+ your version of the file, but you are not obligated to do so. If
+ you do not wish to do so, delete this exception statement from
+ your version.
+
+*/
+
+#ifndef __main_h__
+#define __main_h__
+
+#include "kbproject.h"
+
+#include <kdatatool.h>
+
+class LengthTool : public KDataTool
+{
+ Q_OBJECT
+
+public:
+ LengthTool( QObject* parent, const char* name, const QStringList & );
+ virtual bool run( const QString& command, void* data, const QString& datatype, const QString& mimetype);
+private:
+ KBabel::Project::Ptr _cache_origin;
+ QRegExp _context;
+ QRegExp _plurals;
+};
+
+#endif
diff --git a/kbabel/datatools/length/test.po b/kbabel/datatools/length/test.po
new file mode 100644
index 00000000..d1bb209d
--- /dev/null
+++ b/kbabel/datatools/length/test.po
@@ -0,0 +1,46 @@
+# Test file to validate the length checking tool
+# Dwayne Bailey <dwayne@translate.org.za>, 2003
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: test\n"
+"Last-Translator: Dwayne Bailey <dwayne@translate.org.za>\n"
+"PO-Revision-Date: 2003-01-09 09:35+0200\n"
+"Language-Team: <english@translate.org.za>\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Generator: KBabel 1.2\n"
+
+# msgstr < 10% of msgid
+# Expected Result = error
+msgid "Some translation string"
+msgstr "aa"
+
+# msgstr > 10 * length of msgid
+# Expected Result = error
+msgid "Short"
+msgstr "Very long translation of a very short string. "
+"This should be picked up. Not really sure what a more"
+" correct approach might be."
+
+# Shortness test with KDE plural forms
+# Expected Result = error
+msgid ""
+"_n: Some translation string\n"
+"Second form %n"
+msgstr ""
+"aa\n"
+"Second form %n transaltion"
+
+# SHortness test with GNU plural forms
+# Expected Result = error
+msgid "Some translation string"
+msgid_plural "The second form %n"
+msgstr[0] "aa"
+msgstr[1] "Second for %n"
+
+# Shortness test with KDE context info
+# Expected Result = error
+msgid "_: Translation comment\n"
+"Some translation string"
+msgstr "aa"
diff --git a/kbabel/datatools/not-translated/Makefile.am b/kbabel/datatools/not-translated/Makefile.am
new file mode 100644
index 00000000..7ae7fe1c
--- /dev/null
+++ b/kbabel/datatools/not-translated/Makefile.am
@@ -0,0 +1,19 @@
+
+INCLUDES = -I$(srcdir)/../../common -I../../common $(all_includes)
+kbabel_nottranslatedtool_la_LIBADD = $(LIB_KIO) ../../common/libkbabelcommon.la
+
+####### Files
+
+kde_module_LTLIBRARIES = kbabel_nottranslatedtool.la
+
+kbabel_nottranslatedtool_la_SOURCES = main.cc
+
+kbabel_nottranslatedtool_la_LDFLAGS = $(all_libraries) -avoid-version -module -no-undefined
+
+noinst_HEADERS = main.h
+
+kbabel_nottranslatedtool_la_METASOURCES = AUTO
+
+service_DATA = kbabel_nottranslatedtool.desktop
+servicedir = $(kde_servicesdir)
+
diff --git a/kbabel/datatools/not-translated/kbabel_nottranslatedtool.desktop b/kbabel/datatools/not-translated/kbabel_nottranslatedtool.desktop
new file mode 100644
index 00000000..e3c267bf
--- /dev/null
+++ b/kbabel/datatools/not-translated/kbabel_nottranslatedtool.desktop
@@ -0,0 +1,97 @@
+[Desktop Entry]
+Name=Check for Translated Strings Containing English for KBabel
+Name[bg]=Проверка за преведени низове, съдържащи английски - KBabel
+Name[bs]=Provjera prevedenih stringova koji sadrže engleski za KBabel
+Name[ca]=Comprova per a KBabel les entrades traduïdes que contenen anglès
+Name[cs]=Vyhledat přeložené řetězce obsahující angličtinu
+Name[cy]=Gwirio am Linynnau wedi'u Cyfieithu sy'n Cynnwys Saesneg i KBabel
+Name[da]=Tjek for oversatte strenge der indeholder engelsk for KBabel
+Name[de]=Überprüfung übersetzter Texte, die Englisch enthalten, für KBabel
+Name[el]=Έλεγχος για μεταφρασμένα κείμενα που περιέχουν αγγλικά για το KBabel
+Name[es]=Comprobar cadenas traducidas con contenido en inglés para KBabel
+Name[et]=KBabeli inglise keelt sisaldavate tõlgitud teadete kontrollija
+Name[eu]=Bilatu ingeles hitzak itzulitako kateen artean KBabel-entzat
+Name[fa]=بررسی برای رشته‌های ترجمه‌شده حاوی انگلیسی برای KBabel
+Name[fi]=Englantia sisältävien merkkijonojen tarkistus KBabelissa
+Name[fr]=Vérifie si les chaînes traduites contiennent de l'anglais pour KBabel
+Name[gl]=Verificación de mensaxes traducidas que conteñan Inglés para KBabel
+Name[hu]=KBabel-eszköz angol nyelvű részek kereséséhez (a lefordított üzenetekben)
+Name[is]=Leita að þýddum strengjum sem innihalda ensku fyrir KBabel
+Name[it]=Controllo di stringhe tradotte contenenti inglese per KBabel
+Name[ja]=KBabel 翻訳文字列内の英語を検索
+Name[ka]=ინგლისურის შემცველი ნათარგმნი სტრიქონების შემოწმება KBabel-სთვის
+Name[kk]=KBabel аударылғанда ағылшын жазуы қалғанын тексеруі
+Name[lt]=KBabel išverstų pranešimų, kuriuose yra anglų kalbos žodžių, patikra
+Name[nb]=Sjekk for oversatte strenger som inneholder engelsk i KBabel
+Name[nds]=Prööv op översett Texten mit Engelsch dor binnen för KBabel
+Name[ne]=केब्याबलका लागि अनुबाद गरिएका अङ्ग्रेजी समाविष्ट स्ट्रिङहरूको जाँच
+Name[nl]=Controle op vertaalde tekst met Engelse termen voor KBabel
+Name[nn]=Sjekk for omsette strengar som inneheld engelsk i Kbabel
+Name[pl]=Sprawdzenie czy przetłumaczony komunikat zawiera angielskie słowa w KBabel
+Name[pt]=Verificação de Mensagens Traduzidas que Contenham Inglês para o KBabel
+Name[pt_BR]=Verifica por Strings Traduzidos Contendo Inglês para o KBabel
+Name[ru]=Проверка переведённых строк на равенство оригинальным для KBabel
+Name[sk]=Kontrola anglického textu v preklade pre KBabel
+Name[sl]=Preveri prevedene nize, ki vsebujejo angleščino; za KBabel
+Name[sr]=Провера за преведене низове знакова који садрже енглески за KBabel
+Name[sr@Latn]=Provera za prevedene nizove znakova koji sadrže engleski za KBabel
+Name[sv]=Kontrollera översatta strängar som innehåller engelska för Kbabel
+Name[ta]=கேபாபேலுக்கான ஆங்கில மொழிபெயர்ப்பு சரங்களை சோதிக்கவும்.
+Name[tg]=Тафтиши сатрҳои тарҷумашуда ба баробарии аслӣ барои KBabel
+Name[tr]=KBabel için İngilizce İhtiva Eden Çevrilen Dizgeler Denetimi
+Name[uk]=Перевірка перекладених фраз на вміст англійської для KBabel
+Name[zh_CN]=KBabel 检查已翻译字符串包含英语的工具
+Name[zh_TW]=KBabel 的檢查包含英文的已翻譯字串
+ValidationString=whitespace checking
+X-KDE-Library=kbabel_nottranslatedtool
+Type=Service
+Commands=validate
+Comment=Translations Containing English
+Comment[bg]=Низове, съдържащи английски
+Comment[bs]=Prijevodi koji sadrže engleski
+Comment[ca]=Traduccions que contenen l'anglès
+Comment[cs]=Překlady obsahující angličtinu
+Comment[cy]=Cyfieithiadau sy'n cynnwys Saesneg
+Comment[da]=Oversættelser der indeholder engelsk
+Comment[de]=Übersetzungen melden, die englischen Text enthalten
+Comment[el]=Μεταφράσεις που περιέχουν αγγλικά
+Comment[es]=Traducciones con contenido en inglés
+Comment[et]=Inglise keelt sisaldavad tõlked
+Comment[eu]=Inglesa duten itzulpenak
+Comment[fa]=ترجمه‌های حاوی انگلیسی
+Comment[fi]=Käännös sisältää englantia
+Comment[fr]=Traductions contenant de l'anglais
+Comment[gl]=Traducións que conteñen Inglés
+Comment[he]=תרגומים המכילים אנגלית
+Comment[hi]=अंग्रेज़ी युक्त अनुवाद
+Comment[hu]=Angol nyelvű részeket tartalmazó fordítások
+Comment[is]=Þýðingar sem innihalda ensku
+Comment[it]=Traduzioni contenenti inglese
+Comment[ja]=翻訳文字列内の英語を検索
+Comment[ka]=ინგლისურის შემცველი ნათარგმნი
+Comment[kk]=Аударылғанда ағылшын жазуы қалғанын тексеру
+Comment[lt]=Vertimai, kuriuose yra anglų kalbos žodžių
+Comment[nb]=Oversettelser som inneholder engelsk
+Comment[nds]=Op Engelsch binnen Översetten pröven
+Comment[ne]=अङ्ग्रेजी समाविष्ट अनुबाद
+Comment[nl]=Vertalingen die Engels bevatten controleren
+Comment[nn]=Omsetjingar som inneheld engelsk
+Comment[pa]=ਅੰਗਰੇਜ਼ੀ ਰੱਖਣ ਵਾਲੀ ਅਨੁਵਾਦ
+Comment[pl]=Sprawdzenie czy przetłumaczony komunikat zawiera angielskie słowa
+Comment[pt]=Traduções Que Contêm Inglês
+Comment[pt_BR]=Traduções Contendo Inglês
+Comment[ru]=Переводы, содержащие английский
+Comment[sk]=Preklady obsahujúce angličtinu
+Comment[sl]=Prevodi, ki vsebujo angleščino
+Comment[sr]=Преводи који садрже енглески
+Comment[sr@Latn]=Prevodi koji sadrže engleski
+Comment[sv]=Översättningar som innehåller engelska
+Comment[ta]= ஆங்கிலத்தின் மொழிபெயர்ப்பு
+Comment[tg]=Тарҷумаҳое, ки англисӣ доранд
+Comment[tr]=İngilizce İhtiva eden Çeviriler
+Comment[uk]=Переклади, які містять англійську
+Comment[zh_CN]=翻译包含英语
+Comment[zh_TW]=包含英文的翻譯
+ServiceTypes=KDataTool,KBabelValidator
+DataType=CatalogItem
+DataMimeTypes=application/x-kbabel-catalogitem
diff --git a/kbabel/datatools/not-translated/main.cc b/kbabel/datatools/not-translated/main.cc
new file mode 100644
index 00000000..1a53db41
--- /dev/null
+++ b/kbabel/datatools/not-translated/main.cc
@@ -0,0 +1,129 @@
+/* This file is part of KBabel
+ based Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
+ 2002 Stanislav Visnovsky <visnovsky@kde.org>
+ 2003 Dwayne Bailey <dwayne@translate.org.za>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+ In addition, as a special exception, the copyright holders give
+ permission to link the code of this program with any edition of
+ the Qt library by Trolltech AS, Norway (or with modified versions
+ of Qt that use the same license as Qt), and distribute linked
+ combinations including the two. You must obey the GNU General
+ Public License in all respects for all of the code used other than
+ Qt. If you modify this file, you may extend this exception to
+ your version of the file, but you are not obligated to do so. If
+ you do not wish to do so, delete this exception statement from
+ your version.
+
+*/
+
+#include <resources.h>
+#include "catalog.h"
+#include "catalogitem.h"
+#include "catalogsettings.h"
+#include "main.h"
+
+#include <kconfig.h>
+#include <kdebug.h>
+#include <kgenericfactory.h>
+#include <klibloader.h>
+#include <klocale.h>
+#include <kmessagebox.h>
+
+/***************************************************
+ *
+ * Factory
+ *
+ ***************************************************/
+
+K_EXPORT_COMPONENT_FACTORY( kbabel_nottranslatedtool, KGenericFactory<NotTranslatedTool> ( "kbabeldatatool" ) )
+
+using namespace KBabel;
+
+NotTranslatedTool::NotTranslatedTool( QObject* parent, const char* name, const QStringList & )
+ : KDataTool( parent, name ) , _cache_origin( 0 )
+{
+ i18n("which check found errors","English text in translation");
+}
+
+bool NotTranslatedTool::run( const QString& command, void* data, const QString& datatype, const QString& mimetype )
+{
+
+ if ( command != "validate" )
+ {
+ kdDebug(KBABEL) << "Not Translated Tool only accepts the 'validate' command" << endl;
+ kdDebug(KBABEL) << " The command " << command << " is not accepted" << endl;
+ return false;
+ }
+
+ // Check wether we can accept the data
+ if ( datatype != "CatalogItem" )
+ {
+ kdDebug(KBABEL) << "Not Translated Tool only accept the CatalogItem datatype" << endl;
+ return false;
+ }
+
+ if ( mimetype != "application/x-kbabel-catalogitem" )
+ {
+ kdDebug(KBABEL) << "Not Translated Tool only accept the 'application/x-kbabel-catalogitem' mimetype" << endl;
+ return false;
+ }
+
+ if( command == "validate" )
+ {
+ CatalogItem* item = (CatalogItem*)(data);
+ bool hasError = false;
+
+ if(!item->isUntranslated()) {
+ if( _cache_origin != item->project() )
+ {
+ _context = item->project()->miscSettings().contextInfo;
+ _plurals = item->project()->miscSettings().singularPlural;
+ _cache_origin = item->project();
+ }
+
+ //FIXME Expand this to do substring matching of non-translation
+ QStringList id, str;
+ if( item->pluralForm() == KDESpecific ) {
+ str = QStringList::split( "\\n", item->msgstr().first(), true );
+ id = QStringList::split( "\\n",
+ item->msgid().first().replace( QRegExp(_plurals), ""), true );
+ } else {
+ str = item->msgstr();
+ id = item->msgid();
+ }
+ for( QStringList::Iterator i = id.begin() ; i != id.end() ; i++ ) {
+ QString id_str = (*i).replace( QRegExp(_context), "");
+ for( QStringList::Iterator j = str.begin() ; j != str.end() ; j++ ) {
+ QString str_str = (*j);
+ hasError = hasError || ( id_str == str_str );
+ }
+ }
+
+ }
+
+ if(hasError)
+ item->appendError( "english text in translation" );
+ else
+ item->removeError( "english text in translation" );
+
+ return !hasError;
+ }
+ return false;
+}
+
+#include "main.moc"
diff --git a/kbabel/datatools/not-translated/main.h b/kbabel/datatools/not-translated/main.h
new file mode 100644
index 00000000..7386c4d8
--- /dev/null
+++ b/kbabel/datatools/not-translated/main.h
@@ -0,0 +1,55 @@
+/* This file is part of KBabel
+ based on Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
+ 2002 Stanislav Visnovsky <visnovsky@kde.org>
+ 2003 Dwayne Bailey <dwayne@translate.org.za>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+ In addition, as a special exception, the copyright holders give
+ permission to link the code of this program with any edition of
+ the Qt library by Trolltech AS, Norway (or with modified versions
+ of Qt that use the same license as Qt), and distribute linked
+ combinations including the two. You must obey the GNU General
+ Public License in all respects for all of the code used other than
+ Qt. If you modify this file, you may extend this exception to
+ your version of the file, but you are not obligated to do so. If
+ you do not wish to do so, delete this exception statement from
+ your version.
+
+*/
+
+#ifndef __main_h__
+#define __main_h__
+
+#include "kbproject.h"
+
+#include <kdatatool.h>
+
+class NotTranslatedTool : public KDataTool
+{
+ Q_OBJECT
+
+public:
+ NotTranslatedTool( QObject* parent, const char* name, const QStringList & );
+ virtual bool run( const QString& command, void* data, const QString& datatype, const QString& mimetype);
+
+private:
+ KBabel::Project::Ptr _cache_origin;
+ QRegExp _context;
+ QRegExp _plurals;
+};
+
+#endif
diff --git a/kbabel/datatools/not-translated/test.po b/kbabel/datatools/not-translated/test.po
new file mode 100644
index 00000000..5af47fc5
--- /dev/null
+++ b/kbabel/datatools/not-translated/test.po
@@ -0,0 +1,48 @@
+# translation of test.po to
+# Test file to validate the not-translted checking tool
+# Dwayne Bailey <dwayne@translate.org.za>, 2003
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: test-not-translated\n"
+"Last-Translator: Dwayne Bailey <dwayne@translate.org.za>\n"
+"PO-Revision-Date: 2003-01-09 09:35+0200\n"
+"Language-Team: <english@translate.org.za>\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Generator: KBabel 1.2\n"
+
+# msgid has not been translted but copied
+# Expected Result = error
+msgid "Same"
+msgstr "Same"
+
+# msgid has not been translted but copied
+# Expected Result = error
+msgid "Some translation string"
+msgstr "Some translation string"
+
+# msgstr contains a sentence that has not been translted
+# Expected Result = error
+msgid "The first sentence. A second sentence. Lastly a third."
+msgstr "Die eerste sin. A second sentence. Lastens 'n derde."
+
+# A same translation with context information
+# Expected Result = error
+msgid "_: Some context information\n"
+"Same"
+msgstr "Same"
+
+# A KDE plural form with the same translation
+# Expected Result == error
+msgid "_n: The first string\n"
+"The second string"
+msgstr "The first string\n"
+"The first string has not been translated"
+
+# A Gettext plural form with the same translation
+# Expected Result == error
+msgid "The first string"
+msgid_plural "The second string"
+msgstr[0] "The first string"
+msgstr[1] "The first string has not been translated"
diff --git a/kbabel/datatools/pluralforms/Makefile.am b/kbabel/datatools/pluralforms/Makefile.am
new file mode 100644
index 00000000..b7d50e80
--- /dev/null
+++ b/kbabel/datatools/pluralforms/Makefile.am
@@ -0,0 +1,19 @@
+
+INCLUDES = -I$(srcdir)/../../common -I../../common $(all_includes)
+kbabel_pluraltool_la_LIBADD = $(LIB_KIO) ../../common/libkbabelcommon.la
+
+####### Files
+
+kde_module_LTLIBRARIES = kbabel_pluraltool.la
+
+kbabel_pluraltool_la_SOURCES = main.cc
+
+kbabel_pluraltool_la_LDFLAGS = $(all_libraries) -avoid-version -module -no-undefined
+
+noinst_HEADERS = main.h
+
+kbabel_pluraltool_la_METASOURCES = AUTO
+
+service_DATA = kbabel_pluralformstool.desktop
+servicedir = $(kde_servicesdir)
+
diff --git a/kbabel/datatools/pluralforms/kbabel_pluralformstool.desktop b/kbabel/datatools/pluralforms/kbabel_pluralformstool.desktop
new file mode 100644
index 00000000..5d579994
--- /dev/null
+++ b/kbabel/datatools/pluralforms/kbabel_pluralformstool.desktop
@@ -0,0 +1,101 @@
+[Desktop Entry]
+Name=Plural Form Validation for KBabel
+Name[bg]=Валидност на мн. форми - KBabel
+Name[bs]=Provjera formi množine za KBabel
+Name[ca]=Validació de les formes plurals per a KBabel
+Name[cs]=Validace množného čísla
+Name[cy]=Dilysu Ffurf Lluosryw i KBabel
+Name[da]=Validering af flertalsformer for KBabel
+Name[de]=Pluralform-Überprüfung für KBabel
+Name[el]=Έλεγχος εγκυρότητας φορμών πληθυντικού για το KBabel
+Name[es]=Validación de formas plurales para KBabel
+Name[et]=KBabeli mitmusevormide kontrollija
+Name[eu]=Plural forma balidazioa KBabel-entzat
+Name[fa]=اعتبارسنجی شکل جمع برای KBabel
+Name[fi]=Monikkomuotojen tarkistus KBabelissa
+Name[fr]=Validation des formes plurielles pour KBabel
+Name[gl]=Validación de formas do plural para KBabel
+Name[hi]=के-बेबल के लिए बहुवचन फार्म वेलिडेशन
+Name[hu]=A többes szám ellenőrzése a KBabelben
+Name[is]=Staðfesting fleirtöluforma fyrir KBabel
+Name[it]=Convalida delle forme plurali per KBabel
+Name[ja]=KBabel 複数形検証
+Name[ka]=მრავლობითი ფორმების დამმოწმებელი KBabel-სთვის
+Name[kk]=KBabel-дың көптік жалғауын тексеруі
+Name[lt]=KBabel daugiskaitos formų patikros įrankis
+Name[ms]=Pengesahan Bentuk Jama' untuk KBabel
+Name[nb]=Sjekk flertallsformer i KBabel
+Name[nds]=Pluralformprööv för KBabel
+Name[ne]=केब्याबलका लागि बहुबचन प्रमाणीकरण
+Name[nl]=Meervoudsvormenvalidatie voor KBabel
+Name[nn]=Sjekk fleirtalsformer i KBabel
+Name[pl]=Sprawdzenie form liczby mnogiej w KBabel
+Name[pt]=Validação de Formas Plurais para o KBabel
+Name[pt_BR]=Validação de Formas Plurais para o KBabel
+Name[ru]=Проверка множественных форм для KBabel
+Name[sk]=Kontrola množných čísel pre KBabel
+Name[sl]=Potrjevalnik množinskih oblik za KBabel
+Name[sr]=Овера облика множине за KBabel
+Name[sr@Latn]=Overa oblika množine za KBabel
+Name[sv]=Validering av pluralformer för Kbabel
+Name[ta]= Kபாபேலலுக்கு தருமதிப்பு பன்மை வடிவம்
+Name[tg]=Тафтиши шаклҳои бисёр барои KBabel
+Name[tr]=KBabel için Çoklu Form Denetimi
+Name[uk]=Перевірка форм множини для KBabel
+Name[zh_CN]=KBabel 的复数形式检查器
+Name[zh_TW]=KBabel 的單複數型檢查器
+ValidationString=plural forms
+X-KDE-Library=kbabel_pluraltool
+Type=Service
+Commands=validate
+Comment=Check Plural Forms
+Comment[bg]=Проверка на мн. форми
+Comment[bs]=Provjeri forme množine
+Comment[ca]=Comprova les formes plurals
+Comment[cs]=Zkontrolovat množné číslo
+Comment[cy]=Gwirio Ffurfiau Lluosryw
+Comment[da]=Tjek flertalsformer
+Comment[de]=Überprüfung von Plural-Formen
+Comment[el]=Έλεγχος φορμών πληθυντικού
+Comment[es]=Comprobar formas plurales
+Comment[et]=Mitmuse vormide kontroll
+Comment[eu]=Egiaztatu plural formak
+Comment[fa]=بررسی شکلهای جمع
+Comment[fi]=Tarkista monikkomuodot
+Comment[fr]=Vérifie les formes plurielles
+Comment[gl]=Verificación de formas plurais
+Comment[he]=בודק מצבי רבים
+Comment[hi]=बहुवचन जाँचें
+Comment[hu]=A többes számú alakok ellenőrzése
+Comment[is]=Athuga fleirtöluform
+Comment[it]=Controlla forme plurali
+Comment[ja]=複数形を検証
+Comment[ka]=მრავლობითი ფორმების შემოწმება
+Comment[kk]=Көптік жалғауын тексеру
+Comment[lt]=Tikrinti daugiskaitos formas
+Comment[ms]=Periksa Bentuk Jama'
+Comment[nb]=Sjekk flertallsformer
+Comment[nds]=Pluralformen pröven
+Comment[ne]=बहुबचन जाँच गर्नुहोस्
+Comment[nl]=Meervoudsvormen controleren
+Comment[nn]=Sjekk fleirtalsformer
+Comment[pa]=ਬਹੁ-ਵਚਨ ਫਾਰਮ ਜਾਂਚ
+Comment[pl]=Sprawdzenie form liczby mnogiej
+Comment[pt]=Verificação de Formas Plurais
+Comment[pt_BR]=Verifica Formas Plurais
+Comment[ru]=Проверить множественные формы
+Comment[sk]=Kontrola množných čísel
+Comment[sl]=Preveri množinske oblike
+Comment[sr]=Провери облике множине
+Comment[sr@Latn]=Proveri oblike množine
+Comment[sv]=Kontrollera pluralformer
+Comment[ta]= சரிபார்ப்பு
+Comment[tg]=Тафтиш кардани шаклҳои бисёр
+Comment[tr]=Çoklu Formları denetle
+Comment[uk]=Перевірити форми множини
+Comment[zh_CN]=检查复数形式
+Comment[zh_TW]=檢查單複數型
+ServiceTypes=KDataTool,KBabelValidator
+DataType=CatalogItem
+DataMimeTypes=application/x-kbabel-catalogitem
+ReadOnly=true
diff --git a/kbabel/datatools/pluralforms/main.cc b/kbabel/datatools/pluralforms/main.cc
new file mode 100644
index 00000000..a534df6e
--- /dev/null
+++ b/kbabel/datatools/pluralforms/main.cc
@@ -0,0 +1,129 @@
+/* This file is part of KBabel
+ based Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
+ 2002 Stanislav Visnovsky <visnovsky@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+ In addition, as a special exception, the copyright holders give
+ permission to link the code of this program with any edition of
+ the Qt library by Trolltech AS, Norway (or with modified versions
+ of Qt that use the same license as Qt), and distribute linked
+ combinations including the two. You must obey the GNU General
+ Public License in all respects for all of the code used other than
+ Qt. If you modify this file, you may extend this exception to
+ your version of the file, but you are not obligated to do so. If
+ you do not wish to do so, delete this exception statement from
+ your version.
+
+*/
+
+#include <resources.h>
+#include "catalog.h"
+#include "catalogitem.h"
+#include "catalogsettings.h"
+#include "main.h"
+
+#include <kconfig.h>
+#include <kdebug.h>
+#include <kgenericfactory.h>
+#include <klibloader.h>
+#include <klocale.h>
+#include <kmessagebox.h>
+
+/***************************************************
+ *
+ * Factory
+ *
+ ***************************************************/
+
+K_EXPORT_COMPONENT_FACTORY( kbabel_pluraltool, KGenericFactory<PluralsTool> ( "kbabeldatatool" ) )
+
+using namespace KBabel;
+
+PluralsTool::PluralsTool( QObject* parent, const char* name, const QStringList & )
+ : KDataTool( parent, name ), _cache_origin( 0 ), _neededForms(-1)
+{
+ i18n("what check found errors", "plural forms");
+}
+
+bool PluralsTool::run( const QString& command, void* data, const QString& datatype, const QString& mimetype )
+{
+ if ( command != "validate" )
+ {
+ kdDebug(KBABEL) << "Plural Forms Tool does only accept the command 'validate' and 'shortcut'" << endl;
+ kdDebug(KBABEL) << " The commands " << command << " is not accepted" << endl;
+ return FALSE;
+ }
+
+ // Check wether we can accept the data
+ if ( datatype != "CatalogItem" )
+ {
+ kdDebug(KBABEL) << "Plural Forms Tool only accepts datatype CatalogItem" << endl;
+ return FALSE;
+ }
+
+ if ( mimetype != "application/x-kbabel-catalogitem" )
+ {
+ kdDebug(KBABEL) << "Plural Forms Tool only accepts mimetype application/x-kbabel-catalogitem" << endl;
+ return FALSE;
+ }
+
+ if( command == "validate" )
+ {
+ if( _neededForms < 0 )
+ {
+ Catalog* cat = new Catalog(this);
+ _neededForms = cat->defaultNumberOfPluralForms();
+ delete cat;
+ }
+
+ CatalogItem* item = (CatalogItem*)(data);
+
+ if( _cache_origin != item->project() )
+ {
+ _plurals = item->project()->miscSettings().singularPlural;
+ _cache_origin = item->project();
+ }
+
+ bool hasError = false;
+
+ if(!item->isUntranslated() && item->pluralForm() == KDESpecific )
+ {
+ if(_neededForms <= 0 || item->msgstr().first().contains(_plurals))
+ {
+ hasError = true;
+ }
+ else if( item->msgstr().first().contains(QString("\\n"))+1 != _neededForms )
+ {
+ hasError = true;
+ }
+ }
+
+ if(hasError)
+ {
+ item->appendError( "plural forms" );
+ }
+ else
+ {
+ item->removeError( "plural forms" );
+ }
+
+ return !hasError;
+ }
+ return FALSE;
+}
+
+#include "main.moc"
diff --git a/kbabel/datatools/pluralforms/main.h b/kbabel/datatools/pluralforms/main.h
new file mode 100644
index 00000000..1537f38f
--- /dev/null
+++ b/kbabel/datatools/pluralforms/main.h
@@ -0,0 +1,53 @@
+/* This file is part of KBabel
+ based on Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
+ 2002 Stanislav Visnovsky <visnovsky@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+ In addition, as a special exception, the copyright holders give
+ permission to link the code of this program with any edition of
+ the Qt library by Trolltech AS, Norway (or with modified versions
+ of Qt that use the same license as Qt), and distribute linked
+ combinations including the two. You must obey the GNU General
+ Public License in all respects for all of the code used other than
+ Qt. If you modify this file, you may extend this exception to
+ your version of the file, but you are not obligated to do so. If
+ you do not wish to do so, delete this exception statement from
+ your version.
+
+*/
+
+#ifndef __main_h__
+#define __main_h__
+
+#include "kbproject.h"
+
+#include <kdatatool.h>
+
+class PluralsTool : public KDataTool
+{
+ Q_OBJECT
+
+public:
+ PluralsTool( QObject* parent, const char* name, const QStringList & );
+ virtual bool run( const QString& command, void* data, const QString& datatype, const QString& mimetype);
+private:
+ KBabel::Project::Ptr _cache_origin;
+ QRegExp _plurals;
+ int _neededForms;
+};
+
+#endif
diff --git a/kbabel/datatools/punctuation/Makefile.am b/kbabel/datatools/punctuation/Makefile.am
new file mode 100644
index 00000000..5f00234c
--- /dev/null
+++ b/kbabel/datatools/punctuation/Makefile.am
@@ -0,0 +1,19 @@
+
+INCLUDES = -I$(srcdir)/../../common -I../../common $(all_includes)
+kbabel_punctuationtool_la_LIBADD = $(LIB_KIO) ../../common/libkbabelcommon.la
+
+####### Files
+
+kde_module_LTLIBRARIES = kbabel_punctuationtool.la
+
+kbabel_punctuationtool_la_SOURCES = main.cc
+
+kbabel_punctuationtool_la_LDFLAGS = $(all_libraries) -avoid-version -module -no-undefined
+
+noinst_HEADERS = main.h
+
+kbabel_punctuationtool_la_METASOURCES = AUTO
+
+service_DATA = kbabel_punctuationtool.desktop
+servicedir = $(kde_servicesdir)
+
diff --git a/kbabel/datatools/punctuation/kbabel_punctuationtool.desktop b/kbabel/datatools/punctuation/kbabel_punctuationtool.desktop
new file mode 100644
index 00000000..c24ff52e
--- /dev/null
+++ b/kbabel/datatools/punctuation/kbabel_punctuationtool.desktop
@@ -0,0 +1,101 @@
+[Desktop Entry]
+Name=Punctuation Validation for KBabel
+Name[bg]=Валидност на препинателните знаци - KBabel
+Name[bs]=Provjera znakova interpunkcije za KBabel
+Name[ca]=Validació de la puntuació per a KBabel
+Name[cs]=Validace interpunkce
+Name[cy]=Dilysiant Hafaliad i KBabel
+Name[da]=Godkendelse af tegnsætning i KBabel
+Name[de]=Interpunktions-Überprüfung für KBabel
+Name[el]=Έλεγχος εγκυρότητας στίξης για το KBabel
+Name[es]=Validación de puntuación para KBabel
+Name[et]=KBabeli kirjavahemärkide kontrollija
+Name[eu]=Puntuazio balidazioa KBabel-entzat
+Name[fa]=اعتبارسنجی نقطه‌گذاری برای KBabel
+Name[fi]=Välimerkkien tarkistus KBabelissa
+Name[fr]=Validation de ponctuation pour KBabel
+Name[ga]=Bailíochtú na Poncaíochta le haghaidh KBabel
+Name[gl]=Validación da puntuación para KBabel
+Name[hi]=के-बेबल के लिए विरामचिह्न वेलिडेशन
+Name[hu]=Írásjelellenőrző a KBabelhez
+Name[is]=Staðfesting greinamerkja fyrir KBabel
+Name[it]=Convalida della punteggiatura per KBabel
+Name[ja]=KBabel 句読点検証
+Name[ka]=პუნქტუაციის დამმოწმებელი KBabel-სთვის
+Name[kk]=KBabel-дың тыныс белгілерін тексеруі
+Name[lt]=KBabel skyrybos patikros įrankis
+Name[nb]=Sjekk tegnsetting i KBabel
+Name[nds]=Interpunkschoonprööv för KBabel
+Name[ne]=केब्याबलका लागि बिराम चिन्ह प्रमाणीकरण
+Name[nl]=Punctuatievalidatie voor KBabel
+Name[nn]=Sjekk teiknsetjing i KBabel
+Name[pl]=Sprawdzenie interpunkcji w KBabel
+Name[pt]=Validação de Pontuação para o KBabel
+Name[pt_BR]=Validação de Pontuação para o KBabel
+Name[ru]=Проверка пунктуации для KBabel
+Name[sk]=Kontrola interpunkcie pre KBabel
+Name[sl]=Potrjevalnik ločil za KBabel
+Name[sr]=Овера интерпункције за KBabel
+Name[sr@Latn]=Overa interpunkcije za KBabel
+Name[sv]=Validering av skiljetecken för Kbabel
+Name[ta]= Kபாபேலுக்கு தருமதிப்பு குறிகள்
+Name[tg]=Тафтиши пунктуатсия барои KBabel
+Name[tr]=KBabel için Noktalama denetimi
+Name[uk]=Перевірка пунктуації для KBabel
+Name[zh_CN]=KBabel 的标点检查器
+Name[zh_TW]=KBabel 的標點檢查器
+ValidationString=accelerator
+X-KDE-Library=kbabel_punctuationtool
+Type=Service
+Commands=validate
+Comment=Check Punctuation
+Comment[bg]=Проверка на препинателните знаци
+Comment[bs]=Provjeri interpunkciju
+Comment[ca]=Comprova la puntuació
+Comment[cs]=Zkontrolovat interpunkci
+Comment[cy]=Gwirio Hafaliadau
+Comment[da]=Tjek tegnsætning
+Comment[de]=Prüfung der Interpunktion in Übersetzungen
+Comment[el]=Έλεγχος στίξης
+Comment[es]=Comprobar puntuación
+Comment[et]=Kirjavahemärkide kontroll
+Comment[eu]=Egiaztatu puntuazioa
+Comment[fa]=بررسی نقطه‌سنجی
+Comment[fi]=Tarkista välimerkit
+Comment[fr]=Vérifie la ponctuation
+Comment[ga]=Seiceáil Poncaíocht
+Comment[gl]=Verifica a puntuación
+Comment[he]=בודק ניקוד
+Comment[hi]=विरामचिह्न जांच करें
+Comment[hu]=Az írásjelek ellenőrzése
+Comment[is]=Athuga greinamerki
+Comment[it]=Controlla punteggiatura
+Comment[ja]=句読点を検証
+Comment[ka]=პუნქტუაციის შემოწმება
+Comment[kk]=Тыныс белгілерін тексеру
+Comment[lt]=Tikrinti skyrybą
+Comment[nb]=Sjekk tegnsetting
+Comment[nds]=Interpunkschoon pröven
+Comment[ne]=बिराम चिन्ह जाँच गर्नुहोस्
+Comment[nl]=Punctuatie controleren
+Comment[nn]=Sjekk teiknsetjing
+Comment[pl]=Sprawdzenie interpunkcji
+Comment[pt]=Verifica a pontuação
+Comment[pt_BR]=Verifica Pontuação
+Comment[ru]=Проверить пунктуацию
+Comment[sk]=Kontrola interpunkcie
+Comment[sl]=Preveri ločila
+Comment[sr]=Провери интерпункцију
+Comment[sr@Latn]=Proveri interpunkciju
+Comment[sv]=Kontrollera skiljetecken
+Comment[ta]= நிறுத்தக்குறியிடுதல் சரிபார்ப்பு
+Comment[tg]=Тафтиш кардани пунктуатсия
+Comment[tr]=Noktalama Denetimi
+Comment[uk]=Перевірити пунктуацію
+Comment[zh_CN]=检查标点
+Comment[zh_TW]=檢查標點
+Shortcuts=Ctrl+P
+ServiceTypes=KBabelValidator,KDataTool
+DataType=CatalogItem
+DataMimeTypes=application/x-kbabel-catalogitem
+ReadOnly=true
diff --git a/kbabel/datatools/punctuation/main.cc b/kbabel/datatools/punctuation/main.cc
new file mode 100644
index 00000000..bd4f4107
--- /dev/null
+++ b/kbabel/datatools/punctuation/main.cc
@@ -0,0 +1,157 @@
+/* This file is part of KBabel
+ based Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
+ 2003 Stanislav Visnovsky <visnovsky@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+ In addition, as a special exception, the copyright holders give
+ permission to link the code of this program with any edition of
+ the Qt library by Trolltech AS, Norway (or with modified versions
+ of Qt that use the same license as Qt), and distribute linked
+ combinations including the two. You must obey the GNU General
+ Public License in all respects for all of the code used other than
+ Qt. If you modify this file, you may extend this exception to
+ your version of the file, but you are not obligated to do so. If
+ you do not wish to do so, delete this exception statement from
+ your version.
+
+*/
+
+#include <resources.h>
+#include "catalogitem.h"
+#include "catalogsettings.h"
+#include "main.h"
+
+#include <kconfig.h>
+#include <kdebug.h>
+#include <kgenericfactory.h>
+#include <klibloader.h>
+#include <klocale.h>
+
+/***************************************************
+ *
+ * Factory
+ *
+ ***************************************************/
+
+K_EXPORT_COMPONENT_FACTORY( kbabel_punctuationtool, KGenericFactory<PunctuationTool> ( "kbabeldatatool" ) )
+
+using namespace KBabel;
+
+PunctuationTool::PunctuationTool( QObject* parent, const char* name, const QStringList & )
+ : KDataTool( parent, name )
+{
+ // bogus translation just for allowing the translation
+ i18n("what check found errors","punctuation");
+}
+
+bool PunctuationTool::run( const QString& command, void* data, const QString& datatype, const QString& mimetype )
+{
+ if ( command != "validate" )
+ {
+ kdDebug(KBABEL) << "Punctuation Tool does only accept the command 'validate'" << endl;
+ kdDebug(KBABEL) << " The commands " << command << " is not accepted" << endl;
+ return FALSE;
+ }
+
+ // Check wether we can accept the data
+ if ( datatype != "CatalogItem" )
+ {
+ kdDebug(KBABEL) << "Punctuation Tool only accepts datatype CatalogItem" << endl;
+ return FALSE;
+ }
+
+ if ( mimetype != "application/x-kbabel-catalogitem" )
+ {
+ kdDebug(KBABEL) << "Punctuation Tool only accepts mimetype application/x-kbabel-catalogitem" << endl;
+ return FALSE;
+ }
+
+ if( command == "validate" )
+ {
+ CatalogItem* item = (CatalogItem*)(data);
+
+ bool hasError = false;
+
+ if(!item->isUntranslated())
+ {
+ QString lineid=item->msgid().first();
+
+ // lookup punctuation in original text
+ QRegExp punc("[\\.!\\?:]+$");
+ int i = lineid.find(punc);
+
+ QString t("");
+
+ if( i != -1 ) t = lineid.right(lineid.length()-i);
+
+ if( item->pluralForm() != NoPluralForm )
+ {
+ // check, that both plural forms contain the same punctuation
+ QString pl = *(item->msgid().at(1));
+ int j = pl.find(punc);
+
+ QString tp("");
+ if( j != -1 ) tp = pl.right(pl.length()-j);
+
+ if( tp != t )
+ {
+ kdWarning() << "Singular and plural form do not have the same punctuation" << endl;
+ }
+ }
+
+ QStringList forms = item->msgstr(true);
+ if( item->pluralForm() == KDESpecific ) {
+ forms = QStringList::split("\\n",*item->msgstr(true).at(0));
+ }
+
+ for( QStringList::Iterator form = forms.begin() ; form != forms.end(); form++ )
+ {
+ QString linestr=(*form);
+
+ int j = linestr.find(punc);
+
+ // there is no punctuation in original, but one in the translation
+ if( i == -1 && j != i )
+ {
+ hasError = true;
+ break;
+ }
+
+ // there is punctuation in original, but not same as in the translation
+ if( i != -1 && linestr.right(linestr.length()-j) != t )
+ {
+ hasError = true;
+ break;
+ }
+ }
+ }
+
+ if(hasError)
+ {
+ item->appendError( "punctuation" );
+ }
+ else
+ {
+ item->removeError( "punctuation" );
+ }
+
+ return !hasError;
+ }
+ return FALSE;
+}
+
+#include "main.moc"
diff --git a/kbabel/datatools/punctuation/main.h b/kbabel/datatools/punctuation/main.h
new file mode 100644
index 00000000..c0c68518
--- /dev/null
+++ b/kbabel/datatools/punctuation/main.h
@@ -0,0 +1,47 @@
+/* This file is part of KBabel
+ based on Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
+ 2003 Stanislav Visnovsky <visnovsky@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+ In addition, as a special exception, the copyright holders give
+ permission to link the code of this program with any edition of
+ the Qt library by Trolltech AS, Norway (or with modified versions
+ of Qt that use the same license as Qt), and distribute linked
+ combinations including the two. You must obey the GNU General
+ Public License in all respects for all of the code used other than
+ Qt. If you modify this file, you may extend this exception to
+ your version of the file, but you are not obligated to do so. If
+ you do not wish to do so, delete this exception statement from
+ your version.
+
+*/
+
+#ifndef __main_h__
+#define __main_h__
+
+#include <kdatatool.h>
+
+class PunctuationTool : public KDataTool
+{
+ Q_OBJECT
+
+public:
+ PunctuationTool( QObject* parent, const char* name, const QStringList & );
+ virtual bool run( const QString& command, void* data, const QString& datatype, const QString& mimetype);
+};
+
+#endif
diff --git a/kbabel/datatools/regexp/Makefile.am b/kbabel/datatools/regexp/Makefile.am
new file mode 100644
index 00000000..e727ca25
--- /dev/null
+++ b/kbabel/datatools/regexp/Makefile.am
@@ -0,0 +1,21 @@
+
+INCLUDES = -I$(srcdir)/../../common -I../../common $(all_includes)
+kbabel_regexptool_la_LIBADD = $(LIB_KIO) ../../common/libkbabelcommon.la
+
+####### Files
+
+kde_module_LTLIBRARIES = kbabel_regexptool.la
+
+kbabel_regexptool_la_SOURCES = main.cc
+
+kbabel_regexptool_la_LDFLAGS = $(all_libraries) -avoid-version -module -no-undefined
+
+noinst_HEADERS = main.h
+
+kbabel_regexptool_la_METASOURCES = AUTO
+
+service_DATA = kbabel_regexptool.desktop
+servicedir = $(kde_servicesdir)
+
+regexp_DATA = regexplist.xml
+regexpdir = $(kde_datadir)/kbabel
diff --git a/kbabel/datatools/regexp/kbabel_regexptool.desktop b/kbabel/datatools/regexp/kbabel_regexptool.desktop
new file mode 100644
index 00000000..dbd84491
--- /dev/null
+++ b/kbabel/datatools/regexp/kbabel_regexptool.desktop
@@ -0,0 +1,92 @@
+[Desktop Entry]
+Name=Catalan Grammar
+Name[br]=Yezhadur gatalaneg
+Name[ca]=Gramàtica catalana
+Name[cs]=Katalánská gramatika
+Name[da]=Katalansk grammatik
+Name[de]=Katalanische Grammatik
+Name[el]=Γραμματική καταλανικών
+Name[eo]=Kataluna Gramatiko
+Name[es]=Gramática catalana
+Name[et]=Katalaani grammatika
+Name[eu]=Katalanaren gramatika
+Name[fa]=دستور زبان کاتالان
+Name[fi]=Katalaanin kielioppi
+Name[fr]=Grammaire du catalan
+Name[ga]=Gramadach na Catalóinise
+Name[gl]=Gramática catalá
+Name[he]=תחברי קטאלני
+Name[hu]=Katalán nyelvtan
+Name[is]=Katalónsk málfræði
+Name[it]=Grammatica catalana
+Name[ja]=カタロニア文節
+Name[ka]=კატალანური გრამატიკა
+Name[kk]=Каталон грамматикасы
+Name[lt]=Katalonų gramatika
+Name[nb]=Katalansk grammatikk
+Name[nds]=Katalaansch Grammatik
+Name[ne]=क्याटालान ब्याकरण
+Name[nl]=Catalaanse grammatica
+Name[nn]=Katalansk grammatikk
+Name[pa]=ਕਾਟਾਲਾਨ ਗਰਾਮਰ
+Name[pl]=Gramatyka katalońska
+Name[pt]=Gramática Catalã
+Name[pt_BR]=Gramática Catalã
+Name[ru]=Каталонская гамматика
+Name[sk]=Katalánska gramatika
+Name[sl]=katalonska slovnica
+Name[sr]=Каталонијска граматика
+Name[sr@Latn]=Katalonijska gramatika
+Name[sv]=Katalansk grammatik
+Name[tr]=Katalan Dil Bilgisi
+Name[uk]=Каталонська граматика
+Name[zh_CN]=Catalan 语法
+Name[zh_TW]=Catalan 文法
+ValidationString=external script checking
+X-KDE-Library=kbabel_regexptool
+Type=Service
+Commands=validate
+Comment=Check Translated Messages with a set of Regular Expressions
+Comment[bg]=Проверка на преведените съобщения с регулярни изрази
+Comment[ca]=Comprova els missatges traduïts amb un conjunt d'expressions regulars
+Comment[cs]=Zkontrolovat přeložené zprávy pomocí sady reg. výrazů
+Comment[da]=Tjek oversat besked med et sæt regulære udtryk
+Comment[de]=Überprüfung übersetzter Meldungen mit einem Satz regulärer Ausdrücke
+Comment[el]=Έλεγχος μεταφρασμένων μηνυμάτων με ένα σύνολο κανονικών εκφράσεων
+Comment[eo]=Kontroli tradukitajn mesaĝojn per aro da regulesprimoj
+Comment[es]=Comprobar mensajes traducidos mediante un juego de expresiones regulares
+Comment[et]=Tõlgitud teate kontroll regulaaravaldistega
+Comment[eu]=Egiaztatu itzulitako mezuak espresio erregular sorta batekin
+Comment[fa]=بررسی پیامهای ترجمه‌شده توسط مجموعه‌ای از عبارتهای منظم
+Comment[fi]=Tarkista käännetyt viestit säännöllisten lausekkeiden avulla
+Comment[fr]=Vérifie les messages traduits avec un jeu d'expressions rationnelles
+Comment[gl]=Verificación das mensaxes traducidas cun conxunto de expresións regulares
+Comment[hu]=A lefordított üzenetek ellenőrzése reguláris kifejezésekkel
+Comment[is]=Athuga þýdd skilaboð með reglulegum segðum
+Comment[it]=Controlla i messaggi tradotti con un insieme di espressioni regolari
+Comment[ja]=正規表現を用いて翻訳メッセージを検証
+Comment[ka]=რეგულარული გამოსახულებების შეცველი ნათარგმნი შეტყობინებების შემოწმება
+Comment[kk]=Аударылған жазуларды үлгі өрнегімен тексеру
+Comment[lt]=Tikrinti išverstus pranešimus panaudojant įprastųjų išraiškų rinkinį
+Comment[nb]=Sjekk oversatte strenger med et sett regulære uttrykk
+Comment[nds]=Översett Mellen mit en Sett vun regulere Utdrück pröven
+Comment[ne]=नियमित अभिव्यक्तिका सेट भएका अनुबाद गरिएका सन्देशको जाँच गर्नुहोस्
+Comment[nl]=Vertaalde tekst controleren met behulp van reguliere expressies
+Comment[nn]=Sjekk omsette strengar med eit sett regulære uttrykk
+Comment[pl]=Sprawdzenie przetłumaczonych komunikatów za pomocą zestawu wyrażeń regularnych
+Comment[pt]=Verificação das Mensagens Traduzidas com um Conjunto de Expressões Regulares
+Comment[pt_BR]=Verificação das Mensagens Traduzidas com um Conjunto de Expressões Regulares
+Comment[ru]=Проверить переведенных сообщения по регулярному выражению
+Comment[sk]=Kontrola preložených textov pomocou sady regulárnych výrazov
+Comment[sl]=Preveri prevedena sporočila z naborom regularnih izrazov
+Comment[sr]=Провери преведене поруке скупом регуларних израза
+Comment[sr@Latn]=Proveri prevedene poruke skupom regularnih izraza
+Comment[sv]=Kontrollera översatta meddelanden med en uppsättning reguljära uttryck
+Comment[tr]=Bir Düzgün Anlatım grubu ile birlikte çevrilen mesajları denetle
+Comment[uk]=Перевірити перекладені фрази за допомогою набору формальних виразів
+Comment[zh_CN]=用一组正则表达式检查已翻译消息
+Comment[zh_TW]=利用正規表示式檢查已翻譯訊息
+ServiceTypes=KDataTool,KBabelValidator
+DataType=CatalogItem
+DataMimeTypes=application/x-kbabel-catalogitem
+ReadOnly=true
diff --git a/kbabel/datatools/regexp/main.cc b/kbabel/datatools/regexp/main.cc
new file mode 100644
index 00000000..4464170d
--- /dev/null
+++ b/kbabel/datatools/regexp/main.cc
@@ -0,0 +1,181 @@
+/* Copyright (C) 2005 Albert Cervera i Areny <albertca at hotpop dot com>
+
+ Based on Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
+ 2002 Stanislav Visnovsky <visnovsky@kde.org>
+ 2003 Dwayne Bailey <dwayne@translate.org.za>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#include <resources.h>
+#include "catalog.h"
+#include "catalogitem.h"
+#include "catalogsettings.h"
+#include "main.h"
+#include <math.h>
+
+#include <qdir.h>
+#include <qfile.h>
+#include <qdom.h>
+#include <qstringlist.h>
+#include <qregexp.h>
+#include <kconfig.h>
+#include <kdebug.h>
+#include <kgenericfactory.h>
+#include <klibloader.h>
+#include <klocale.h>
+#include <kmessagebox.h>
+
+/***************************************************
+ *
+ * Factory
+ *
+ ***************************************************/
+
+K_EXPORT_COMPONENT_FACTORY( kbabel_regexptool, KGenericFactory<RegExpTool> ( "kbabeldatatool" ) )
+
+using namespace KBabel;
+
+RegExpTool::RegExpTool( QObject* parent, const char* name, const QStringList & )
+ : KDataTool( parent, name )
+{
+ i18n("which check found errors","translation has inconsistent length");
+ loadExpressions();
+ if ( ! _error.isNull() )
+ KMessageBox::error( (QWidget*)parent, i18n( "Error loading data (%1)" ).arg( _error ) );
+}
+
+bool RegExpTool::run( const QString& command, void* data, const QString& datatype, const QString& mimetype )
+{
+ if ( command != "validate" )
+ {
+ kdDebug(KBABEL) << "RegExpTool only accepts the 'validate' command" << endl;
+ kdDebug(KBABEL) << " The command " << command << " is not accepted" << endl;
+ return false;
+ }
+ // Check wether we can accept the data
+ if ( datatype != "CatalogItem" )
+ {
+ kdDebug(KBABEL) << "RegExpTool only accepts the CatalogItem datatype" << endl;
+ return false;
+ }
+ if ( mimetype != "application/x-kbabel-catalogitem" )
+ {
+ kdDebug(KBABEL) << "RegExpTool only accepts the 'application/x-kbabel-catalogitem' mimetype" << endl;
+ return false;
+ }
+
+ bool hasError = false;
+ if( command == "validate" )
+ {
+ CatalogItem* item = (CatalogItem*)(data);
+
+ if(!item->isUntranslated()) {
+ ExpressionList::Iterator it( _list.begin() );
+ ExpressionList::Iterator end( _list.end() );
+ QStringList msgs = item->msgstr();
+ QStringList results;
+ for ( ; it != end; ++it ) {
+ results.clear();
+ results = msgs.grep( (*it).regExp() );
+ if ( results.size() > 0 ) {
+ hasError = true;
+ break;
+ }
+ }
+ }
+ if(hasError) {
+ item->appendError( "regexp" );
+ } else {
+ item->removeError( "regexp" );
+ }
+ }
+ return !hasError;
+}
+
+
+void RegExpTool::loadExpressions()
+{
+ // TODO: Change file path
+ QFile file( QDir::homeDirPath() + "/.kde/share/apps/kbabel/regexplist.xml" );
+ QDomDocument doc;
+
+ if ( ! file.open( IO_ReadOnly ) ) {
+ kdDebug() << "File not found" << endl;
+ _error = i18n( "File not found" );
+ return;
+ }
+ if ( ! doc.setContent( &file ) ) {
+ kdDebug() << "Could not set content of xml file" << endl;
+ _error = i18n( "The file is not a XML" );
+ return;
+ }
+ file.close();
+
+ QDomElement docElem = doc.documentElement();
+ QDomNode n = docElem.firstChild();
+ while( !n.isNull() ) {
+ QDomElement e = n.toElement();
+ if( !e.isNull() )
+ elementToExpression( e );
+ if ( ! _error.isNull() )
+ break;
+ n = n.nextSibling();
+ }
+}
+
+void RegExpTool::elementToExpression( const QDomElement& e )
+{
+ QString name;
+ QString exp;
+ bool cs = false; //Expressions are case insensitive by default
+
+ if ( e.tagName().compare( "item" ) != 0 ) {
+ _error = i18n( "Expected tag 'item'" );
+ return;
+ }
+
+ QDomNode n = e.firstChild();
+ if ( n.isNull() ) {
+ _error = i18n( "First child of 'item' is not a node" );
+ return;
+ }
+
+ QDomElement el = n.toElement();
+ if ( el.isNull() || el.tagName().compare( "name" ) != 0 ) {
+ _error = i18n( "Expected tag 'name'" );
+ return;
+ }
+ name = el.text();
+
+ n = n.nextSibling();
+ el = n.toElement();
+ if ( el.isNull() || el.tagName().compare( "exp" ) != 0 ) {
+ _error = i18n( "Expected tag 'exp'" );
+ return;
+ }
+ exp = el.text();
+
+ n = n.nextSibling();
+ el = n.toElement();
+ if ( ! el.isNull() )
+ cs = true;
+
+ kdDebug(KBABEL) << "RegExpTool: Adding expression: " << name << endl;
+ _list.append( Expression( name, QRegExp( exp, cs ) ) );
+}
+
+#include "main.moc"
diff --git a/kbabel/datatools/regexp/main.h b/kbabel/datatools/regexp/main.h
new file mode 100644
index 00000000..690c5769
--- /dev/null
+++ b/kbabel/datatools/regexp/main.h
@@ -0,0 +1,73 @@
+/*
+ Copyright (C) 2005 Albert Cervera i Areny <albertca at hotpop dot com>
+
+ Based on Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
+ 2002 Stanislav Visnovsky <visnovsky@kde.org>
+ 2003 Dwayne Bailey <dwayne@translate.org.za>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#ifndef __main_h__
+#define __main_h__
+
+#include <kdatatool.h>
+#include <qvaluelist.h>
+
+class QDomElement;
+
+class Expression
+{
+public:
+ Expression() {};
+ Expression( const QString& name, const QRegExp& regExp )
+ {
+ _name = name;
+ _regExp = regExp;
+ }
+ const QString& name() const
+ {
+ return _name;
+ }
+ const QRegExp& regExp() const
+ {
+ return _regExp;
+ }
+
+private:
+ QString _name;
+ QRegExp _regExp;
+};
+
+typedef QValueList<Expression> ExpressionList;
+
+class RegExpTool : public KDataTool
+{
+ Q_OBJECT
+
+public:
+ RegExpTool( QObject* parent, const char* name, const QStringList & );
+ virtual bool run( const QString& command, void* data, const QString& datatype, const QString& mimetype);
+
+private:
+ void loadExpressions();
+ void elementToExpression( const QDomElement& e );
+
+ ExpressionList _list;
+ QString _error;
+};
+
+#endif
diff --git a/kbabel/datatools/regexp/regexplist.xml b/kbabel/datatools/regexp/regexplist.xml
new file mode 100644
index 00000000..1cd0b23d
--- /dev/null
+++ b/kbabel/datatools/regexp/regexplist.xml
@@ -0,0 +1,303 @@
+<!--
+ This file contains the list of regular expressions the plugin should check for.
+ Please, follow this syntax:
+ <regexplist>
+ <item>
+ <name></name>
+ <exp></exp>
+ <cs/> (only when the expression needs to be case sensitive)
+ </item>
+ ...
+ </regexplist>
+
+ Right now the file should be copied to ~/.kde/share/apps/kbabel/regexplist.xml. I'm sorry this cannot be configured but hope it will in the future. By the time if you need another location you have to modify the source code (main.cc)
+
+ You'll see in the example that most expressions start with '(^| |\\t)+' and then a word. This is to ensure it _is_ a word. Using the usual expressions to ensure we pick up a whole word doesn't work for the catalan language. Anyway, if you need to match a tab be sure you use the '\\t' expression.
+
+ Right now names in expressions aren't much useful, but I aim to modify kbabel in order to give more information about the error found. And I will probably add a description tag to enable long explanations of the mistake.
+
+ Also note the syntax of the file is quite strict. Mmmmm... too many words without a joke, this really doesn't seem to be open source :(
+ -->
+
+<regexplist>
+ <item>
+ <name>_el_ seguit de vocal</name>
+ <exp>(^| |\\t)+el +[a,e,i,o,u][a-z]+</exp>
+ </item>
+ <item>
+ <name>_la_ seguit de a,e,o</name>
+ <exp>(^| |\\t)+la +[a,e,o][a-z]+</exp>
+ </item>
+ <item>
+ <name>_per el_</name>
+ <exp>(^| |\\t)+per +el( |\\t|$)+</exp>
+ </item>
+ <item>
+ <name>_per els_</name>
+ <exp>(^| |\\t)+per +els( |\\t|$)+</exp>
+ </item>
+ <item>
+ <name>_de el_</name>
+ <exp>(^| |\\t)+de +el( |\\t|$)+</exp>
+ </item>
+ <item>
+ <name>_de els_</name>
+ <exp>(^| |\\t)+de +els( |\\t|$)+</exp>
+ </item>
+ <item>
+ <name>_a el_</name>
+ <exp>(^| |\\t)+a +el( |\\t|$)+</exp>
+ </item>
+ <item>
+ <name>_a els_</name>
+ <exp>(^| |\\t)+a +els( |\\t|$)+</exp>
+ </item>
+ <item>
+ <name>_al_ seguit de vocal</name>
+ <exp>(^| |\\t)+al +[a,e,i,o,u][a-z]+</exp>
+ </item>
+ <item>
+ <name>m'els</name>
+ <exp>(^| |\\t)m'els( |\\t|$)+</exp>
+ </item>
+ <item>
+ <name>mels</name>
+ <exp>(^| |\\t)mels( |\\t|$)+</exp>
+ </item>
+ <item>
+ <name>s'el</name>
+ <exp>(^| |\\t)s'el( |\\t|$)+</exp>
+ </item>
+ <item>
+ <name>sel</name>
+ <exp>(^| |\\t)sel( |\\t|$)+</exp>
+ </item>
+ <item>
+ <name>s'els</name>
+ <exp>(^| |\\t)s'els( |\\t|$)+</exp>
+ </item>
+ <item>
+ <name>sels</name>
+ <exp>(^| |\\t)sels( |\\t|$)+</exp>
+ </item>
+ <item>
+ <name>s'em</name>
+ <exp>(^| |\\t)s'em( |\\t|$)+</exp>
+ </item>
+ <item>
+ <name>sem</name>
+ <exp>(^| |\\t)sem( |\\t|$)+</exp>
+ </item>
+ <item>
+ <name>s'hem</name>
+ <exp>(^| |\\t)s'hem( |\\t|$)+</exp>
+ </item>
+ <item>
+ <name>s'ens</name>
+ <exp>(^| |\\t)s'ens( |\\t|$)+</exp>
+ </item>
+ <item>
+ <name>s'et</name>
+ <exp>(^| |\\t)s'et( |\\t|$)+</exp>
+ </item>
+ <item>
+ <name>susa</name>
+ <exp>(^| |\\t)susa( |\\t|$)+</exp>
+ </item>
+ <item>
+ <name>s'us</name>
+ <exp>(^| |\\t)s'us( |\\t|$)+</exp>
+ </item>
+ <item>
+ <name>su's</name>
+ <exp>(^| |\\t)su's( |\\t|$)+</exp>
+ </item>
+ <item>
+ <name>t'els</name>
+ <exp>(^| |\\t)t'els( |\\t|$)+</exp>
+ </item>
+ <item>
+ <name>t'el</name>
+ <exp>(^| |\\t)t'el( |\\t|$)+</exp>
+ </item>
+ <item>
+ <name>t'em</name>
+ <exp>(^| |\\t)t'em( |\\t|$)+</exp>
+ </item>
+ <item>
+ <name>t'ens</name>
+ <exp>(^| |\\t)t'ens( |\\t|$)+</exp>
+ </item>
+ <item>
+ <name>t'en</name>
+ <exp>(^| |\\t)t'en( |\\t|$)+</exp>
+ </item>
+ <item>
+ <name>ten</name>
+ <exp>(^| |\\t)ten( |\\t|$)+</exp>
+ </item>
+ <item>
+ <name>t'ens</name>
+ <exp>(^| |\\t)t'ens( |\\t|$)+</exp>
+ </item>
+ <item>
+ <name>vos sense accent</name>
+ <exp>(^| |\\t)vos( |\\t|$)</exp>
+ </item>
+ <item>
+ <name>Terminal s mascul (si es tracta d'informtica): el terminal</name>
+ <exp>(^| |\\t)la +terminal( |\\t|$)</exp>
+ </item>
+ <item>
+ <name>Terminal s mascul (si es tracta d'informtica): un terminal</name>
+ <exp>(^| |\\t)una +terminal( |\\t|$)</exp>
+ </item>
+ <item>
+ <name></name>
+ <exp>(^| |\\t)a +que( |\\t|$)</exp>
+ </item>
+ <item>
+ <name></name>
+ <exp>(^| |\\t)de +que( |\\t|$)</exp>
+ </item>
+ <item>
+ <name></name>
+ <exp>(^| |\\t)en +que( |\\t|$)</exp>
+ </item>
+ <item>
+ <name></name>
+ <exp>(^| |\\t)amb +que( |\\t|$)</exp>
+ </item>
+ <item>
+ <name></name>
+ <exp>(^| |\\t)per +que( |\\t|$)</exp>
+ </item>
+ <!-- En fase de test, ltimes propostes d'en David -->
+
+ <!--
+ Abans de "aquest", "aquell", "algun", "un" i les seues variants no posarem
+ "a", sin "en" (per a moviment i situaci):
+ Voleu desar el fitxer en aquesta carpeta?
+ Tanmateix, per a la resta de casos cal posar "a"!
+
+ Probablement comprovar "a un" donaria massa falsos positius.
+ -->
+ <!--
+ <item>
+ <name></name>
+ <exp>(^| |\\t)a +(aquest|aquell|algun)( |\\t|$)</exp>
+ </item>
+ -->
+ <!--
+ El pronom es, davant d'un mot comenat per sa-, se-, si-, so-, su-, ce- o
+ ci-, s'escriur sempre en la forma plena (se):
+
+ Se sap que algunes caracterstiques...
+ Les propietats d'aquest programa se sumen a les de...
+ -->
+ <item>
+ <name></name>
+ <exp>(^| |\\t)es +(sa|se|si|so|su|ce|ci)</exp>
+ </item>
+
+ <!--
+ En frases negatives, les partcules mai, cap, res, gens i ning han de dur
+ no sempre:
+
+ No tragueu mai el disquet abans d'hora.
+ Cap ordre no s'ha d'escriure en majscules.
+ Sense la contrasenya, ning no est autoritzat a accedir a la informaci.
+ -->
+ <!--
+ <item>
+ <name></name>
+ <exp>(((^| |\\t)(mai|cap|res|gens|ning)( |\\t|$))(?!.*(^| |\\t)no( |\\t|$)))|(((^| |\\t)(mai|cap|res|gens|ning)( |\\t|$))(?!.*(^| |\\t)no( |\\t|$)))</exp>
+ </item>
+ -->
+ <!--
+ 3.3. Construccions incorrectes
+ Podrem buscar "donat que" per a substituir-ho per "ats que".
+ "tals com" -> "com ara"
+ "tal i com" -> "tal com"
+ "teniu que" -> "heu de"/"heu d'"
+ "en quant a" -> "pel que fa a", "quant a"
+ -->
+ <!--
+ <item>
+ <name></name>
+ <exp>(^| |\\t)donat +que( |\\t|$)</exp>
+ </item>
+ -->
+ <item>
+ <name></name>
+ <exp>(^| |\\t)tals +com( |\\t|$)</exp>
+ </item>
+ <item>
+ <name></name>
+ <exp>(^| |\\t)tal +i +com( |\\t|$)</exp>
+ </item>
+ <item>
+ <name></name>
+ <exp>(^| |\\t)teniu +que( |\\t|$)</exp>
+ </item>
+ <item>
+ <name></name>
+ <exp>(^| |\\t)en +quant +a( |\\t|$)</exp>
+ </item>
+
+ <!--
+ Softcatal:
+ * Hi han: El verb haver-hi s impersonal, per aix no t plural en catal central, ats que no t subjecte. Per tant, no es diu hi han, hi havien, hi hauran, sin hi ha, hi havia, hi haur, encara que el complement que el segueixi sigui plural.
+ -->
+ <item>
+ <name></name>
+ <exp>(^| |\\t)hi +han( |\\t|$)</exp>
+ </item>
+ <item>
+ <name></name>
+ <exp>(^| |\\t)hi +havien( |\\t|$)</exp>
+ </item>
+ <item>
+ <name></name>
+ <exp>(^| |\\t)hi +hauran( |\\t|$)</exp>
+ </item>
+
+ <!--
+ Softcatal:
+ * Tenir que: s la traducci incorrecta al catal de l'expressi castellana tener que. La forma correcta s haver de; tamb es pot utilitzar el verb impersonal caldre.
+ -->
+ <item>
+ <name></name>
+ <exp>(^| |\\t)teniu +que( |\\t|$)</exp>
+ </item>
+ <item>
+ <name></name>
+ <exp>(^| |\\t)tenim +que( |\\t|$)</exp>
+ </item>
+ <item>
+ <name></name>
+ <exp>(^| |\\t)tenen +que( |\\t|$)</exp>
+ </item>
+ <item>
+ <name></name>
+ <exp>(^| |\\t)en +quant +a( |\\t|$)</exp>
+ </item>
+ <item>
+ <name></name>
+ <exp>(^| |\\t)en +quant +a( |\\t|$)</exp>
+ </item>
+ <item>
+ <name></name>
+ <exp>(^| |\\t)en +quant +a( |\\t|$)</exp>
+ </item>
+ <item>
+ <name></name>
+ <exp>(^| |\\t)en +quant +a( |\\t|$)</exp>
+ </item>
+ <item>
+ <name></name>
+ <exp>(^| |\\t)en +quant +a( |\\t|$)</exp>
+ </item>
+
+
+</regexplist> \ No newline at end of file
diff --git a/kbabel/datatools/setfuzzy/Makefile.am b/kbabel/datatools/setfuzzy/Makefile.am
new file mode 100644
index 00000000..f1a5b8bc
--- /dev/null
+++ b/kbabel/datatools/setfuzzy/Makefile.am
@@ -0,0 +1,19 @@
+
+INCLUDES = -I$(srcdir)/../../common -I../../common $(all_includes)
+kbabel_setfuzzytool_la_LIBADD = ../../common/libkbabelcommon.la
+
+####### Files
+
+kde_module_LTLIBRARIES = kbabel_setfuzzytool.la
+
+kbabel_setfuzzytool_la_SOURCES = main.cc
+
+kbabel_setfuzzytool_la_LDFLAGS = $(all_libraries) -avoid-version -module -no-undefined
+
+noinst_HEADERS = main.h
+
+kbabel_setfuzzytool_la_METASOURCES = AUTO
+
+service_DATA = kbabel_setfuzzytool.desktop
+servicedir = $(kde_servicesdir)
+
diff --git a/kbabel/datatools/setfuzzy/kbabel_setfuzzytool.desktop b/kbabel/datatools/setfuzzy/kbabel_setfuzzytool.desktop
new file mode 100644
index 00000000..ead62f13
--- /dev/null
+++ b/kbabel/datatools/setfuzzy/kbabel_setfuzzytool.desktop
@@ -0,0 +1,98 @@
+[Desktop Entry]
+Name=Toggle Fuzzy Tool for KBabel
+Name[bs]=Fuzzy prekidač - alat za KBabel
+Name[ca]=Eina per a KBabel que des/marca entrades inexactes
+Name[cs]=Nástroj pro přepínání fuzzy položek
+Name[cy]=Erfyn Newid i Bras i KBabel
+Name[da]=Slå fuzzy-værktøj til og fra for KBabel
+Name[de]=Umschalter für fragwürdige Einträge für KBabel
+Name[el]=Εργαλείο εναλλαγής ασάφειας για το KBabel
+Name[es]=Herramienta de conmutación de entradas dudosas para KBabel
+Name[et]=KBabeli kahtlaste teadete lülitamise tööriist
+Name[eu]=Zalantzazko sarreren aldaketa tresna KBabel-entzat
+Name[fa]=زدن ضامن ابزار مبهم برای KBabel
+Name[fi]=KBabel-työkalu sumean tilan vaihtamiseksi
+Name[fr]=Outil d'inversion de fuzzy pour KBabel
+Name[gl]=Ferramenta de comutación da marca de dubida para KBabel
+Name[hu]=Ellenőrzési eszköz a KBabelhez
+Name[is]=Víxla loðnu tól fyrir KBabel
+Name[it]=Strumento di KBabel per commutare le voci fuzzy
+Name[ja]=KBabel あいまい状態切り替えツール
+Name[ka]=დაუზუსტებელის გადართვის ხელსაწყო KBabel-სთვის
+Name[kk]=KBabel-дың жазу дүмбілездік күйін терістеу құралы
+Name[lt]=KBabel įrankis, visus pranešimus pažymintis „neaiškiais“
+Name[ms]=Alat Togol Kabur untuk KBabel
+Name[nb]=Slå av/på uklar-statusen i KBabel
+Name[nds]=Twiefelhaftig-Status ümschalten för KBabel
+Name[ne]=केब्याबलका लागि फजी उपकरण टगल गर्नुहोस्
+Name[nl]=Fuzzystatusomschakeling voor KBabel
+Name[nn]=Slå av/på uklar-statusen i KBabel
+Name[pa]=ਕੇਬਬੇਲ ਲਈ ਤਬਦੀਲੀ ਅਸਪਸ਼ਟ ਸੰਦ
+Name[pl]=Narzędzie do przełączania statusu wątpliwego komunikatu w KBabel
+Name[pt]=Classificação Global Aproximada para o KBabel
+Name[pt_BR]=Ferramenta para Alternar Aproximado para o KBabel
+Name[ru]=Изменение статуса черновой записи для KBabel
+Name[sk]=Nástroje pre prepnutie nepresného stavu per KBabel
+Name[sl]=Preklopi vse v ohlapno; za KBabel
+Name[sr]=Укључи/искључи алат за нејасне поруке за KBabel
+Name[sr@Latn]=Uključi/isključi alat za nejasne poruke za KBabel
+Name[sv]=Verktyg för att ändra inexakta för Kbabel
+Name[ta]= Kபாபேலுக்கு நிலைமாற்றி இடைநிலை கருவி
+Name[tg]=Утилита барои сиёҳнависӣ дар KBabel
+Name[tr]=KBabel için Geçiş Bulanık Aracı
+Name[uk]=Засіб перемикання неточних фраз для KBabel
+Name[zh_CN]=KBabel 切换模糊工具
+Name[zh_TW]=KBabel 切換模糊狀態工具
+X-KDE-Library=kbabel_setfuzzytool
+Type=Service
+Commands=allfuzzy
+Comment=Set All Fuzzy
+Comment[bg]=Маркиране на всички като неясни
+Comment[bs]=Podesi sve kao fuzzy
+Comment[ca]=Estableix totes les entrades a inexacta
+Comment[cs]=Nastavit vše jako fuzzy
+Comment[cy]=Gosod Popeth i Fras
+Comment[da]=Sæt alle til fuzzy
+Comment[de]=Alle auf fragwürdig setzen
+Comment[el]=Ορισμός όλων ως ασαφή
+Comment[es]=Cambiar todo a dudoso
+Comment[et]=Kõigi teadete määramine kahtlaseks
+Comment[eu]=Ezarri denak zalantzazko bezala
+Comment[fa]=تنظیم همۀ مبهمها
+Comment[fi]=Aseta kaikki sumeiksi
+Comment[fr]=Mettre tout en fuzzy
+Comment[gl]=Marce todas as mensaxes como dúbidas
+Comment[hi]=सभी फजी नियत करें
+Comment[hu]=Az összes üzenet ellenőrzendővé alakítása
+Comment[is]=Setja öll loðin
+Comment[it]=Imposta tutte le voci come fuzzy
+Comment[ja]=すべてあいまいとしてマーク
+Comment[ka]=ყველასთვის დაუზუსტებელის დაყენება
+Comment[kk]=Барлығын дүмбілез деп кою
+Comment[lt]=Žymėti visus neaiškiais
+Comment[ms]=Tetapkan Semua Kabur
+Comment[nb]=Sett alle strengene som uklare
+Comment[nds]=All op "twiefelhaftig" setten
+Comment[ne]=सबै फजी सेट गर्नुहोस्
+Comment[nl]=Alles fuzzy markeren
+Comment[nn]=Set alle strengane som uklare
+Comment[pa]= ਸਭ ਅਸਪਸ਼ਟ ਕਰੋ
+Comment[pl]=Ustawia wszystkie komunikaty jako wątpliwe
+Comment[pt]=Coloca todas as mensagens como aproximadas
+Comment[pt_BR]=Configura Todos Aproximados
+Comment[ru]=Установить статус "черновые" для всех записей
+Comment[sk]=Nastaviť všetky ako nepresné
+Comment[sl]=Nastavi vse ohlapno
+Comment[sr]=Постави све на нејасно
+Comment[sr@Latn]=Postavi sve na nejasno
+Comment[sv]=Gör alla inexakta
+Comment[ta]= எல்லா இடைநிலையையும் அமை
+Comment[tg]=Барқарор кардани ҳолати "сиёҳнависҳо" барои ҳамаи сабтҳо
+Comment[tr]=Tümünü Bulanık Ata
+Comment[uk]=Встановити всі фрази як "неточні"
+Comment[zh_CN]=全部设为模糊
+Comment[zh_TW]=全部設為模糊
+ServiceTypes=KDataTool,KBabelTool
+DataType=Catalog
+DataMimeTypes=application/x-kbabel-catalog
+ReadOnly=false
diff --git a/kbabel/datatools/setfuzzy/main.cc b/kbabel/datatools/setfuzzy/main.cc
new file mode 100644
index 00000000..077004d8
--- /dev/null
+++ b/kbabel/datatools/setfuzzy/main.cc
@@ -0,0 +1,98 @@
+/* This file is part of KBabel
+ based Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
+ 2003 Stanislav Visnovsky <visnovsky@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+ In addition, as a special exception, the copyright holders give
+ permission to link the code of this program with any edition of
+ the Qt library by Trolltech AS, Norway (or with modified versions
+ of Qt that use the same license as Qt), and distribute linked
+ combinations including the two. You must obey the GNU General
+ Public License in all respects for all of the code used other than
+ Qt. If you modify this file, you may extend this exception to
+ your version of the file, but you are not obligated to do so. If
+ you do not wish to do so, delete this exception statement from
+ your version.
+
+*/
+
+#include <resources.h>
+#include "catalog.h"
+#include "main.h"
+
+#include <kdebug.h>
+#include <kgenericfactory.h>
+#include <klibloader.h>
+#include <klocale.h>
+
+/***************************************************
+ *
+ * Factory
+ *
+ ***************************************************/
+
+K_EXPORT_COMPONENT_FACTORY( kbabel_setfuzzytool, KGenericFactory<SetFuzzyTool> ( "kbabeldatatool" ) )
+
+using namespace KBabel;
+
+SetFuzzyTool::SetFuzzyTool( QObject* parent, const char* name, const QStringList & )
+ : KDataTool( parent, name )
+{
+}
+
+bool SetFuzzyTool::run( const QString& command, void* data, const QString& datatype, const QString& mimetype )
+{
+ if ( command != "allfuzzy" )
+ {
+ kdDebug(KBABEL) << "Fuzzy Toggling Tool does only accept the command 'allfuzzy'" << endl;
+ kdDebug(KBABEL) << " The commands " << command << " is not accepted" << endl;
+ return FALSE;
+ }
+
+ // Check wether we can accept the data
+ if ( datatype != "Catalog" )
+ {
+ kdDebug(KBABEL) << "Fuzzy Toggling Tool only accepts datatype Catalog" << endl;
+ return FALSE;
+ }
+
+ if ( mimetype != "application/x-kbabel-catalog" )
+ {
+ kdDebug(KBABEL) << "Plural Forms Tool only accepts mimetype application/x-kbabel-catalog" << endl;
+ return FALSE;
+ }
+
+ if( command == "allfuzzy" )
+ {
+ Catalog* catalog = (Catalog*)(data);
+
+ catalog->applyBeginCommand(0,Msgstr,0);
+
+ for( uint index=0; index < catalog->numberOfEntries(); index++ )
+ {
+ if( !catalog->isUntranslated(index) )
+ {
+ catalog->setFuzzy(index,true);
+ }
+ }
+
+ catalog->applyEndCommand(0,Msgstr,0);
+ }
+ return TRUE;
+}
+
+#include "main.moc"
diff --git a/kbabel/datatools/setfuzzy/main.h b/kbabel/datatools/setfuzzy/main.h
new file mode 100644
index 00000000..da28a9d1
--- /dev/null
+++ b/kbabel/datatools/setfuzzy/main.h
@@ -0,0 +1,47 @@
+/* This file is part of KBabel
+ based on Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
+ 2003 Stanislav Visnovsky <visnovsky@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+ In addition, as a special exception, the copyright holders give
+ permission to link the code of this program with any edition of
+ the Qt library by Trolltech AS, Norway (or with modified versions
+ of Qt that use the same license as Qt), and distribute linked
+ combinations including the two. You must obey the GNU General
+ Public License in all respects for all of the code used other than
+ Qt. If you modify this file, you may extend this exception to
+ your version of the file, but you are not obligated to do so. If
+ you do not wish to do so, delete this exception statement from
+ your version.
+
+*/
+
+#ifndef __main_h__
+#define __main_h__
+
+#include <kdatatool.h>
+
+class SetFuzzyTool : public KDataTool
+{
+ Q_OBJECT
+
+public:
+ SetFuzzyTool( QObject* parent, const char* name, const QStringList & );
+ virtual bool run( const QString& command, void* data, const QString& datatype, const QString& mimetype);
+};
+
+#endif
diff --git a/kbabel/datatools/whitespace/Makefile.am b/kbabel/datatools/whitespace/Makefile.am
new file mode 100644
index 00000000..f0987b4f
--- /dev/null
+++ b/kbabel/datatools/whitespace/Makefile.am
@@ -0,0 +1,19 @@
+
+INCLUDES = -I$(srcdir)/../../common -I../../common $(all_includes)
+kbabel_whitespacetool_la_LIBADD = $(LIB_KIO) ../../common/libkbabelcommon.la
+
+####### Files
+
+kde_module_LTLIBRARIES = kbabel_whitespacetool.la
+
+kbabel_whitespacetool_la_SOURCES = main.cc
+
+kbabel_whitespacetool_la_LDFLAGS = $(all_libraries) -avoid-version -module -no-undefined
+
+noinst_HEADERS = main.h
+
+kbabel_whitespacetool_la_METASOURCES = AUTO
+
+service_DATA = kbabel_whitespacetool.desktop
+servicedir = $(kde_servicesdir)
+
diff --git a/kbabel/datatools/whitespace/kbabel_whitespacetool.desktop b/kbabel/datatools/whitespace/kbabel_whitespacetool.desktop
new file mode 100644
index 00000000..74de2bc4
--- /dev/null
+++ b/kbabel/datatools/whitespace/kbabel_whitespacetool.desktop
@@ -0,0 +1,98 @@
+[Desktop Entry]
+Name=String Translated as Whitespace Validator for KBabel
+Name[bg]=Валидност на низовете, преведени като интервали - KBabel
+Name[bs]=Provjera stringova prevedenih kao blanko znaci za KBabel
+Name[ca]=Validació de cadenes traduïdes com un espai en blanc per a KBabel
+Name[cs]=Validátor překladů bílých mezer
+Name[cy]=Dilysydd Llinyn wedi'i Gyfieithu fel Gofodnod ar gyfer KBabel
+Name[da]=Streng oversat som blanke tegn-validering for KBabel
+Name[de]=Prüfung auf Leerzeichenübersetzungen für KBabel
+Name[el]=Ελεγκτής εγκυρότητας συμβολοσειρών μεταφρασμένα ως κενό για το KBabel
+Name[es]=Validador de cadenas traducidas como espacios en blanco.para KBabel
+Name[et]=KBabeli tühimärgiks tõlgitud teadete kontrollija
+Name[eu]=Zurigune bezala itzulitako kateen balidatzailea KBabel-entzat
+Name[fa]=رشتۀ ترجمه‌شده به عنوان اعتبارسنج فاصلۀ سفید برای KBabel
+Name[fi]=Tyhjeinä käännettyjen merkkijonojen tarkistaja KBabelissa
+Name[fr]=Validateur de chaînes traduites comme des espaces pour KBabel
+Name[gl]=Validación de texto traducido como espazo para KBabel
+Name[hu]=Csak üres karaktereket tartalmazó fordítások kiszűrése a KBabelben
+Name[is]=Staðfestir fyrir KBabel fyrir strengi þýdda sem bil
+Name[it]=Convalidatore delle stringhe tradotte con spazi bianchi per KBabel
+Name[ja]=KBabel 空白として翻訳された文字列を検索
+Name[ka]=სტრიქონი ნათარგმნია როგორც Whitespace დამმოწმებელი KBabel-სთვის
+Name[kk]=KBabel-дың бос орын аудармаларын тексеруі
+Name[lt]=KBabel eilučių, išverstų tuščiais tarpais, patikros įrankis
+Name[nb]=Se etter tomme strenger i KBabel
+Name[nds]=Leertekenöversetten-Prööv för KBabel
+Name[ne]=क्याबेलका लागि सेतो रिक्तस्थान प्रमाणीतकर्ता अनुरुप अनुबाद गरिएका स्ट्रिङ
+Name[nl]=Tekst-vertaald-als-witruimte-validatie voor KBabel
+Name[nn]=Sjå etter tomme strengar i KBabel
+Name[pl]=Sprawdzenie czy napis jest przetłumaczony jako białe znaki w KBabel
+Name[pt]=Validação de Texto Traduzido como Espaço para o KBabel
+Name[pt_BR]=Validador de String Traduzidos com Espaços em Branco para o KBabel
+Name[ru]=Проверка строк, переведённых как пробел для KBabel
+Name[sk]=Kontrola textu preloženého ako prázdny pre KBabel
+Name[sl]=Potrjevalnik nizov, prevedenih kot presledki, za KBabel
+Name[sr]=Оверивач за низове знакова преведене као празан простор за KBabel
+Name[sr@Latn]=Overivač za nizove znakova prevedene kao prazan prostor za KBabel
+Name[sv]=Validering av sträng översatt som blanktecken för Kbabel
+Name[ta]=Kபாபேலுக்கு சரம் மொழிபெயர்ப்பு இடைவேலை மதிப்பீட்டாளர்
+Name[tg]=Тафтиши сатр, ки мисли фосила барои KBabel, тарҷума шудааст
+Name[tr]=KBabel için Ayırma Boşluğu gibi Çevrilen Dizge Denetimi
+Name[uk]=Перевірка фраз, перекладених як пропуски, для KBabel
+Name[zh_CN]=KBabel 的字符串译为空格的检查器
+Name[zh_TW]=KBabel 翻譯為空白字串檢查器
+ValidationString=whitespace checking
+X-KDE-Library=kbabel_whitespacetool
+Type=Service
+Commands=validate
+Comment=Whitespace Translations
+Comment[bg]=Низове, преведени като интервали
+Comment[bs]=Blanko prijevodi
+Comment[ca]=Traduccions amb espai en blanc
+Comment[cs]=Překlady mezer
+Comment[cy]=Cyfieithiadau Gofodnod
+Comment[da]=Oversatte blanke tegn
+Comment[de]=Leerzeichen-Übersetzungen
+Comment[el]=Μεταφράσεις με κενό
+Comment[es]=Traducciones de espacios en blanco
+Comment[et]=Tühimärkidest koosnevad tõlked
+Comment[eu]=Zurigune itzulpenak
+Comment[fa]=ترجمۀ فاصله‌های سفید
+Comment[fi]=Tyhjeiden käännökset
+Comment[fr]=Traductions en espaces
+Comment[gl]=Traducións de espazos en branco
+Comment[he]=תרגומים של תווים נקיים
+Comment[hi]=व्हाइट-स्पेस अनुवाद
+Comment[hu]=Az üres fordítások kiszűrése
+Comment[is]=Þýðingar bila
+Comment[it]=Traduzioni con spazi bianchi
+Comment[ja]=空白翻訳文字列を検索
+Comment[ka]=Whitespace მთარგმნელები
+Comment[kk]=Бос орын аудармалары
+Comment[lt]=Tuščių eilučių patikra
+Comment[ms]=Terjemahan Ruang Kosong
+Comment[nb]=Tomme strenger
+Comment[nds]=Leertekenöversetten pröven
+Comment[ne]=सेतो रिक्तस्थान अनुबाद
+Comment[nl]=Lege vertalingen
+Comment[nn]=Tomme strengar
+Comment[pl]=Tłumaczenia w postaci białych znaków
+Comment[pt]=Traduções de Espaços em Branco
+Comment[pt_BR]=Traduções com espaços em branco
+Comment[ru]=Пустые переводы
+Comment[sk]=Prázdne preklady
+Comment[sl]=Prevodi presledkov
+Comment[sr]=Преводи као празан простор
+Comment[sr@Latn]=Prevodi kao prazan prostor
+Comment[sv]=Översättning med blanktecken
+Comment[ta]= இடைவேலை பெயர்ப்பு
+Comment[tg]=Тарҷумаҳои холӣ
+Comment[tr]=Ayırma Boşluğu Çevirileri
+Comment[uk]=Порожні переклади
+Comment[zh_CN]=空白翻译
+Comment[zh_TW]=空白翻譯
+ServiceTypes=KDataTool,KBabelValidator
+DataType=CatalogItem
+DataMimeTypes=application/x-kbabel-catalogitem
+ReadOnly=true
diff --git a/kbabel/datatools/whitespace/main.cc b/kbabel/datatools/whitespace/main.cc
new file mode 100644
index 00000000..9987c465
--- /dev/null
+++ b/kbabel/datatools/whitespace/main.cc
@@ -0,0 +1,144 @@
+/* This file is part of KBabel
+ based Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
+ 2002 Stanislav Visnovsky <visnovsky@kde.org>
+ 2003 Dwayne Bailey <dwayne@translate.org.za>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+ In addition, as a special exception, the copyright holders give
+ permission to link the code of this program with any edition of
+ the Qt library by Trolltech AS, Norway (or with modified versions
+ of Qt that use the same license as Qt), and distribute linked
+ combinations including the two. You must obey the GNU General
+ Public License in all respects for all of the code used other than
+ Qt. If you modify this file, you may extend this exception to
+ your version of the file, but you are not obligated to do so. If
+ you do not wish to do so, delete this exception statement from
+ your version.
+
+*/
+
+#include <resources.h>
+#include "catalog.h"
+#include "catalogitem.h"
+#include "catalogsettings.h"
+#include "main.h"
+
+#include <kconfig.h>
+#include <kdebug.h>
+#include <kgenericfactory.h>
+#include <klibloader.h>
+#include <klocale.h>
+#include <kmessagebox.h>
+
+/***************************************************
+ *
+ * Factory
+ *
+ ***************************************************/
+
+K_EXPORT_COMPONENT_FACTORY( kbabel_whitespacetool, KGenericFactory<WhitespaceTool> ( "kbabeldatatool" ) )
+
+using namespace KBabel;
+
+WhitespaceTool::WhitespaceTool( QObject* parent, const char* name, const QStringList & )
+ : KDataTool( parent, name ), _cache_origin( 0 ), _equation("^[a-zA-Z0-9]+=")
+{
+ i18n("which check found errors","whitespace only translation");
+}
+
+bool WhitespaceTool::run( const QString& command, void* data, const QString& datatype, const QString& mimetype )
+{
+
+ if ( command != "validate" )
+ {
+ kdDebug(KBABEL) << "Whitespace Tool only accepts the 'validate' command" << endl;
+ kdDebug(KBABEL) << " The command " << command << " is not accepted" << endl;
+ return false;
+ }
+
+ // Check wether we can accept the data
+ if ( datatype != "CatalogItem" )
+ {
+ kdDebug(KBABEL) << "Whitespace Tool only accept the CatalogItem datatype" << endl;
+ return false;
+ }
+
+ if ( mimetype != "application/x-kbabel-catalogitem" )
+ {
+ kdDebug(KBABEL) << "Whitespace Tool only accept the 'application/x-kbabel-catalogitem' mimetype" << endl;
+ return false;
+ }
+
+ if( command == "validate" )
+ {
+
+ CatalogItem* item = (CatalogItem*)(data);
+ bool hasIdError = false;
+ bool hasStrError = false;
+ QRegExp _whitespace("^\\s+$");
+ QStringList str, id;
+
+ if(!item->isUntranslated()) {
+ if( _cache_origin != item->project() )
+ {
+ _plurals = item->project()->miscSettings().singularPlural;
+ _cache_origin = item->project();
+ }
+
+ //Ensure KDE plural forms are in a StringList
+ //FIXME Eliminate context information and this could become a generic message splitter
+ if( item->pluralForm() == KDESpecific ) {
+ str = QStringList::split( "\\n", item->msgstr().first(), true );
+ id = QStringList::split( "\\n",
+ item->msgid().first().replace( QRegExp(_plurals), ""), true );
+ } else {
+ str = item->msgstr();
+ id = item->msgid();
+ }
+
+ //Strip equations
+ id.first().replace( QRegExp(_equation), "");
+ str.first().replace( QRegExp(_equation), "");
+
+ //Ignore Messages with blank msgid components
+ for( QStringList::Iterator it = id.begin() ; it != id.end() ; it++ ) {
+ QString resultstring = (*it);
+ hasIdError = hasIdError || resultstring.contains(_whitespace);
+ }
+ if( hasIdError ) return true;
+
+ //Check each QString in the List is not whitespace
+ for( QStringList::Iterator it = str.begin() ; it != str.end() ; it++ ) {
+ QString resultstring = (*it);
+ hasStrError = hasStrError || resultstring.contains(_whitespace);
+ }
+
+ }
+
+ if(hasStrError) {
+ item->appendError( "whitespace translation" );
+ return false;
+ } else {
+ item->removeError( "whitespace translation" );
+ return true;
+ }
+
+ }
+ return false;
+}
+
+#include "main.moc"
diff --git a/kbabel/datatools/whitespace/main.h b/kbabel/datatools/whitespace/main.h
new file mode 100644
index 00000000..9a0545cc
--- /dev/null
+++ b/kbabel/datatools/whitespace/main.h
@@ -0,0 +1,55 @@
+/* This file is part of KBabel
+ based on Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
+ 2002 Stanislav Visnovsky <visnovsky@kde.org>
+ 2003 Dwayne Bailey <dwayne@translate.org.za>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+ In addition, as a special exception, the copyright holders give
+ permission to link the code of this program with any edition of
+ the Qt library by Trolltech AS, Norway (or with modified versions
+ of Qt that use the same license as Qt), and distribute linked
+ combinations including the two. You must obey the GNU General
+ Public License in all respects for all of the code used other than
+ Qt. If you modify this file, you may extend this exception to
+ your version of the file, but you are not obligated to do so. If
+ you do not wish to do so, delete this exception statement from
+ your version.
+
+*/
+
+#ifndef __main_h__
+#define __main_h__
+
+#include "kbproject.h"
+
+#include <qregexp.h>
+#include <kdatatool.h>
+
+class WhitespaceTool : public KDataTool
+{
+ Q_OBJECT
+
+public:
+ WhitespaceTool( QObject* parent, const char* name, const QStringList & );
+ virtual bool run( const QString& command, void* data, const QString& datatype, const QString& mimetype);
+private:
+ KBabel::Project::Ptr _cache_origin;
+ QRegExp _plurals;
+ QRegExp _equation;
+};
+
+#endif
diff --git a/kbabel/datatools/whitespace/test.po b/kbabel/datatools/whitespace/test.po
new file mode 100644
index 00000000..96fb59d7
--- /dev/null
+++ b/kbabel/datatools/whitespace/test.po
@@ -0,0 +1,92 @@
+# Test file to validate the whitespace checking tool
+# Dwayne Bailey <dwayne@translate.org.za>, 2003
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: test\n"
+"Last-Translator: Dwayne Bailey <dwayne@translate.org.za>\n"
+"PO-Revision-Date: 2003-01-09 09:35+0200\n"
+"Language-Team: <english@translate.org.za>\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Generator: KBabel 1.2\n"
+
+# msgstr incorrectly translated with whitespace - 2*<sp>
+# Expected Result = error
+msgid "Some translation string"
+msgstr " "
+
+# msgid with 3*<sp> translated to 2*<sp> This should be valid
+# Expected Result = valid
+msgid " "
+msgstr " "
+
+# plural checks for KDE with a blank msgstr
+# Expected Result = error
+msgid ""
+"_n: Plural translation\n"
+"Second form %n"
+msgstr ""
+"First fine second wrong\n"
+" "
+
+# plural checks for KDE with everything correct
+# Expected Result = valid
+msgid ""
+"_n: Plural translation\n"
+"Second form %n"
+msgstr ""
+"First fine\n"
+"Second fine"
+
+# plural checks for KDE with bad msgid
+# Expected Result = valid
+msgid ""
+"_n: \n"
+"First form missing"
+msgstr ""
+"\n"
+"Second fine"
+
+# plural checks for KDE with bad msgid
+# Expected Result = valid
+msgid ""
+"_n: Second is missing\n"
+""
+msgstr ""
+"First fine\n"
+""
+
+# Plural check on GNU format with a missing plural
+# Expected Result = error
+msgid "Plural translation"
+msgid_plural "The second form %n"
+msgstr[0] "First fine second wrong"
+msgstr[1] " "
+
+# Plural check on GNU format in order
+# Expected Result = valid
+msgid "Plural translation"
+msgid_plural "The second form %n"
+msgstr[0] "First fine"
+msgstr[1] "Second fine"
+
+# Plural check on GNU format with singular missing
+# Expected Result = valid
+msgid ""
+msgid_plural "Singluar is missing"
+msgstr[0] ""
+msgstr[1] "Plural was translated"
+
+# Plural check on GNU format with plural missing
+# Expected Result = valid
+msgid "Plural is missing"
+msgid_plural ""
+msgstr[0] "Singular is translated"
+msgstr[1] ""
+
+# KDE specific: desktop file contains whitespace transaltion
+# Expected Result = error
+msgid "Name=No Spaces"
+msgstr "Name= "
+
diff --git a/kbabel/datatools/xml/Makefile.am b/kbabel/datatools/xml/Makefile.am
new file mode 100644
index 00000000..dbba4740
--- /dev/null
+++ b/kbabel/datatools/xml/Makefile.am
@@ -0,0 +1,19 @@
+
+INCLUDES = -I$(srcdir)/../../common -I../../common $(all_includes)
+kbabel_xmltool_la_LIBADD = $(LIB_KIO) ../../common/libkbabelcommon.la
+
+####### Files
+
+kde_module_LTLIBRARIES = kbabel_xmltool.la
+
+kbabel_xmltool_la_SOURCES = main.cc
+
+kbabel_xmltool_la_LDFLAGS = $(all_libraries) -avoid-version -module -no-undefined
+
+noinst_HEADERS = main.h
+
+kbabel_xmltool_la_METASOURCES = AUTO
+
+service_DATA = kbabel_xmltool.desktop
+servicedir = $(kde_servicesdir)
+
diff --git a/kbabel/datatools/xml/kbabel_xmltool.desktop b/kbabel/datatools/xml/kbabel_xmltool.desktop
new file mode 100644
index 00000000..2b03bef9
--- /dev/null
+++ b/kbabel/datatools/xml/kbabel_xmltool.desktop
@@ -0,0 +1,105 @@
+[Desktop Entry]
+Name=XML Validation for KBabel
+Name[bg]=XML валидност - KBabel
+Name[bs]=XML provjera za KBabel
+Name[ca]=Validació XML per a KBabel
+Name[cs]=Validace XML pro KBabel
+Name[cy]=Dilysiant XML i KBabel
+Name[da]=XML-validering for KBabel
+Name[de]=XML-Überprüfung für KBabel
+Name[el]=Έλεγχος εγκυρότητας XML για το KBabel
+Name[es]=Validación XML para KBabel
+Name[et]=KBabeli XML-i kontrollija
+Name[eu]=XML balidazioa KBabel-entzat
+Name[fa]=اعتبارسنجی XML برای KBabel
+Name[fi]=XML-validointi KBabelissa
+Name[fr]=Validation XML pour KBabel
+Name[ga]=Bailíochtú XML le haghaidh KBabel
+Name[gl]=Validación de XML para KBabel
+Name[hi]=के-बेबल के लिए एक्सएमएल वेलिडेशन
+Name[hu]=XML-ellenőrzés a KBabelben
+Name[is]=XML staðfesting fyrir KBabel
+Name[it]=Convalidatore di XML per KBabel
+Name[ja]=KBabel XML 検証
+Name[ka]=XML დამოწმება KBabel-თვის
+Name[kk]=KBabel-дың XML-ды тексеруі
+Name[lt]=KBabel XML patikros įrankis
+Name[ms]=Pengesah XML untuk KBabel
+Name[nb]=XML-sjekk i KBabel
+Name[nds]=XML-Prööv för KBabel
+Name[ne]=केब्याबलका लागि एक्सएमएल प्रमाणीकरण
+Name[nl]=XML-validatie voor KBabel
+Name[nn]=XML-sjekk i KBabel
+Name[pa]=ਕੇਬਬੇਲ ਲਈ XML ਪਰਮਾਣਕ
+Name[pl]=Sprawdzenie XML w KBabel
+Name[pt]=Validação de XML para o KBabel
+Name[pt_BR]=Validação XML para o KBabel
+Name[ru]=Проверка XML для KBabel
+Name[sk]=Kontrola XML pre KBabel
+Name[sl]=Potrjevanje XML za KBabel
+Name[sr]=Овера XML-а за KBabel
+Name[sr@Latn]=Overa XML-a za KBabel
+Name[sv]=Validering av XML för Kbabel
+Name[ta]= Kபாபேலுக்கு XML செல்லுபடி சோதனை
+Name[tg]=Тафтиши XML барои KBabel
+Name[tr]=KBabel için XML Onaylama
+Name[uk]=Перевірка XML для KBabel
+Name[zh_CN]=KBabel 的 XML 检查器
+Name[zh_TW]=KBabel XML 檢查器
+ValidationString=XML tags
+X-KDE-Library=kbabel_xmltool
+Type=Service
+Commands=validate
+Comment=Check Tags
+Comment[bg]=Проверка на таговете
+Comment[br]=Gwiriekaat al liketennoù
+Comment[bs]=Provjeri tagove
+Comment[ca]=Comprova les etiquetes
+Comment[cs]=Zkontrolovat značky
+Comment[cy]=Dilysu tagiau
+Comment[da]=Tjek mærker
+Comment[de]=Prüfung der Tags in Übersetzungen
+Comment[el]=Έλεγχος ετικετών
+Comment[es]=Comprobar etiquetas
+Comment[et]=Siltide kontroll
+Comment[eu]=Egiaztatu etiketak
+Comment[fa]=بررسی برچسبها
+Comment[fi]=Tarkista merkintäkoodit
+Comment[fr]=Vérifier les balises
+Comment[ga]=Seiceáil Clibeanna
+Comment[gl]=Verificación das marcas XML/HTML
+Comment[he]=בודק תגיות
+Comment[hi]=टैग्स जांच करें
+Comment[hu]=A tag-ek ellenőrzése
+Comment[is]=Athuga tög
+Comment[it]=Controlla i tag
+Comment[ja]=タグを検証
+Comment[ka]=ჭდეების შემოწმება
+Comment[kk]=Тегтерді тексеру
+Comment[lt]=Tikrinti gaires
+Comment[ms]=Periksa Tag
+Comment[nb]=Sjekk tagger
+Comment[nds]=XML-Betekers pröven
+Comment[ne]=ट्याग जाँच गर्नुहोस्
+Comment[nl]=Tags controleren
+Comment[nn]=Sjekk taggar
+Comment[pa]=ਟੈਗ ਜਾਂਚ
+Comment[pl]=Sprawdzenie znaczników XML
+Comment[pt]=Verificação das Marcas
+Comment[pt_BR]=Verifica Tags
+Comment[ru]=Проверить теги
+Comment[sk]=Kontrola značiek
+Comment[sl]=Preveri značke
+Comment[sr]=Провери ознаке
+Comment[sr@Latn]=Proveri oznake
+Comment[sv]=Kontrollera taggar
+Comment[ta]= ஒட்டு சரிபார்ப்பு
+Comment[tg]=Тафтиш кардани тегҳо
+Comment[tr]=Biçim İmlerini Sına
+Comment[uk]=Перевірити мітки
+Comment[zh_CN]=检查标签
+Comment[zh_TW]=檢查標籤
+ServiceTypes=KDataTool,KBabelValidator
+DataType=CatalogItem
+DataMimeTypes=application/x-kbabel-catalogitem
+ReadOnly=true
diff --git a/kbabel/datatools/xml/main.cc b/kbabel/datatools/xml/main.cc
new file mode 100644
index 00000000..d9549014
--- /dev/null
+++ b/kbabel/datatools/xml/main.cc
@@ -0,0 +1,206 @@
+/* This file is part of KBabel
+ based Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
+ 2002-2003 Stanislav Visnovsky <visnovsky@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+ In addition, as a special exception, the copyright holders give
+ permission to link the code of this program with any edition of
+ the Qt library by Trolltech AS, Norway (or with modified versions
+ of Qt that use the same license as Qt), and distribute linked
+ combinations including the two. You must obey the GNU General
+ Public License in all respects for all of the code used other than
+ Qt. If you modify this file, you may extend this exception to
+ your version of the file, but you are not obligated to do so. If
+ you do not wish to do so, delete this exception statement from
+ your version.
+
+*/
+
+#include <resources.h>
+#include "catalogitem.h"
+#include "catalogsettings.h"
+#include "main.h"
+
+#include <qdom.h>
+
+#include <kconfig.h>
+#include <kdebug.h>
+#include <kgenericfactory.h>
+#include <klibloader.h>
+#include <klocale.h>
+#include <kmessagebox.h>
+
+/***************************************************
+ *
+ * Factory
+ *
+ ***************************************************/
+
+K_EXPORT_COMPONENT_FACTORY( kbabel_xmltool, KGenericFactory<XMLTool> ( "kbabeldatatool" ) )
+
+using namespace KBabel;
+
+XMLTool::XMLTool( QObject* parent, const char* name, const QStringList & )
+ : KDataTool( parent, name ), _cache_origin( 0 )
+{
+ i18n( "what check found errors", "XML tags" );
+}
+
+bool XMLTool::run( const QString& command, void* data, const QString& datatype, const QString& mimetype )
+{
+ if ( command != "validate" )
+ {
+ kdDebug(KBABEL) << "XML Tool does only accept the command 'validate' and 'shortcut'" << endl;
+ kdDebug(KBABEL) << " The commands " << command << " is not accepted" << endl;
+ return FALSE;
+ }
+
+ // Check wether we can accept the data
+ if ( datatype != "CatalogItem" )
+ {
+ kdDebug(KBABEL) << "XML Tool only accepts datatype CatalogItem" << endl;
+ return FALSE;
+ }
+
+ if ( mimetype != "application/x-kbabel-catalogitem" )
+ {
+ kdDebug(KBABEL) << "XML Tool only accepts mimetype application/x-kbabel-catalogitem" << endl;
+ return FALSE;
+ }
+
+ if( command == "validate" )
+ {
+ CatalogItem* item = (CatalogItem*)(data);
+
+ if( _cache_origin != item->project() )
+ {
+ _context = item->project()->miscSettings().contextInfo;
+ _cache_origin = item->project();
+ }
+
+ uint correctnessLevel = 0;
+ QString msgid = item->msgid().first();
+ msgid.replace( "\\\"", "\"" ); // Change '\"' to '"'
+ msgid.replace( QRegExp( "&(?![a-zA-Z0-9]+;)" ), "&amp;" );
+ msgid.replace( _context, "" );
+ msgid.replace("\n",""); // delete newlines
+
+ if( _levelCache.contains(msgid) )
+ {
+ correctnessLevel = _levelCache[msgid];
+ }
+ else
+ {
+ // identify the level of correctness
+ if( isFullyCompliant(msgid) )
+ {
+ correctnessLevel = 0;
+ }
+ else if( isNonCaseCompliant(msgid) )
+ {
+ correctnessLevel = 1;
+ }
+ else if( isNonCaseWithoutCommonCompliant(msgid) )
+ {
+ correctnessLevel = 2;
+ }
+ else
+ {
+ correctnessLevel = 3;
+ }
+
+ _levelCache[msgid] = correctnessLevel;
+ }
+
+ bool hasError = false;
+
+ if(!item->isUntranslated())
+ {
+ QStringList str = item->msgstr(true);
+ for( QStringList::Iterator form = str.begin() ; form != str.end() ; form++ )
+ {
+ QString text=(*form);
+ text.replace( "\\\"", "\"" ); // Change '\"' to '"'
+ text.replace( QRegExp( "&(?![a-zA-Z0-9]+;)" ), "&amp;" );
+
+ // isNonCaseWithoutCommonCompliant can fail
+ // even though higher level checks works
+ // see case 2.
+ switch( correctnessLevel )
+ {
+ case 0: hasError = !isFullyCompliant(text); break;
+ case 1: hasError = !isNonCaseCompliant(text); break;
+ case 2: hasError = !isNonCaseWithoutCommonCompliant(text);
+ if (hasError)
+ {
+ hasError = !isNonCaseCompliant(text) ||
+ !isFullyCompliant(text);
+ }
+ break;
+ case 3: hasError = false; break; // the original is broken
+ default: kdWarning() << "No compliance level, this should not happen" << endl;
+ }
+ }
+ }
+
+ if(hasError)
+ {
+ item->appendError( "XML tags" );
+ }
+ else
+ {
+ item->removeError( "XML tags" );
+ }
+
+ return !hasError;
+ }
+ return FALSE;
+}
+
+bool XMLTool::isFullyCompliant( const QString& text)
+{
+ QDomDocument doc;
+ return doc.setContent("<para>" + text + "</para>" );
+}
+
+bool XMLTool::isNonCaseCompliant( const QString& text)
+{
+ QDomDocument doc;
+ QString test = text.lower();
+ return doc.setContent("<para>" + test + "</para>" );
+}
+
+bool XMLTool::isNonCaseWithoutCommonCompliant( const QString& text)
+{
+ QDomDocument doc;
+ QString test = text.lower();
+ QRegExp rx( "(<br>)|(<hr>)|(<p>)||(<\\w+@(\\w+.)*\\w+>)" );
+ test.replace( rx, "" );
+
+ QString a;
+ do
+ {
+ a = test;
+ test.replace( QRegExp("<[^_:A-Za-z/]"), "" );
+ } while( a!=test);
+
+ test.replace( QRegExp("<$"), "" );
+
+ return doc.setContent("<para>" + test + "</para>" );
+}
+
+#include "main.moc"
diff --git a/kbabel/datatools/xml/main.h b/kbabel/datatools/xml/main.h
new file mode 100644
index 00000000..65b231e8
--- /dev/null
+++ b/kbabel/datatools/xml/main.h
@@ -0,0 +1,59 @@
+/* This file is part of KBabel
+ based on Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
+ 2002-2003 Stanislav Visnovsky <visnovsky@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+ In addition, as a special exception, the copyright holders give
+ permission to link the code of this program with any edition of
+ the Qt library by Trolltech AS, Norway (or with modified versions
+ of Qt that use the same license as Qt), and distribute linked
+ combinations including the two. You must obey the GNU General
+ Public License in all respects for all of the code used other than
+ Qt. If you modify this file, you may extend this exception to
+ your version of the file, but you are not obligated to do so. If
+ you do not wish to do so, delete this exception statement from
+ your version.
+
+*/
+
+#ifndef __main_h__
+#define __main_h__
+
+#include "kbproject.h"
+
+#include <qmap.h>
+#include <kdatatool.h>
+
+class XMLTool : public KDataTool
+{
+ Q_OBJECT
+
+public:
+ XMLTool( QObject* parent, const char* name, const QStringList & );
+ virtual bool run( const QString& command, void* data, const QString& datatype, const QString& mimetype);
+private:
+ bool isFullyCompliant( const QString& text);
+ bool isNonCaseCompliant( const QString& text);
+ bool isNonCaseWithoutCommonCompliant( const QString& text);
+
+ QMap<QString,int> _levelCache;
+
+ KBabel::Project::Ptr _cache_origin;
+ QRegExp _context;
+};
+
+#endif