From fcea043d2200bb4bb0b1146a69204af15fb58a7d Mon Sep 17 00:00:00 2001 From: zautrix Date: Sat, 23 Oct 2004 22:58:21 +0000 Subject: kopimail translation --- (limited to 'microkde/kdecore') diff --git a/microkde/kdecore/klocale.cpp b/microkde/kdecore/klocale.cpp index d3b04dc..1da1e99 100644 --- a/microkde/kdecore/klocale.cpp +++ b/microkde/kdecore/klocale.cpp @@ -7,7 +7,9 @@ #include "klocale.h" #include -QStringList missingTrans; + +//#define COLLECT_TRANSLATION + QDict *mLocaleDict = 0; void setLocaleDict( QDict * dict ) @@ -15,22 +17,41 @@ void setLocaleDict( QDict * dict ) mLocaleDict = dict; } + +#ifdef COLLECT_TRANSLATION + +QStringList missingTrans; +QStringList existingTrans1; +QStringList existingTrans2; + void addMissing(const char *text) { - return; + QString mis ( text ); if ( !missingTrans.contains( mis ) ) missingTrans.append(mis); } +void addExist(const char *text,QString trans ) +{ + //return; + QString mis ( text ); + if ( !existingTrans1.contains( mis ) ) { + existingTrans1.append(mis); + existingTrans2.append(trans); + + } + +} #include #include #include +#endif void dumpMissing() { - return; - QString fileName = "/tmp/usertrans.txt"; +#ifdef COLLECT_TRANSLATION + QString fileName = "/tmp/usernewtrans.txt"; QFile file( fileName ); if (!file.open( IO_WriteOnly ) ) { return ; @@ -46,27 +67,56 @@ void dumpMissing() } file.close(); -} + { + QString fileName = "/tmp/usertrans.txt"; + QFile file( fileName ); + if (!file.open( IO_WriteOnly ) ) { + return ; + } + QTextStream ts( &file ); + ts.setCodec( QTextCodec::codecForName("utf8") ); + + int i; + for ( i = 0; i< existingTrans1.count(); ++i ) { + + QString text = existingTrans1[i].replace( QRegExp("\n"),"\\n" ); + QString text2 = existingTrans2[i].replace( QRegExp("\n"),"\\n" ); + ts << "{ \""<find(QString(text)) ; if ( ret == 0 ) { +#ifdef COLLECT_TRANSLATION addMissing( text ); +#endif return QString( text ); } else { if ( (*ret).isEmpty() ) { +#ifdef COLLECT_TRANSLATION addMissing( text ); +#endif return QString( text ); } - else + else { +#ifdef COLLECT_TRANSLATION + addExist( text, *ret ); +#endif return (*ret); + } } } -- cgit v0.9.0.2