diff options
author | Jens-Heiner Rechtien <hr@openoffice.org> | 2005-09-23 13:29:55 +0000 |
---|---|---|
committer | Jens-Heiner Rechtien <hr@openoffice.org> | 2005-09-23 13:29:55 +0000 |
commit | 5c5f49f9d96537e79f83ca7e843b60e892712549 (patch) | |
tree | 3eecea518dcac0bb2f9ca7bc02e524ce1975fa5d /transex3 | |
parent | 1d639d2c5ba9b8933cc778dfde0698af9ac64eb9 (diff) |
INTEGRATION: CWS encup (1.29.22); FILE MERGED
2005/07/12 16:45:05 ihi 1.29.22.4: #i49922# source lang detection
2005/06/01 17:36:50 ihi 1.29.22.3: #123272# ( joined from cws mmw02 ) migrationanalysis projects gets german translation via localize.sdf
2005/05/26 13:24:49 ihi 1.29.22.2: #i39452# Fix
2005/05/12 17:37:06 ihi 1.29.22.1: #i39452# Allow merging of source languages
Diffstat (limited to 'transex3')
-rw-r--r-- | transex3/source/export2.cxx | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/transex3/source/export2.cxx b/transex3/source/export2.cxx index ed2877699607..c6ed9647b99f 100644 --- a/transex3/source/export2.cxx +++ b/transex3/source/export2.cxx @@ -4,9 +4,9 @@ * * $RCSfile: export2.cxx,v $ * - * $Revision: 1.31 $ + * $Revision: 1.32 $ * - * last change: $Author: rt $ $Date: 2005-09-09 14:59:33 $ + * last change: $Author: hr $ $Date: 2005-09-23 14:29:55 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -298,6 +298,12 @@ void Export::RemoveUTF8ByteOrderMarkerFromFile( const ByteString &rFilename ){ // Merge it into source code! bool Export::isMergingGermanAllowed( const ByteString& rPrj ){ + static ByteStringBoolHashMap aHash; + + if( aHash.find( rPrj ) != aHash.end() ){ + return aHash[ rPrj ]; + } + ByteString sFile = GetEnv( "SRC_ROOT" ) ; sFile.Append("/"); sFile.Append( rPrj ); @@ -306,7 +312,9 @@ bool Export::isMergingGermanAllowed( const ByteString& rPrj ){ sFile.SearchAndReplaceAll('/','\\'); #endif DirEntry aFlagfile( sFile ); - return !aFlagfile.Exists(); + + aHash[ rPrj ] = !aFlagfile.Exists(); + return aHash[ rPrj ]; } /*****************************************************************************/ void Export::UnquotHTML( ByteString &rString ) @@ -341,7 +349,14 @@ void Export::UnquotHTML( ByteString &rString ) } rString = sReturn; } - +bool Export::isAllowed( ByteString &sLanguage ){ + // CAREFUL, ONLY MERGE SOURCE LANGUAGES IF YOUR KNOW WHAT YOU DO!!! +#ifdef MERGE_SOURCE_LANGUAGES + return true; +#else + return ! ( sLanguage.EqualsIgnoreCaseAscii("de") || sLanguage.EqualsIgnoreCaseAscii("en-US") ); +#endif +} /*****************************************************************************/ bool Export::LanguageAllowed( const ByteString &nLanguage ) /*****************************************************************************/ @@ -360,7 +375,8 @@ void Export::InitLanguages( bool bMergeMode ){ for ( USHORT x = 0; x < sLanguages.GetTokenCount( ',' ); x++ ){ sTmp = sLanguages.GetToken( x, ',' ).GetToken( 0, '=' ); sTmp.EraseLeadingAndTrailingChars(); - if( bMergeMode && ( sTmp.EqualsIgnoreCaseAscii("de") || sTmp.EqualsIgnoreCaseAscii("en-US") )){} + if( bMergeMode && !isAllowed( sTmp ) ){} + //if( bMergeMode && ( sTmp.EqualsIgnoreCaseAscii("de") || sTmp.EqualsIgnoreCaseAscii("en-US") )){} else if( !( (sTmp.GetChar(0)=='x' || sTmp.GetChar(0)=='X') && sTmp.GetChar(1)=='-' ) ){ aLanguages.push_back( sTmp ); } @@ -377,7 +393,8 @@ void Export::InitForcedLanguages( bool bMergeMode ){ for ( USHORT x = 0; x < sForcedLanguages.GetTokenCount( ',' ); x++ ){ sTmp = sForcedLanguages.GetToken( x, ',' ).GetToken( 0, '=' ); sTmp.EraseLeadingAndTrailingChars(); - if( bMergeMode && ( sTmp.EqualsIgnoreCaseAscii("de") || sTmp.EqualsIgnoreCaseAscii("en-US") )){} + if( bMergeMode && isAllowed( sTmp ) ){} + //if( bMergeMode && ( sTmp.EqualsIgnoreCaseAscii("de") || sTmp.EqualsIgnoreCaseAscii("en-US") )){} else if( !( (sTmp.GetChar(0)=='x' || sTmp.GetChar(0)=='X') && sTmp.GetChar(1)=='-' ) ) aForcedLanguages.push_back( sTmp ); } @@ -399,7 +416,8 @@ void Export::FillInFallbacks( ResData *pResData ) ByteString sCur; for( long int n = 0; n < aLanguages.size(); n++ ){ sCur = aLanguages[ n ]; - if( !sCur.EqualsIgnoreCaseAscii("de") && !sCur.EqualsIgnoreCaseAscii("en-US") ){ + if( isAllowed( sCur ) ){ + //if( !sCur.EqualsIgnoreCaseAscii("de") && !sCur.EqualsIgnoreCaseAscii("en-US") ){ ByteString nFallbackIndex = GetFallbackLanguage( sCur ); if( nFallbackIndex.Len() ){ if ( !pResData->sText[ sCur ].Len()) |