summaryrefslogtreecommitdiffstats
path: root/kbabel/datatools/not-translated
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/not-translated
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/not-translated')
-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
5 files changed, 348 insertions, 0 deletions
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"