summaryrefslogtreecommitdiffabout
path: root/microkde
authorzautrix <zautrix>2004-10-22 08:27:03 (UTC)
committer zautrix <zautrix>2004-10-22 08:27:03 (UTC)
commite61ce30fc3f2376d8e9caff421495496344a8359 (patch) (unidiff)
treee82f8e5a0ecf3f21d246b0f441502cb8ee0e11a7 /microkde
parenta0cd6749d41390ea832e2acd814fe117bdd39c37 (diff)
downloadkdepimpi-e61ce30fc3f2376d8e9caff421495496344a8359.zip
kdepimpi-e61ce30fc3f2376d8e9caff421495496344a8359.tar.gz
kdepimpi-e61ce30fc3f2376d8e9caff421495496344a8359.tar.bz2
added translations
Diffstat (limited to 'microkde') (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/kdecore/klocale.cpp44
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,123 +1,163 @@
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>
10QStringList missingTrans;
9 11
10QDict<QString> *mLocaleDict = 0; 12QDict<QString> *mLocaleDict = 0;
11void setLocaleDict( QDict<QString> * dict ) 13void setLocaleDict( QDict<QString> * dict )
12{ 14{
13 mLocaleDict = dict; 15 mLocaleDict = dict;
14 16
15} 17}
18void 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>
30void 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
16QString i18n(const char *text) 51QString 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}
34 74
35QString i18n(const char *,const char *text) 75QString i18n(const char *,const char *text)
36{ 76{
37 return i18n( text ); 77 return i18n( text );
38} 78}
39 79
40QString i18n(const char *text1, const char *textn, int num) 80QString i18n(const char *text1, const char *textn, int num)
41{ 81{
42 if ( num == 1 ) return i18n( text1 ); 82 if ( num == 1 ) return i18n( text1 );
43 else { 83 else {
44 QString text = i18n( textn ); 84 QString text = i18n( textn );
45 int pos = text.find( "%n" ); 85 int pos = text.find( "%n" );
46 if ( pos >= 0 ) text.replace( pos, 2, QString::number( num ) ); 86 if ( pos >= 0 ) text.replace( pos, 2, QString::number( num ) );
47 return text; 87 return text;
48 } 88 }
49} 89}
50 90
51inline void put_it_in( QChar *buffer, uint& index, const QString &s ) 91inline void put_it_in( QChar *buffer, uint& index, const QString &s )
52{ 92{
53 for ( uint l = 0; l < s.length(); l++ ) 93 for ( uint l = 0; l < s.length(); l++ )
54 buffer[index++] = s.at( l ); 94 buffer[index++] = s.at( l );
55} 95}
56 96
57inline void put_it_in( QChar *buffer, uint& index, int number ) 97inline void put_it_in( QChar *buffer, uint& index, int number )
58{ 98{
59 buffer[index++] = number / 10 + '0'; 99 buffer[index++] = number / 10 + '0';
60 buffer[index++] = number % 10 + '0'; 100 buffer[index++] = number % 10 + '0';
61} 101}
62 102
63static int readInt(const QString &str, uint &pos) 103static int readInt(const QString &str, uint &pos)
64{ 104{
65 if (!str.at(pos).isDigit()) return -1; 105 if (!str.at(pos).isDigit()) return -1;
66 int result = 0; 106 int result = 0;
67 for (; str.length() > pos && str.at(pos).isDigit(); pos++) 107 for (; str.length() > pos && str.at(pos).isDigit(); pos++)
68 { 108 {
69 result *= 10; 109 result *= 10;
70 result += str.at(pos).digitValue(); 110 result += str.at(pos).digitValue();
71 } 111 }
72 112
73 return result; 113 return result;
74} 114}
75 115
76KLocale::KLocale() : mCalendarSystem( 0 ) 116KLocale::KLocale() : mCalendarSystem( 0 )
77{ 117{
78 118
79 m_decimalSymbol = "."; 119 m_decimalSymbol = ".";
80 m_positiveSign = ""; 120 m_positiveSign = "";
81 m_negativeSign = "-"; 121 m_negativeSign = "-";
82 m_thousandsSeparator = ","; 122 m_thousandsSeparator = ",";
83 123
84 124
85 125
86 126
87 mWeekStartsMonday = true; 127 mWeekStartsMonday = true;
88 mHourF24Format = true; 128 mHourF24Format = true;
89 mIntDateFormat = Default; 129 mIntDateFormat = Default;
90 mIntTimeFormat = Default; 130 mIntTimeFormat = Default;
91 mLanguage = 0; 131 mLanguage = 0;
92 mDateFormat = "%a %Y %b %d"; 132 mDateFormat = "%a %Y %b %d";
93 mDateFormatShort = "%Y-%m-%d"; 133 mDateFormatShort = "%Y-%m-%d";
94 mTimeZoneList << i18n ("-11:00 US/Samoa") 134 mTimeZoneList << i18n ("-11:00 US/Samoa")
95 << i18n ("-10:00 US/Hawaii") 135 << i18n ("-10:00 US/Hawaii")
96 << i18n ("-09:00 US/Alaska") 136 << i18n ("-09:00 US/Alaska")
97 << i18n ("-08:00 US/Pacific") 137 << i18n ("-08:00 US/Pacific")
98 << i18n ("-07:00 US/Mountain") 138 << i18n ("-07:00 US/Mountain")
99 << i18n ("-06:00 US/Central") 139 << i18n ("-06:00 US/Central")
100 << i18n ("-05:00 US/Eastern") 140 << i18n ("-05:00 US/Eastern")
101 << i18n ("-04:00 Brazil/West") 141 << i18n ("-04:00 Brazil/West")
102 << i18n ("-03:00 Brazil/East") 142 << i18n ("-03:00 Brazil/East")
103 << i18n ("-02:00 Brazil/DeNoronha") 143 << i18n ("-02:00 Brazil/DeNoronha")
104 << i18n ("-01:00 Atlantic/Azores") 144 << i18n ("-01:00 Atlantic/Azores")
105 << i18n (" 00:00 Europe/London(UTC)") 145 << i18n (" 00:00 Europe/London(UTC)")
106 << i18n ("+01:00 Europe/Oslo(CET)") 146 << i18n ("+01:00 Europe/Oslo(CET)")
107 << i18n ("+02:00 Europe/Helsinki") 147 << i18n ("+02:00 Europe/Helsinki")
108 << i18n ("+03:00 Europe/Moscow") 148 << i18n ("+03:00 Europe/Moscow")
109 << i18n ("+04:00 Indian/Mauritius") 149 << i18n ("+04:00 Indian/Mauritius")
110 << i18n ("+05:00 Indian/Maldives") 150 << i18n ("+05:00 Indian/Maldives")
111 << i18n ("+06:00 Indian/Chagos") 151 << i18n ("+06:00 Indian/Chagos")
112 << i18n ("+07:00 Asia/Bangkok") 152 << i18n ("+07:00 Asia/Bangkok")
113 << i18n ("+08:00 Asia/Hongkong") 153 << i18n ("+08:00 Asia/Hongkong")
114 << i18n ("+09:00 Asia/Tokyo") 154 << i18n ("+09:00 Asia/Tokyo")
115 << i18n ("+10:00 Asia/Vladivostok") 155 << i18n ("+10:00 Asia/Vladivostok")
116 << i18n ("+11:00 Asia/Magadan") 156 << i18n ("+11:00 Asia/Magadan")
117 << i18n ("+12:00 Asia/Kamchatka") 157 << i18n ("+12:00 Asia/Kamchatka")
118 // << i18n (" xx:xx User defined offset") 158 // << i18n (" xx:xx User defined offset")
119 << i18n (" Local Time"); 159 << i18n (" Local Time");
120 mSouthDaylight = false; 160 mSouthDaylight = false;
121 mTimeZoneOffset = 0; 161 mTimeZoneOffset = 0;
122 daylightEnabled = false; 162 daylightEnabled = false;
123} 163}