author | zautrix <zautrix> | 2005-02-09 21:01:05 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-02-09 21:01:05 (UTC) |
commit | 38c6a7b6ae1e98cba0fdf2d0fba59ad4b9060940 (patch) (unidiff) | |
tree | 1c171d9b0d4477810e68576e1954db0c8b68c668 | |
parent | ab7725c4517a1f6c145075edcff0bdafe105f0ea (diff) | |
download | kdepimpi-38c6a7b6ae1e98cba0fdf2d0fba59ad4b9060940.zip kdepimpi-38c6a7b6ae1e98cba0fdf2d0fba59ad4b9060940.tar.gz kdepimpi-38c6a7b6ae1e98cba0fdf2d0fba59ad4b9060940.tar.bz2 |
fix of fix
-rw-r--r-- | microkde/kdecore/klocale.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/microkde/kdecore/klocale.cpp b/microkde/kdecore/klocale.cpp index aec74fa..7f31ab1 100644 --- a/microkde/kdecore/klocale.cpp +++ b/microkde/kdecore/klocale.cpp | |||
@@ -1,107 +1,107 @@ | |||
1 | #include <qregexp.h> | 1 | #include <qregexp.h> |
2 | #include <qapplication.h> | 2 | #include <qapplication.h> |
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> | 9 | #include <qstringlist.h> |
10 | 10 | ||
11 | #define COLLECT_TRANSLATION | 11 | //#define COLLECT_TRANSLATION |
12 | 12 | ||
13 | 13 | ||
14 | QDict<QString> *mLocaleDict = 0; | 14 | QDict<QString> *mLocaleDict = 0; |
15 | void setLocaleDict( QDict<QString> * dict ) | 15 | void setLocaleDict( QDict<QString> * dict ) |
16 | { | 16 | { |
17 | mLocaleDict = dict; | 17 | mLocaleDict = dict; |
18 | 18 | ||
19 | } | 19 | } |
20 | 20 | ||
21 | #ifdef COLLECT_TRANSLATION | 21 | #ifdef COLLECT_TRANSLATION |
22 | 22 | ||
23 | QStringList missingTrans; | 23 | QStringList missingTrans; |
24 | QStringList existingTrans1; | 24 | QStringList existingTrans1; |
25 | QStringList existingTrans2; | 25 | QStringList existingTrans2; |
26 | 26 | ||
27 | void addMissing(const char *text) | 27 | void addMissing(const char *text) |
28 | { | 28 | { |
29 | 29 | ||
30 | QString mis ( text ); | 30 | QString mis ( text ); |
31 | if ( !missingTrans.contains( mis ) ) | 31 | if ( !missingTrans.contains( mis ) ) |
32 | missingTrans.append(mis); | 32 | missingTrans.append(mis); |
33 | 33 | ||
34 | } | 34 | } |
35 | void addExist(const char *text,QString trans ) | 35 | void addExist(const char *text,QString trans ) |
36 | { | 36 | { |
37 | //return; | 37 | //return; |
38 | QString mis ( text ); | 38 | QString mis ( text ); |
39 | if ( !existingTrans1.contains( mis ) ) { | 39 | if ( !existingTrans1.contains( mis ) ) { |
40 | existingTrans1.append(mis); | 40 | existingTrans1.append(mis); |
41 | existingTrans2.append(trans); | 41 | existingTrans2.append(trans); |
42 | 42 | ||
43 | } | 43 | } |
44 | 44 | ||
45 | } | 45 | } |
46 | 46 | ||
47 | #include <qfile.h> | 47 | #include <qfile.h> |
48 | #include <qtextstream.h> | 48 | #include <qtextstream.h> |
49 | #include <qtextcodec.h> | 49 | #include <qtextcodec.h> |
50 | #endif | 50 | #endif |
51 | void dumpMissing() | 51 | void dumpMissing() |
52 | { | 52 | { |
53 | #ifdef COLLECT_TRANSLATION | 53 | #ifdef COLLECT_TRANSLATION |
54 | QString fileName = "/tmp/usernewtrans.txt"; | 54 | QString fileName = "/tmp/usernewtrans.txt"; |
55 | QFile file( fileName ); | 55 | QFile file( fileName ); |
56 | if (!file.open( IO_WriteOnly ) ) { | 56 | if (!file.open( IO_WriteOnly ) ) { |
57 | return ; | 57 | return ; |
58 | } | 58 | } |
59 | QTextStream ts( &file ); | 59 | QTextStream ts( &file ); |
60 | ts.setCodec( QTextCodec::codecForName("utf8") ); | 60 | ts.setCodec( QTextCodec::codecForName("utf8") ); |
61 | 61 | ||
62 | int i; | 62 | int i; |
63 | for ( i = 0; i< missingTrans.count(); ++i ) { | 63 | for ( i = 0; i< missingTrans.count(); ++i ) { |
64 | 64 | ||
65 | QString text = missingTrans[i].replace( QRegExp("\n"),"\\n" ); | 65 | QString text = missingTrans[i].replace( QRegExp("\n"),"\\n" ); |
66 | ts << "{ \""<<text<< "\",\""<< text <<"\" },\n"; | 66 | ts << "{ \""<<text<< "\",\""<< text <<"\" },\n"; |
67 | 67 | ||
68 | } | 68 | } |
69 | file.close(); | 69 | file.close(); |
70 | { | 70 | { |
71 | QString fileName = "/tmp/usertrans.txt"; | 71 | QString fileName = "/tmp/usertrans.txt"; |
72 | QFile file( fileName ); | 72 | QFile file( fileName ); |
73 | if (!file.open( IO_WriteOnly ) ) { | 73 | if (!file.open( IO_WriteOnly ) ) { |
74 | return ; | 74 | return ; |
75 | } | 75 | } |
76 | QTextStream ts( &file ); | 76 | QTextStream ts( &file ); |
77 | ts.setCodec( QTextCodec::codecForName("utf8") ); | 77 | ts.setCodec( QTextCodec::codecForName("utf8") ); |
78 | 78 | ||
79 | int i; | 79 | int i; |
80 | for ( i = 0; i< existingTrans1.count(); ++i ) { | 80 | for ( i = 0; i< existingTrans1.count(); ++i ) { |
81 | 81 | ||
82 | QString text = existingTrans1[i].replace( QRegExp("\n"),"\\n" ); | 82 | QString text = existingTrans1[i].replace( QRegExp("\n"),"\\n" ); |
83 | QString text2 = existingTrans2[i].replace( QRegExp("\n"),"\\n" ); | 83 | QString text2 = existingTrans2[i].replace( QRegExp("\n"),"\\n" ); |
84 | ts << "{ \""<<text<< "\",\""<< text2 <<"\" },\n"; | 84 | ts << "{ \""<<text<< "\",\""<< text2 <<"\" },\n"; |
85 | 85 | ||
86 | } | 86 | } |
87 | file.close(); | 87 | file.close(); |
88 | } | 88 | } |
89 | #endif | 89 | #endif |
90 | } | 90 | } |
91 | QString i18n(const char *text) | 91 | QString i18n(const char *text) |
92 | { | 92 | { |
93 | if ( ! mLocaleDict ) { | 93 | if ( ! mLocaleDict ) { |
94 | #ifdef COLLECT_TRANSLATION | 94 | #ifdef COLLECT_TRANSLATION |
95 | addMissing( text ); | 95 | addMissing( text ); |
96 | #endif | 96 | #endif |
97 | return QString( text ); | 97 | return QString( text ); |
98 | } | 98 | } |
99 | else { | 99 | else { |
100 | QString* ret = mLocaleDict->find(QString(text)) ; | 100 | QString* ret = mLocaleDict->find(QString(text)) ; |
101 | if ( ret == 0 ) { | 101 | if ( ret == 0 ) { |
102 | #ifdef COLLECT_TRANSLATION | 102 | #ifdef COLLECT_TRANSLATION |
103 | addMissing( text ); | 103 | addMissing( text ); |
104 | #endif | 104 | #endif |
105 | return QString( text ); | 105 | return QString( text ); |
106 | } | 106 | } |
107 | else { | 107 | else { |