diff options
author | Kurt Zenker <kz@openoffice.org> | 2007-05-11 08:12:10 +0000 |
---|---|---|
committer | Kurt Zenker <kz@openoffice.org> | 2007-05-11 08:12:10 +0000 |
commit | 94519337cd4e54387977fb256fa4fa78127aa05a (patch) | |
tree | 95af76a64db56420df1506b7737f0b60830bd325 /transex3 | |
parent | INTEGRATION: CWS gh13 (1.23.14); FILE MERGED (diff) | |
download | core-94519337cd4e54387977fb256fa4fa78127aa05a.tar.gz core-94519337cd4e54387977fb256fa4fa78127aa05a.zip |
INTEGRATION: CWS gh13 (1.24.14); FILE MERGED
2007/05/03 09:55:37 gh 1.24.14.4: do not check external links for equality
2007/03/16 12:05:26 gh 1.24.14.3: writing errorfiles was not ok for new feature
2006/12/27 11:40:43 gh 1.24.14.2: check for double questionmark and new switch -e to disable it
2006/12/27 11:40:11 gh 1.24.14.1: check for double questionmark and new switch -e to disable it
Diffstat (limited to 'transex3')
-rw-r--r-- | transex3/source/gsicheck.cxx | 42 |
1 files changed, 37 insertions, 5 deletions
diff --git a/transex3/source/gsicheck.cxx b/transex3/source/gsicheck.cxx index 053c29b473be..75479c38e9ba 100644 --- a/transex3/source/gsicheck.cxx +++ b/transex3/source/gsicheck.cxx @@ -4,9 +4,9 @@ * * $RCSfile: gsicheck.cxx,v $ * - * $Revision: 1.24 $ + * $Revision: 1.25 $ * - * last change: $Author: obo $ $Date: 2006-10-11 09:55:17 $ + * last change: $Author: kz $ $Date: 2007-05-11 09:12:10 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -247,7 +247,7 @@ void GSILine::ReassembleLine() // class GSIBlock // /*****************************************************************************/ -GSIBlock::GSIBlock( BOOL PbPrintContext, BOOL bSource, BOOL bTrans, BOOL bRef, BOOL bAllowKID ) +GSIBlock::GSIBlock( BOOL PbPrintContext, BOOL bSource, BOOL bTrans, BOOL bRef, BOOL bAllowKID, BOOL bAllowSusp ) /*****************************************************************************/ : pSourceLine( NULL ) , pReferenceLine( NULL ) @@ -256,6 +256,7 @@ GSIBlock::GSIBlock( BOOL PbPrintContext, BOOL bSource, BOOL bTrans, BOOL bRef, B , bCheckTranslationLang( bTrans ) , bReference( bRef ) , bAllowKeyIDs( bAllowKID ) + , bAllowSuspicious( bAllowSusp ) , bHasBlockError( FALSE ) { } @@ -467,6 +468,27 @@ BOOL GSIBlock::TestUTF8( GSILine* pTestee, BOOL bFixTags ) return !bError; } + +/*****************************************************************************/ +BOOL GSIBlock::HasSuspiciousChars( GSILine* pTestee, GSILine* pSource ) +/*****************************************************************************/ +{ + USHORT nPos = 0; + if ( !bAllowSuspicious && ( nPos = pTestee->GetText().Search("??")) != STRING_NOTFOUND ) + if ( pSource->GetText().Search("??") == STRING_NOTFOUND ) + { + String aUTF8Tester = String( pTestee->GetText(), 0, nPos, RTL_TEXTENCODING_UTF8 ); + USHORT nErrorPos = aUTF8Tester.Len(); + ByteString aContext( pTestee->GetText().Copy( nPos, 20 ) ); + PrintError( ByteString("Found double questionmark in translation only. Looks like an encoding problem at Position " ).Append( ByteString::CreateFromInt32( nErrorPos ) ), "Text format", aContext, pTestee->GetLineNumber(), pTestee->GetUniqId() ); + pTestee->NotOK(); + return TRUE; + } + + return FALSE; +} + + /*****************************************************************************/ BOOL GSIBlock::CheckSyntax( ULONG nLine, BOOL bRequireSourceLine, BOOL bFixTags ) /*****************************************************************************/ @@ -537,6 +559,8 @@ BOOL GSIBlock::CheckSyntax( ULONG nLine, BOOL bRequireSourceLine, BOOL bFixTags PrintList( &(aTester.GetCompareWarnings()), "Translation Tag Missmatch", GetObject( i ) ); } bHasError |= !TestUTF8( GetObject( i ), bFixTags ); + if ( pSourceLine ) + bHasError |= HasSuspiciousChars( GetObject( i ), pSourceLine ); } return bHasError || bHasBlockError; @@ -616,7 +640,7 @@ void Help() /*****************************************************************************/ { fprintf( stdout, "\n" ); - fprintf( stdout, "gsicheck Version 1.8.5 (c)1999 - 2006 by SUN Microsystems\n" ); + fprintf( stdout, "gsicheck Version 1.8.7 (c)1999 - 2006 by SUN Microsystems\n" ); fprintf( stdout, "=========================================================\n" ); fprintf( stdout, "\n" ); fprintf( stdout, "gsicheck checks the syntax of tags in GSI-Files and SDF-Files\n" ); @@ -638,6 +662,8 @@ void Help() fprintf( stdout, "-s Check only source language. Should be used before handing out to vendor.\n" ); fprintf( stdout, "-t Check only Translation language(s). Should be used before merging.\n" ); fprintf( stdout, "-k Allow KeyIDs to be present in strings\n" ); + fprintf( stdout, "-e disable encoding checks. E.g.: double questionmark \'??\' which may be the\n" ); + fprintf( stdout, " result of false conversions\n" ); fprintf( stdout, "-l ISO Languagecode or numerical 2 digits Identifier of the source language.\n" ); fprintf( stdout, " Default is en-US. Use \"\" (empty string) or 'none'\n" ); fprintf( stdout, " to disable source language dependent checks\n" ); @@ -664,6 +690,7 @@ int _cdecl main( int argc, char *argv[] ) BOOL bWriteFixed = FALSE; BOOL bFixTags = FALSE; BOOL bAllowKID = FALSE; + BOOL bAllowSuspicious = FALSE; String aErrorFilename; String aCorrectFilename; String aFixedFilename; @@ -785,6 +812,11 @@ int _cdecl main( int argc, char *argv[] ) bAllowKID = TRUE; } break; + case 'e': + { + bAllowSuspicious = TRUE; + } + break; default: fprintf( stderr, "\nERROR: Unknown Switch %s!\n\n", argv[ i ] ); bError = TRUE; @@ -963,7 +995,7 @@ int _cdecl main( int argc, char *argv[] ) delete pBlock; } - pBlock = new GSIBlock( bPrintContext, bCheckSourceLang, bCheckTranslationLang, bReferenceFile, bAllowKID ); + pBlock = new GSIBlock( bPrintContext, bCheckSourceLang, bCheckTranslationLang, bReferenceFile, bAllowKID, bAllowSuspicious ); aOldId = aId; |