author | zautrix <zautrix> | 2004-10-22 08:27:03 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-22 08:27:03 (UTC) |
commit | e61ce30fc3f2376d8e9caff421495496344a8359 (patch) (unidiff) | |
tree | e82f8e5a0ecf3f21d246b0f441502cb8ee0e11a7 /microkde/kdecore/klocale.cpp | |
parent | a0cd6749d41390ea832e2acd814fe117bdd39c37 (diff) | |
download | kdepimpi-e61ce30fc3f2376d8e9caff421495496344a8359.zip kdepimpi-e61ce30fc3f2376d8e9caff421495496344a8359.tar.gz kdepimpi-e61ce30fc3f2376d8e9caff421495496344a8359.tar.bz2 |
added translations
Diffstat (limited to 'microkde/kdecore/klocale.cpp') (more/less context) (ignore whitespace changes)
-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 | |||
@@ -3,31 +3,71 @@ | |||
3 | 3 | ||
4 | #include "kdebug.h" | 4 | #include "kdebug.h" |
5 | #include "kcalendarsystemgregorian.h" | 5 | #include "kcalendarsystemgregorian.h" |
6 | 6 | ||
7 | #include "klocale.h" | 7 | #include "klocale.h" |
8 | 8 | ||
9 | #include <qstringlist.h> | ||
10 | QStringList missingTrans; | ||
9 | 11 | ||
10 | QDict<QString> *mLocaleDict = 0; | 12 | QDict<QString> *mLocaleDict = 0; |
11 | void setLocaleDict( QDict<QString> * dict ) | 13 | void setLocaleDict( QDict<QString> * dict ) |
12 | { | 14 | { |
13 | mLocaleDict = dict; | 15 | mLocaleDict = dict; |
14 | 16 | ||
15 | } | 17 | } |
18 | void addMissing(const char *text) | ||
19 | { | ||
20 | return; | ||
21 | QString mis ( text ); | ||
22 | if ( !missingTrans.contains( mis ) ) | ||
23 | missingTrans.append(mis); | ||
24 | |||
25 | } | ||
26 | |||
27 | #include <qfile.h> | ||
28 | #include <qtextstream.h> | ||
29 | #include <qtextcodec.h> | ||
30 | void dumpMissing() | ||
31 | { | ||
32 | return; | ||
33 | QString fileName = "/tmp/usertrans.txt"; | ||
34 | QFile file( fileName ); | ||
35 | if (!file.open( IO_WriteOnly ) ) { | ||
36 | return ; | ||
37 | } | ||
38 | QTextStream ts( &file ); | ||
39 | ts.setCodec( QTextCodec::codecForName("utf8") ); | ||
40 | |||
41 | int i; | ||
42 | for ( i = 0; i< missingTrans.count(); ++i ) { | ||
43 | |||
44 | QString text = missingTrans[i].replace( QRegExp("\n"),"\\n" ); | ||
45 | ts << "{ \""<<text<< "\",\""<< text <<"\" },\n"; | ||
46 | |||
47 | } | ||
48 | file.close(); | ||
49 | } | ||
50 | |||
16 | QString i18n(const char *text) | 51 | QString i18n(const char *text) |
17 | { | 52 | { |
18 | if ( ! mLocaleDict ) | 53 | if ( ! mLocaleDict ) { |
54 | addMissing( text ); | ||
19 | return QString( text ); | 55 | return QString( text ); |
56 | } | ||
20 | else { | 57 | else { |
21 | QString* ret = mLocaleDict->find(QString(text)) ; | 58 | QString* ret = mLocaleDict->find(QString(text)) ; |
22 | if ( ret == 0 ) { | 59 | if ( ret == 0 ) { |
60 | addMissing( text ); | ||
23 | return QString( text ); | 61 | return QString( text ); |
24 | } | 62 | } |
25 | else { | 63 | else { |
26 | if ( (*ret).isEmpty() ) | 64 | if ( (*ret).isEmpty() ) { |
65 | addMissing( text ); | ||
27 | return QString( text ); | 66 | return QString( text ); |
67 | } | ||
28 | else | 68 | else |
29 | return (*ret); | 69 | return (*ret); |
30 | } | 70 | } |
31 | } | 71 | } |
32 | 72 | ||
33 | } | 73 | } |