author | zautrix <zautrix> | 2004-10-22 08:27:03 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-22 08:27:03 (UTC) |
commit | e61ce30fc3f2376d8e9caff421495496344a8359 (patch) (side-by-side diff) | |
tree | e82f8e5a0ecf3f21d246b0f441502cb8ee0e11a7 /microkde | |
parent | a0cd6749d41390ea832e2acd814fe117bdd39c37 (diff) | |
download | kdepimpi-e61ce30fc3f2376d8e9caff421495496344a8359.zip kdepimpi-e61ce30fc3f2376d8e9caff421495496344a8359.tar.gz kdepimpi-e61ce30fc3f2376d8e9caff421495496344a8359.tar.bz2 |
added translations
-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 @@ -6,6 +6,8 @@ #include "klocale.h" +#include <qstringlist.h> +QStringList missingTrans; QDict<QString> *mLocaleDict = 0; void setLocaleDict( QDict<QString> * dict ) @@ -13,18 +15,56 @@ 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); } |