summaryrefslogtreecommitdiff
path: root/development/translation/opie-lupdate
Unidiff
Diffstat (limited to 'development/translation/opie-lupdate') (more/less context) (ignore whitespace changes)
-rw-r--r--development/translation/opie-lupdate/fetchtr.cpp55
-rw-r--r--development/translation/opie-lupdate/main.cpp11
-rw-r--r--development/translation/opie-lupdate/merge.cpp6
-rw-r--r--development/translation/opie-lupdate/numberh.cpp28
-rw-r--r--development/translation/opie-lupdate/sametexth.cpp6
5 files changed, 84 insertions, 22 deletions
diff --git a/development/translation/opie-lupdate/fetchtr.cpp b/development/translation/opie-lupdate/fetchtr.cpp
index d1f5881..a137628 100644
--- a/development/translation/opie-lupdate/fetchtr.cpp
+++ b/development/translation/opie-lupdate/fetchtr.cpp
@@ -10,2 +10,6 @@
10** 10**
11** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
12** licenses may use this file in accordance with the Qt Commercial License
13** Agreement provided with the Software.
14**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 15** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
@@ -14,2 +18,4 @@
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 18** See http://www.trolltech.com/gpl/ for GPL licensing information.
19** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
20** information about Qt Commercial License Agreements.
15** 21**
@@ -82,2 +88,3 @@ static size_t yyStringLen;
82static QValueStack<int> yySavedBraceDepth; 88static QValueStack<int> yySavedBraceDepth;
89static QValueStack<int> yySavedParenDepth;
83static int yyBraceDepth; 90static int yyBraceDepth;
@@ -86,2 +93,4 @@ static int yyLineNo;
86static int yyCurLineNo; 93static int yyCurLineNo;
94static int yyBraceLineNo;
95static int yyParenLineNo;
87 96
@@ -121,2 +130,3 @@ static void startTokenizer( const char *fileName, int (*getCharFunc)() )
121 yySavedBraceDepth.clear(); 130 yySavedBraceDepth.clear();
131 yySavedParenDepth.clear();
122 yyBraceDepth = 0; 132 yyBraceDepth = 0;
@@ -124,2 +134,4 @@ static void startTokenizer( const char *fileName, int (*getCharFunc)() )
124 yyCurLineNo = 1; 134 yyCurLineNo = 1;
135 yyBraceLineNo = 1;
136 yyParenLineNo = 1;
125} 137}
@@ -166,2 +178,15 @@ static int getToken()
166 break; 178 break;
179 case 'f':
180 /*
181 QTranslator::findMessage() has the same parameters as
182 QApplication::translate().
183 */
184 if ( strcmp(yyIdent + 1, "indMessage") == 0 )
185 return Tok_translate;
186 break;
187 case 'i':
188 /* FOR KDE APPS */
189 if ( strcmp( yyIdent + 1, "8n") == 0 )
190 return Tok_translate;
191 break;
167 case 'n': 192 case 'n':
@@ -178,5 +203,2 @@ static int getToken()
178 break; 203 break;
179 case 'i':
180 if( strcmp(yyIdent + 1, "18n") == 0 )
181 return Tok_tr;
182 case 't': 204 case 't':
@@ -224,2 +246,3 @@ static int getToken()
224 yySavedBraceDepth.push( yyBraceDepth ); 246 yySavedBraceDepth.push( yyBraceDepth );
247 yySavedParenDepth.push( yyParenDepth );
225 } 248 }
@@ -230,8 +253,12 @@ static int getToken()
230 // elif, else 253 // elif, else
231 if ( !yySavedBraceDepth.isEmpty() ) 254 if ( !yySavedBraceDepth.isEmpty() ) {
232 yyBraceDepth = yySavedBraceDepth.top(); 255 yyBraceDepth = yySavedBraceDepth.top();
256 yyParenDepth = yySavedParenDepth.top();
257 }
233 } else if ( yyCh == 'n' ) { 258 } else if ( yyCh == 'n' ) {
234 // endif 259 // endif
235 if ( !yySavedBraceDepth.isEmpty() ) 260 if ( !yySavedBraceDepth.isEmpty() ) {
236 yySavedBraceDepth.pop(); 261 yySavedBraceDepth.pop();
262 yySavedParenDepth.pop();
263 }
237 } 264 }
@@ -358,2 +385,4 @@ static int getToken()
358 case '{': 385 case '{':
386 if (yyBraceDepth == 0)
387 yyBraceLineNo = yyCurLineNo;
359 yyBraceDepth++; 388 yyBraceDepth++;
@@ -362,2 +391,4 @@ static int getToken()
362 case '}': 391 case '}':
392 if (yyBraceDepth == 0)
393 yyBraceLineNo = yyCurLineNo;
363 yyBraceDepth--; 394 yyBraceDepth--;
@@ -366,2 +397,4 @@ static int getToken()
366 case '(': 397 case '(':
398 if (yyParenDepth == 0)
399 yyParenLineNo = yyCurLineNo;
367 yyParenDepth++; 400 yyParenDepth++;
@@ -370,2 +403,4 @@ static int getToken()
370 case ')': 403 case ')':
404 if (yyParenDepth == 0)
405 yyParenLineNo = yyCurLineNo;
371 yyParenDepth--; 406 yyParenDepth--;
@@ -623,10 +658,10 @@ static void parse( MetaTranslator *tor, const char *initialContext,
623 fprintf( stderr, 658 fprintf( stderr,
624 "%s: Unbalanced braces in C++ code (or abuse of the C++" 659 "%s:%d: Unbalanced braces in C++ code (or abuse of the C++"
625 " preprocessor)\n", 660 " preprocessor)\n",
626 (const char *) yyFileName ); 661 (const char *)yyFileName, yyBraceLineNo );
627 if ( yyParenDepth != 0 ) 662 else if ( yyParenDepth != 0 )
628 fprintf( stderr, 663 fprintf( stderr,
629 "%s: Unbalanced parentheses in C++ code (or abuse of the C++" 664 "%s:%d: Unbalanced parentheses in C++ code (or abuse of the C++"
630 " preprocessor)\n", 665 " preprocessor)\n",
631 (const char *) yyFileName ); 666 (const char *)yyFileName, yyParenLineNo );
632} 667}
diff --git a/development/translation/opie-lupdate/main.cpp b/development/translation/opie-lupdate/main.cpp
index ce65e7a..bf16fd7 100644
--- a/development/translation/opie-lupdate/main.cpp
+++ b/development/translation/opie-lupdate/main.cpp
@@ -64,2 +64,11 @@ static void printUsage()
64 64
65/*static QString opie_escape( const QString& str ) {
66 QString ret = str.stripWhiteSpace();
67 qWarning(ret);
68 if ( ret.startsWith("$$(OPIEDIR)") )
69 ret = ret.replace("$$(OPIEDIR)", OPIE::self()->opieDir() );
70 qWarning(ret);
71 return ret;
72 }*/
73
65static void updateTsFiles( const MetaTranslator& fetchedTor, 74static void updateTsFiles( const MetaTranslator& fetchedTor,
@@ -152,3 +161,3 @@ int main( int argc, char **argv )
152 161
153 QMap<QString, QString> tagMap = proFileTagMap( fullText ); 162 QMap<QString, QString> tagMap = proFileTagMap( fullText, OPIE::self()->opieDir() );
154 QMap<QString, QString>::Iterator it; 163 QMap<QString, QString>::Iterator it;
diff --git a/development/translation/opie-lupdate/merge.cpp b/development/translation/opie-lupdate/merge.cpp
index a96104e..3001d4b 100644
--- a/development/translation/opie-lupdate/merge.cpp
+++ b/development/translation/opie-lupdate/merge.cpp
@@ -10,2 +10,6 @@
10** 10**
11** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
12** licenses may use this file in accordance with the Qt Commercial License
13** Agreement provided with the Software.
14**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 15** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
@@ -14,2 +18,4 @@
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 18** See http://www.trolltech.com/gpl/ for GPL licensing information.
19** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
20** information about Qt Commercial License Agreements.
15** 21**
diff --git a/development/translation/opie-lupdate/numberh.cpp b/development/translation/opie-lupdate/numberh.cpp
index f7b7bf8..2f12c3d 100644
--- a/development/translation/opie-lupdate/numberh.cpp
+++ b/development/translation/opie-lupdate/numberh.cpp
@@ -10,2 +10,6 @@
10** 10**
11** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
12** licenses may use this file in accordance with the Qt Commercial License
13** Agreement provided with the Software.
14**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 15** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
@@ -14,2 +18,4 @@
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 18** See http://www.trolltech.com/gpl/ for GPL licensing information.
19** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
20** information about Qt Commercial License Agreements.
15** 21**
@@ -34,3 +40,3 @@ static bool isDigitFriendly( int c )
34{ 40{
35 return ispunct( c ) || isspace( c ); 41 return ispunct((uchar)c) || isspace((uchar)c);
36} 42}
@@ -41,9 +47,9 @@ static int numberLength( const char *s )
41 47
42 if ( isdigit(s[0]) ) { 48 if ( isdigit((uchar)s[0]) ) {
43 do { 49 do {
44 i++; 50 i++;
45 } while ( isdigit(s[i]) || 51 } while (isdigit((uchar)s[i]) ||
46 (isDigitFriendly(s[i]) && 52 (isDigitFriendly(s[i]) &&
47 (isdigit(s[i + 1]) || 53 (isdigit((uchar)s[i + 1]) ||
48 (isDigitFriendly(s[i + 1]) && isdigit(s[i + 2])))) ); 54 (isDigitFriendly(s[i + 1]) && isdigit((uchar)s[i + 2])))));
49 } 55 }
@@ -213,3 +219,4 @@ void applyNumberHeuristic( MetaTranslator *tor, bool verbose )
213 if ( (*it).translation().isEmpty() ) 219 if ( (*it).translation().isEmpty() )
214 untranslated.insert( zeroKey((*it).sourceText()), *it ); 220 untranslated.insert(QCString((*it).context()) + "\n" + (*it).sourceText() + "\n"
221 + (*it).comment(), *it);
215 } else if ( !(*it).translation().isEmpty() ) { 222 } else if ( !(*it).translation().isEmpty() ) {
@@ -220,3 +227,3 @@ void applyNumberHeuristic( MetaTranslator *tor, bool verbose )
220 for ( u = untranslated.begin(); u != untranslated.end(); ++u ) { 227 for ( u = untranslated.begin(); u != untranslated.end(); ++u ) {
221 t = translated.find( u.key() ); 228 t = translated.find( zeroKey((*u).sourceText()) );
222 if ( t != translated.end() && !t.key().isEmpty() && 229 if ( t != translated.end() && !t.key().isEmpty() &&
@@ -224,5 +231,4 @@ void applyNumberHeuristic( MetaTranslator *tor, bool verbose )
224 MetaTranslatorMessage m( *u ); 231 MetaTranslatorMessage m( *u );
225 m.setTranslation( translationAttempt((*t).translation(), 232 m.setTranslation(translationAttempt((*t).translation(), (*t).sourceText(),
226 (*t).sourceText(), 233 (*u).sourceText()));
227 (*u).sourceText()) );
228 tor->insert( m ); 234 tor->insert( m );
diff --git a/development/translation/opie-lupdate/sametexth.cpp b/development/translation/opie-lupdate/sametexth.cpp
index 574cfd5..80909b3 100644
--- a/development/translation/opie-lupdate/sametexth.cpp
+++ b/development/translation/opie-lupdate/sametexth.cpp
@@ -10,2 +10,6 @@
10** 10**
11** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
12** licenses may use this file in accordance with the Qt Commercial License
13** Agreement provided with the Software.
14**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 15** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
@@ -14,2 +18,4 @@
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 18** See http://www.trolltech.com/gpl/ for GPL licensing information.
19** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
20** information about Qt Commercial License Agreements.
15** 21**