author | zecke <zecke> | 2004-01-09 19:13:35 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-01-09 19:13:35 (UTC) |
commit | 56bb9961db1158250bbfe971f4556b56c0bd6581 (patch) (unidiff) | |
tree | a4f40da98f695b5aadd845b68aaab41ac3d81826 /development/translation/opie-lupdate/numberh.cpp | |
parent | 6875988077013544246ae0df7cc2e5d538a7f152 (diff) | |
download | opie-56bb9961db1158250bbfe971f4556b56c0bd6581.zip opie-56bb9961db1158250bbfe971f4556b56c0bd6581.tar.gz opie-56bb9961db1158250bbfe971f4556b56c0bd6581.tar.bz2 |
Update lupdate and shared to Qt3.3 qt-copy sources
Some special replacement for $$(OPIEDIR) to make ar_* happy
Diffstat (limited to 'development/translation/opie-lupdate/numberh.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | development/translation/opie-lupdate/numberh.cpp | 24 |
1 files changed, 15 insertions, 9 deletions
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 | |||
@@ -5,16 +5,22 @@ | |||
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
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 |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 16 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 17 | ** |
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 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 22 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 23 | ** not clear to you. |
18 | ** | 24 | ** |
19 | **********************************************************************/ | 25 | **********************************************************************/ |
20 | 26 | ||
@@ -29,26 +35,26 @@ | |||
29 | 35 | ||
30 | typedef QMap<QCString, MetaTranslatorMessage> TMM; | 36 | typedef QMap<QCString, MetaTranslatorMessage> TMM; |
31 | typedef QValueList<MetaTranslatorMessage> TML; | 37 | typedef QValueList<MetaTranslatorMessage> TML; |
32 | 38 | ||
33 | static bool isDigitFriendly( int c ) | 39 | static bool isDigitFriendly( int c ) |
34 | { | 40 | { |
35 | return ispunct( c ) || isspace( c ); | 41 | return ispunct((uchar)c) || isspace((uchar)c); |
36 | } | 42 | } |
37 | 43 | ||
38 | static int numberLength( const char *s ) | 44 | static int numberLength( const char *s ) |
39 | { | 45 | { |
40 | int i = 0; | 46 | int i = 0; |
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 | } |
50 | return i; | 56 | return i; |
51 | } | 57 | } |
52 | 58 | ||
53 | /* | 59 | /* |
54 | Returns a version of 'key' where all numbers have been replaced by zeroes. If | 60 | Returns a version of 'key' where all numbers have been replaced by zeroes. If |
@@ -208,25 +214,25 @@ void applyNumberHeuristic( MetaTranslator *tor, bool verbose ) | |||
208 | TML::Iterator it; | 214 | TML::Iterator it; |
209 | int inserted = 0; | 215 | int inserted = 0; |
210 | 216 | ||
211 | for ( it = all.begin(); it != all.end(); ++it ) { | 217 | for ( it = all.begin(); it != all.end(); ++it ) { |
212 | if ( (*it).type() == MetaTranslatorMessage::Unfinished ) { | 218 | if ( (*it).type() == MetaTranslatorMessage::Unfinished ) { |
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() ) { |
216 | translated.insert( zeroKey((*it).sourceText()), *it ); | 223 | translated.insert( zeroKey((*it).sourceText()), *it ); |
217 | } | 224 | } |
218 | } | 225 | } |
219 | 226 | ||
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() && |
223 | qstrcmp((*t).sourceText(), (*u).sourceText()) != 0 ) { | 230 | qstrcmp((*t).sourceText(), (*u).sourceText()) != 0 ) { |
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(), | ||
227 | (*u).sourceText()) ); | 233 | (*u).sourceText()) ); |
228 | tor->insert( m ); | 234 | tor->insert( m ); |
229 | inserted++; | 235 | inserted++; |
230 | } | 236 | } |
231 | } | 237 | } |
232 | if ( verbose && inserted != 0 ) | 238 | if ( verbose && inserted != 0 ) |