-rw-r--r-- | microkde/kdecore/klocale.cpp | 44 |
1 files changed, 42 insertions, 2 deletions
diff --git a/microkde/kdecore/klocale.cpp b/microkde/kdecore/klocale.cpp index 3674f28..21e6937 100644 --- a/microkde/kdecore/klocale.cpp +++ b/microkde/kdecore/klocale.cpp @@ -1,43 +1,83 @@ #include <qregexp.h> #include <qapplication.h> #include "kdebug.h" #include "kcalendarsystemgregorian.h" #include "klocale.h" +#include <qstringlist.h> +QStringList missingTrans; QDict<QString> *mLocaleDict = 0; void setLocaleDict( QDict<QString> * dict ) { mLocaleDict = dict; } +void addMissing(const char *text) +{ + return; + QString mis ( text ); + if ( !missingTrans.contains( mis ) ) + missingTrans.append(mis); + +} + +#include <qfile.h> +#include <qtextstream.h> +#include <qtextcodec.h> +void dumpMissing() +{ + return; + 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< missingTrans.count(); ++i ) { + + QString text = missingTrans[i].replace( QRegExp("\n"),"\\n" ); + ts << "{ \""<<text<< "\",\""<< text <<"\" },\n"; + + } + file.close(); +} + QString i18n(const char *text) { - if ( ! mLocaleDict ) + if ( ! mLocaleDict ) { + addMissing( text ); return QString( text ); + } else { QString* ret = mLocaleDict->find(QString(text)) ; if ( ret == 0 ) { + addMissing( text ); return QString( text ); } else { - if ( (*ret).isEmpty() ) + if ( (*ret).isEmpty() ) { + addMissing( text ); return QString( text ); + } else return (*ret); } } } QString i18n(const char *,const char *text) { return i18n( text ); } QString i18n(const char *text1, const char *textn, int num) { if ( num == 1 ) return i18n( text1 ); else { |