summaryrefslogtreecommitdiff
path: root/development/translation/opie-lupdate/numberh.cpp
Unidiff
Diffstat (limited to 'development/translation/opie-lupdate/numberh.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--development/translation/opie-lupdate/numberh.cpp28
1 files changed, 17 insertions, 11 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
@@ -8,10 +8,16 @@
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.
@@ -32,20 +38,20 @@ typedef QValueList<MetaTranslatorMessage> TML;
32 38
33static bool isDigitFriendly( int c ) 39static bool isDigitFriendly( int c )
34{ 40{
35 return ispunct( c ) || isspace( c ); 41 return ispunct((uchar)c) || isspace((uchar)c);
36} 42}
37 43
38static int numberLength( const char *s ) 44static 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}
@@ -211,20 +217,20 @@ void applyNumberHeuristic( MetaTranslator *tor, bool verbose )
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(), 233 (*u).sourceText()));
227 (*u).sourceText()) );
228 tor->insert( m ); 234 tor->insert( m );
229 inserted++; 235 inserted++;
230 } 236 }