summaryrefslogtreecommitdiffstats
path: root/kbabel/datatools/punctuation
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commitbd9e6617827818fd043452c08c606f07b78014a0 (patch)
tree425bb4c3168f9c02f10150f235d2cb998dcc6108 /kbabel/datatools/punctuation
downloadtdesdk-bd9e6617827818fd043452c08c606f07b78014a0.tar.gz
tdesdk-bd9e6617827818fd043452c08c606f07b78014a0.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdesdk@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kbabel/datatools/punctuation')
-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
4 files changed, 324 insertions, 0 deletions
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