summaryrefslogtreecommitdiffabout
path: root/microkde
authorzautrix <zautrix>2005-01-18 21:15:17 (UTC)
committer zautrix <zautrix>2005-01-18 21:15:17 (UTC)
commit7200aeadd415cf88b909c00d1414f212cf85b3df (patch) (unidiff)
tree2626afd67e4db3ce2ae5995857ef3221f59603e0 /microkde
parentc8401418d054bf32810a5f9e07091a177bdeae37 (diff)
downloadkdepimpi-7200aeadd415cf88b909c00d1414f212cf85b3df.zip
kdepimpi-7200aeadd415cf88b909c00d1414f212cf85b3df.tar.gz
kdepimpi-7200aeadd415cf88b909c00d1414f212cf85b3df.tar.bz2
fixes
Diffstat (limited to 'microkde') (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/kdecore/klocale.cpp2
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
14QDict<QString> *mLocaleDict = 0; 14QDict<QString> *mLocaleDict = 0;
15void setLocaleDict( QDict<QString> * dict ) 15void 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
23QStringList missingTrans; 23QStringList missingTrans;
24QStringList existingTrans1; 24QStringList existingTrans1;
25QStringList existingTrans2; 25QStringList existingTrans2;
26 26
27void addMissing(const char *text) 27void 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}
35void addExist(const char *text,QString trans ) 35void 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
51void dumpMissing() 51void 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}
91QString i18n(const char *text) 91QString 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 {