summaryrefslogtreecommitdiff
path: root/transex3
diff options
context:
space:
mode:
authorNils Fuhrmann <nf@openoffice.org>2001-05-28 07:25:29 +0000
committerNils Fuhrmann <nf@openoffice.org>2001-05-28 07:25:29 +0000
commit0827465e17854b47c5fe078340bb3da8a393f280 (patch)
tree9380e259702eac42ef4ab142966274939d4b4d83 /transex3
parente6d8f3fe23c2b652a0a8e5793fe1ac4d0af80524 (diff)
Support of changeable fallback language #87136#
Diffstat (limited to 'transex3')
-rw-r--r--transex3/source/cfglex.l7
-rw-r--r--transex3/source/cfgmerge.cxx35
-rw-r--r--transex3/source/export.cxx24
-rw-r--r--transex3/source/export2.cxx89
-rw-r--r--transex3/source/lngex.cxx8
-rw-r--r--transex3/source/lngmerge.cxx23
-rw-r--r--transex3/source/localize.cxx158
-rw-r--r--transex3/source/srclex.l4
8 files changed, 258 insertions, 90 deletions
diff --git a/transex3/source/cfglex.l b/transex3/source/cfglex.l
index 4cd61c25ccda..ba54f927d85c 100644
--- a/transex3/source/cfglex.l
+++ b/transex3/source/cfglex.l
@@ -156,7 +156,7 @@ main( int argc, char* argv[])
pOutput = GetOutputFile( argc, argv );
if ( !pOutput ) {
- fprintf( stdout, "Syntax: CFGEX[-p Prj][-r PrjRoot]-i FileIn [-o FileOut][-m DataBase][-e][-b][-u][-d DoneFile][-g[:dtd]][-UTF8][-L l1,l2,...]\n" );
+ fprintf( stdout, "Syntax: CFGEX[-p Prj][-r PrjRoot]-i FileIn [-o FileOut][-m DataBase][-e][-b][-u][-d DoneFile][-g[:dtd]][-UTF8][-L l1,l2,...][-ISO99 IsoCode]\n" );
fprintf( stdout, " Prj: Project\n" );
fprintf( stdout, " PrjRoot: Path to project root (..\\.. etc.)\n" );
fprintf( stdout, " FileIn: Source files (*.src)\n" );
@@ -169,6 +169,11 @@ main( int argc, char* argv[])
fprintf( stdout, " -d: enables generation of *.don if work is done\n" );
fprintf( stdout, " -UTF8: enable UTF8 as language independent encoding\n" );
fprintf( stdout, " -L: Restrict the handled languages. l1,l2,... are elements of (01,33,46,49...)\n" );
+ fprintf( stdout, " A fallback language can be defined like this: l1=f1.\n" );
+ fprintf( stdout, " f1, f2,... are also elements of (01,33,46,49...)\n" );
+ fprintf( stdout, " Example: -L 01,99=35\n" );
+ fprintf( stdout, " Restriction to 01 and 99, 35 will be fallback for 99\n" );
+ fprintf( stdout, " -ISO99: IsoCode is the full qualified ISO language code for language 99" );
return 1;
}
diff --git a/transex3/source/cfgmerge.cxx b/transex3/source/cfgmerge.cxx
index 2c8b2748e733..cc791eae0103 100644
--- a/transex3/source/cfgmerge.cxx
+++ b/transex3/source/cfgmerge.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: cfgmerge.cxx,v $
*
- * $Revision: 1.12 $
+ * $Revision: 1.13 $
*
- * last change: $Author: nf $ $Date: 2001-05-23 08:05:40 $
+ * last change: $Author: nf $ $Date: 2001-05-28 08:25:29 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -81,6 +81,7 @@ extern "C" { YYWarning( char * ); }
#define STATE_ERRORLOG 0x0007
#define STATE_UTF8 0x0008
#define STATE_LANGUAGES 0X0009
+#define STATE_ISOCODE99 0x000A
// set of global variables
BOOL bEnableExport;
@@ -144,6 +145,9 @@ extern char *GetOutputFile( int argc, char* argv[])
else if ( ByteString( argv[ i ] ).ToUpperAscii() == "-L" ) {
nState = STATE_LANGUAGES;
}
+ else if ( ByteString( argv[ i ] ).ToUpperAscii() == "-ISO99" ) {
+ nState = STATE_ISOCODE99;
+ }
else {
switch ( nState ) {
case STATE_NON: {
@@ -177,6 +181,10 @@ extern char *GetOutputFile( int argc, char* argv[])
Export::sLanguages = ByteString( argv[ i ]);
}
break;
+ case STATE_ISOCODE99: {
+ Export::sIsoCode99 = ByteString( argv[ i ]);
+ }
+ break;
}
}
}
@@ -283,6 +291,27 @@ int GetError()
}
//
+// class CfgStackData
+//
+
+/*****************************************************************************/
+void CfgStackData::FillInFallbacks()
+/*****************************************************************************/
+{
+ for ( USHORT i = 0; i < LANGUAGES; i++ ) {
+ if (( i != GERMAN_INDEX ) && ( i != ENGLISH_INDEX )) {
+ USHORT nFallbackIndex =
+ Export::GetLangIndex(
+ Export::GetFallbackLanguage( Export::LangId[ i ] ));
+ if ( nFallbackIndex < LANGUAGES ) {
+ if ( !sText[ i ].Len())
+ sText[ i ] = sText[ nFallbackIndex ];
+ }
+ }
+ }
+}
+
+//
// class CfgStack
//
@@ -585,6 +614,8 @@ void CfgExport::WorkOnRessourceEnd()
/*****************************************************************************/
{
if ( pOutputStream && bLocalize ) {
+ pStackData->FillInFallbacks();
+
if ( pStackData->sText[ GERMAN_INDEX ].Len() &&
( pStackData->sText[ ENGLISH_US_INDEX ].Len() ||
pStackData->sText[ ENGLISH_INDEX ].Len())
diff --git a/transex3/source/export.cxx b/transex3/source/export.cxx
index e73dc3bee8c4..ec652d4f388a 100644
--- a/transex3/source/export.cxx
+++ b/transex3/source/export.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: export.cxx,v $
*
- * $Revision: 1.12 $
+ * $Revision: 1.13 $
*
- * last change: $Author: nf $ $Date: 2001-05-23 08:05:40 $
+ * last change: $Author: nf $ $Date: 2001-05-28 08:25:29 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -124,30 +124,30 @@ extern char *GetOutputFile( int argc, char* argv[])
// parse command line
for( int i = 1; i < argc; i++ ) {
- if (( ByteString( argv[ i ]) == "-i" ) || ( argv[ i ] == "-I" )) {
+ if (( ByteString( argv[ i ]) == "-i" ) || ( ByteString( argv[ i ] ) == "-I" )) {
nState = STATE_INPUT; // next tokens specifies source files
}
- else if (( ByteString( argv[ i ]) == "-o" ) || ( argv[ i ] == "-O" )) {
+ else if (( ByteString( argv[ i ]) == "-o" ) || ( ByteString( argv[ i ] ) == "-O" )) {
nState = STATE_OUTPUT; // next token specifies the dest file
}
- else if (( ByteString( argv[ i ]) == "-p" ) || ( argv[ i ] == "-P" )) {
+ else if (( ByteString( argv[ i ]) == "-p" ) || ( ByteString( argv[ i ] ) == "-P" )) {
nState = STATE_PRJ; // next token specifies the cur. project
}
- else if (( ByteString( argv[ i ]) == "-r" ) || ( argv[ i ] == "-R" )) {
+ else if (( ByteString( argv[ i ]) == "-r" ) || ( ByteString( argv[ i ] ) == "-R" )) {
nState = STATE_ROOT; // next token specifies path to project root
}
- else if (( ByteString( argv[ i ]) == "-m" ) || ( argv[ i ] == "-M" )) {
+ else if (( ByteString( argv[ i ]) == "-m" ) || ( ByteString( argv[ i ] ) == "-M" )) {
nState = STATE_MERGESRC; // next token specifies the merge database
}
- else if (( ByteString( argv[ i ]) == "-e" ) || ( argv[ i ] == "-E" )) {
+ else if (( ByteString( argv[ i ]) == "-e" ) || ( ByteString( argv[ i ] ) == "-E" )) {
nState = STATE_ERRORLOG;
bErrorLog = FALSE;
}
- else if (( ByteString( argv[ i ]) == "-b" ) || ( argv[ i ] == "-B" )) {
+ else if (( ByteString( argv[ i ] ) == "-b" ) || ( ByteString( argv[ i ] ) == "-B" )) {
nState = STATE_BREAKHELP;
bBreakWhenHelpText = TRUE;
}
- else if (( ByteString( argv[ i ]) == "-u" ) || ( argv[ i ] == "-U" )) {
+ else if (( ByteString( argv[ i ]) == "-u" ) || ( ByteString( argv[ i ] ) == "-U" )) {
nState = STATE_UNMERGE;
bUnmerge = TRUE;
bMergeMode = TRUE;
@@ -156,7 +156,7 @@ extern char *GetOutputFile( int argc, char* argv[])
nState = STATE_UTF8;
bUTF8 = TRUE;
}
- else if (( ByteString( argv[ i ]) == "-l" ) || ( argv[ i ] == "-L" )) {
+ else if (( ByteString( argv[ i ]) == "-l" ) || ( ByteString( argv[ i ]) == "-L" )) {
nState = STATE_LANGUAGES;
}
else {
@@ -1229,6 +1229,8 @@ BOOL Export::WriteData( ResData *pResData, BOOL bCreateNew )
return TRUE;
// fprintf( stdout, "." );
+ FillInFallbacks( pResData );
+
// mandatory to export: german and eng. and/or enus
if (( pResData->sText[ GERMAN_INDEX ].Len() &&
( pResData->sText[ ENGLISH_US_INDEX ].Len() ||
diff --git a/transex3/source/export2.cxx b/transex3/source/export2.cxx
index 60d189d1876f..9d64bfb53019 100644
--- a/transex3/source/export2.cxx
+++ b/transex3/source/export2.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: export2.cxx,v $
*
- * $Revision: 1.8 $
+ * $Revision: 1.9 $
*
- * last change: $Author: nf $ $Date: 2001-05-23 08:05:40 $
+ * last change: $Author: nf $ $Date: 2001-05-28 08:25:29 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -104,6 +104,7 @@ ResData::~ResData()
/*****************************************************************************/
ByteString Export::sLanguages;
+ByteString Export::sIsoCode99;
/*****************************************************************************/
/*****************************************************************************/
@@ -139,7 +140,8 @@ USHORT Export::LangId[ LANGUAGES ] =
TURKISH,
ARABIC,
HEBREW,
- CATALAN
+ CATALAN,
+ EXTERN
};
@@ -186,6 +188,7 @@ CharSet Export::GetCharSet( USHORT nLangId )
case ARABIC: return RTL_TEXTENCODING_MS_1256;
case HEBREW: return RTL_TEXTENCODING_MS_1255;
case CATALAN: return RTL_TEXTENCODING_MS_1252;
+ case EXTERN: return RTL_TEXTENCODING_UTF8;
}
return 0xFFFF;
}
@@ -254,6 +257,8 @@ USHORT Export::GetLangByIsoLang( const ByteString &rIsoLang )
return HEBREW;
else if ( sLang == ByteString( CATALAN_ISO ).ToUpperAscii())
return CATALAN;
+ else if ( sLang == sIsoCode99 )
+ return EXTERN;
return 0xFFFF;
}
@@ -291,6 +296,7 @@ ByteString Export::GetIsoLangByIndex( USHORT nIndex )
case ARABIC_INDEX: return ARABIC_ISO;
case HEBREW_INDEX: return HEBREW_ISO;
case CATALAN_INDEX: return CATALAN_ISO;
+ case EXTERN_INDEX: return sIsoCode99;
}
return "";
}
@@ -414,19 +420,90 @@ const ByteString Export::LangName[ LANGUAGES ] =
"turkish",
"arabic",
"hebrew",
- "catalan"
+ "catalan",
+ "extern"
};
/*****************************************************************************/
BOOL Export::LanguageAllowed( USHORT nLanguage )
/*****************************************************************************/
{
- if ( !sLanguages.Len())
+ if ( !sLanguages.Len() && ( nLanguage != 99 ))
return TRUE;
for ( ULONG i = 0; i < sLanguages.GetTokenCount( ',' ); i++ )
- if ( nLanguage == sLanguages.GetToken( i, ',' ).ToInt32())
+ if ( nLanguage ==
+ sLanguages.GetToken( i, ',' ).GetToken( 0, '=' ).ToInt32())
return TRUE;
return FALSE;
}
+
+/*****************************************************************************/
+USHORT Export::GetFallbackLanguage( USHORT nLanguage )
+/*****************************************************************************/
+{
+ for ( ULONG i = 0; i < sLanguages.GetTokenCount( ',' ); i++ )
+ if ( nLanguage ==
+ sLanguages.GetToken( i, ',' ).GetToken( 0, '=' ).ToInt32())
+ {
+ if ( sLanguages.GetToken( i, ',' ).GetTokenCount( '=' ) > 1 )
+ return
+ sLanguages.GetToken( i, ',' ).GetToken( 1, '=' ).ToInt32();
+ else
+ return nLanguage;
+ }
+
+ return nLanguage;
+}
+
+/*****************************************************************************/
+void Export::FillInFallbacks( ResData *pResData )
+/*****************************************************************************/
+{
+ for ( USHORT i = 0; i < LANGUAGES; i++ ) {
+ if (( i != GERMAN_INDEX ) && ( i != ENGLISH_INDEX )) {
+ USHORT nFallbackIndex =
+ GetLangIndex( GetFallbackLanguage( LangId[ i ] ));
+ if ( nFallbackIndex < LANGUAGES ) {
+ if ( !pResData->sText[ i ].Len())
+ pResData->sText[ i ] =
+ pResData->sText[ nFallbackIndex ];
+ if ( !pResData->sHelpText[ i ].Len())
+ pResData->sHelpText[ i ] =
+ pResData->sHelpText[ nFallbackIndex ];
+ if ( !pResData->sQuickHelpText[ i ].Len())
+ pResData->sQuickHelpText[ i ] =
+ pResData->sQuickHelpText[ nFallbackIndex ];
+ if ( !pResData->sTitle[ i ].Len())
+ pResData->sTitle[ i ] =
+ pResData->sTitle[ nFallbackIndex ];
+
+ if ( pResData->pStringList )
+ FillInListFallbacks(
+ pResData->pStringList, i, nFallbackIndex );
+ if ( pResData->pFilterList )
+ FillInListFallbacks(
+ pResData->pFilterList, i, nFallbackIndex );
+ if ( pResData->pItemList )
+ FillInListFallbacks(
+ pResData->pItemList, i, nFallbackIndex );
+ if ( pResData->pUIEntries )
+ FillInListFallbacks(
+ pResData->pUIEntries, i, nFallbackIndex );
+ }
+ }
+ }
+}
+
+/*****************************************************************************/
+void Export::FillInListFallbacks(
+ ExportList *pList, USHORT nSource, USHORT nFallback )
+/*****************************************************************************/
+{
+ for ( ULONG i = 0; i < pList->Count(); i++ ) {
+ ExportListEntry *pEntry = pList->GetObject( i );
+ if ( !( *pEntry )[ nSource ].Len())
+ ( *pEntry )[ nSource ] = ( *pEntry )[ nFallback ];
+ }
+}
diff --git a/transex3/source/lngex.cxx b/transex3/source/lngex.cxx
index 3cc93af548f5..56d7393def34 100644
--- a/transex3/source/lngex.cxx
+++ b/transex3/source/lngex.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: lngex.cxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: nf $ $Date: 2001-05-23 08:05:40 $
+ * last change: $Author: nf $ $Date: 2001-05-28 08:25:29 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -193,6 +193,10 @@ void Help()
fprintf( stdout, " -u: no function\n" );
fprintf( stdout, " -UTF8: enable UTF8 as language independent encoding\n" );
fprintf( stdout, " -L: Restrict the handled languages. l1,l2,... are elements of (01,33,46,49...)\n" );
+ fprintf( stdout, " A fallback language can be defined like this: l1=f1.\n" );
+ fprintf( stdout, " f1, f2,... are also elements of (01,33,46,49...)\n" );
+ fprintf( stdout, " Example: -L 01,99=35\n" );
+ fprintf( stdout, " Restriction to 01 and 99, 35 will be fallback for 99\n" );
}
/*****************************************************************************/
diff --git a/transex3/source/lngmerge.cxx b/transex3/source/lngmerge.cxx
index 03004edb556f..3218a31143a4 100644
--- a/transex3/source/lngmerge.cxx
+++ b/transex3/source/lngmerge.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: lngmerge.cxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: nf $ $Date: 2001-05-16 13:06:14 $
+ * last change: $Author: nf $ $Date: 2001-05-28 08:25:29 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -105,6 +105,23 @@ LngParser::~LngParser()
}
/*****************************************************************************/
+void LngParser::FillInFallbacks( ByteString *Text )
+/*****************************************************************************/
+{
+ for ( USHORT i = 0; i < LANGUAGES; i++ ) {
+ if (( i != GERMAN_INDEX ) && ( i != ENGLISH_INDEX )) {
+ USHORT nFallbackIndex =
+ Export::GetLangIndex(
+ Export::GetFallbackLanguage( Export::LangId[ i ] ));
+ if ( nFallbackIndex < LANGUAGES ) {
+ if ( !Text[ i ].Len())
+ Text[ i ] = Text[ nFallbackIndex ];
+ }
+ }
+ }
+}
+
+/*****************************************************************************/
BOOL LngParser::CreateSDF(
const ByteString &rSDFFile, const ByteString &rPrj,
const ByteString &rRoot )
@@ -195,6 +212,8 @@ BOOL LngParser::CreateSDF(
sTimeStamp += ":";
sTimeStamp += ByteString::CreateFromInt32( aTime.GetSec());
+ FillInFallbacks( Text );
+
for ( ULONG i = 0; i < LANGUAGES; i++ ) {
if ( LANGUAGE_ALLOWED( i )) {
ByteString sAct = Text[ i ];
diff --git a/transex3/source/localize.cxx b/transex3/source/localize.cxx
index 34fb7fec3c37..2a22f1c75a9f 100644
--- a/transex3/source/localize.cxx
+++ b/transex3/source/localize.cxx
@@ -3,9 +3,9 @@
*
* $RCSfile: localize.cxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: nf $ $Date: 2001-05-22 14:11:52 $
+ * last change: $Author: nf $ $Date: 2001-05-28 08:25:29 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -69,15 +69,15 @@
// SourceTreeLocalizer
//
-const char *ExeTable[][4] = {
- { "src", "transex3", "-UTF8", "negative" },
- { "hrc", "transex3", "-UTF8", "positive" },
- { "lng", "lngex", "-UTF8", "negative" },
- { "xrb", "xmlex", "-UTF8", "negative" },
- { "xxl", "xmlex", "-UTF8", "negative" },
- { "xgf", "xmlex", "-UTF8 -t:xgf", "negative" },
- { "xcd", "cfgex", "-UTF8", "negative" },
- { "NULL", "NULL", "NULL", "NULL" }
+const char *ExeTable[][5] = {
+ { "src", "transex3", "-UTF8", "negative", "noiso" },
+ { "hrc", "transex3", "-UTF8", "positive", "noiso" },
+ { "lng", "lngex", "-UTF8", "negative", "noiso" },
+ { "xrb", "xmlex", "-UTF8", "negative", "iso" },
+ { "xxl", "xmlex", "-UTF8", "negative", "iso" },
+ { "xgf", "xmlex", "-UTF8 -t:xgf", "negative", "iso" },
+ { "xcd", "cfgex", "-UTF8", "negative", "iso" },
+ { "NULL", "NULL", "NULL", "NULL", "NULL" }
};
const char *NegativeList[] = {
@@ -110,6 +110,9 @@ private:
SvFileStream aSDF;
USHORT nMode;
+ ByteString sLanguageRestriction;
+ ByteString sIsoCode99;
+
const DirEntry GetTempFile();
const ByteString GetProjectName( BOOL bAbs = FALSE );
const ByteString GetProjectRootRel();
@@ -120,7 +123,8 @@ private:
void WorkOnFile(
const ByteString &rFileName,
const ByteString &rExecutable,
- const ByteString &rParameter
+ const ByteString &rParameter,
+ const ByteString &rIso
);
void WorkOnFileType(
@@ -128,7 +132,8 @@ private:
const ByteString &rExtension,
const ByteString &rExecutable,
const ByteString &rParameter,
- const ByteString &rCollectMode
+ const ByteString &rCollectMode,
+ const ByteString &rIso
);
void WorkOnDirectory( const ByteString &rDirectory );
@@ -136,6 +141,11 @@ public:
SourceTreeLocalizer( const ByteString &rRoot, const ByteString &rVersion );
~SourceTreeLocalizer();
+ void SetLanguageRestriction( const ByteString& rRestrictions )
+ { sLanguageRestriction = rRestrictions; }
+ void SetIsoCode99( const ByteString& rIsoCode )
+ { sIsoCode99 = rIsoCode; }
+
BOOL Extract( const ByteString &rDestinationFile );
BOOL Merge( const ByteString &rSourceFile );
@@ -227,64 +237,77 @@ const DirEntry SourceTreeLocalizer::GetTempFile()
/*****************************************************************************/
void SourceTreeLocalizer::WorkOnFile(
const ByteString &rFileName, const ByteString &rExecutable,
- const ByteString &rParameter )
+ const ByteString &rParameter, const ByteString &rIso )
/*****************************************************************************/
{
- String sFull( rFileName, RTL_TEXTENCODING_ASCII_US );
- DirEntry aEntry( sFull );
- ByteString sFileName( aEntry.GetName(), RTL_TEXTENCODING_ASCII_US );
+ if (( rIso == "noiso" ) || sIsoCode99.Len()) {
+ String sFull( rFileName, RTL_TEXTENCODING_ASCII_US );
+ DirEntry aEntry( sFull );
+ ByteString sFileName( aEntry.GetName(), RTL_TEXTENCODING_ASCII_US );
- // set current working directory
- DirEntry aPath( aEntry.GetPath());
- DirEntry aOldCWD;
- aPath.SetCWD();
+ // set current working directory
+ DirEntry aPath( aEntry.GetPath());
+ DirEntry aOldCWD;
+ aPath.SetCWD();
- ByteString sPrj( GetProjectName());
- if ( sPrj.Len()) {
- ByteString sRoot( GetProjectRootRel());
+ ByteString sPrj( GetProjectName());
+ if ( sPrj.Len()) {
+ ByteString sRoot( GetProjectRootRel());
- // get temp file
- DirEntry aTemp( GetTempFile());
- ByteString sTempFile( aTemp.GetFull(), RTL_TEXTENCODING_ASCII_US );
+ // get temp file
+ DirEntry aTemp( GetTempFile());
+ ByteString sTempFile( aTemp.GetFull(), RTL_TEXTENCODING_ASCII_US );
- ByteString sExecutable( rExecutable );
+ ByteString sExecutable( rExecutable );
#ifdef WNT
- sExecutable += ".exe";
- String sPath( GetEnv( "PATH" ), RTL_TEXTENCODING_ASCII_US );
+ sExecutable += ".exe";
+ String sPath( GetEnv( "PATH" ), RTL_TEXTENCODING_ASCII_US );
#else
- String sPath( GetEnv( "LD_LIBRARY_PATH" ), RTL_TEXTENCODING_ASCII_US );
+ String sPath( GetEnv( "LD_LIBRARY_PATH" ), RTL_TEXTENCODING_ASCII_US );
#endif
- DirEntry aExecutable( String( sExecutable, RTL_TEXTENCODING_ASCII_US ));
- aExecutable.Find( sPath );
-
- ByteString sCommand( aExecutable.GetFull(), RTL_TEXTENCODING_ASCII_US );
- sCommand += " ";
- sCommand += rParameter;
- sCommand += " -p ";
- sCommand += sPrj;
- sCommand += " -r ";
- sCommand += sRoot;
- sCommand += " -i ";
- sCommand += sFileName;
- sCommand += " -o ";
- sCommand += sTempFile;
-
- system( sCommand.GetBuffer());
-
- SvFileStream aSDFIn( aTemp.GetFull(), STREAM_STD_READ );
- ByteString sLine;
- while ( !aSDFIn.IsEof()) {
- aSDFIn.ReadLine( sLine );
- if ( sLine.Len())
- aSDF.WriteLine( sLine );
+ DirEntry aExecutable( String( sExecutable, RTL_TEXTENCODING_ASCII_US ));
+ aExecutable.Find( sPath );
+
+ ByteString sCommand( aExecutable.GetFull(), RTL_TEXTENCODING_ASCII_US );
+ sCommand += " ";
+ sCommand += rParameter;
+ sCommand += " -p ";
+ sCommand += sPrj;
+ sCommand += " -r ";
+ sCommand += sRoot;
+ sCommand += " -i ";
+ sCommand += sFileName;
+ sCommand += " -o ";
+ sCommand += sTempFile;
+ if ( sLanguageRestriction.Len()) {
+ sCommand += " -l ";
+ sCommand += sLanguageRestriction;
+ }
+ if ( rIso == "iso" ) {
+ sCommand += "-ISO99";
+ sCommand += sIsoCode99;
+ }
+
+ system( sCommand.GetBuffer());
+
+ SvFileStream aSDFIn( aTemp.GetFull(), STREAM_STD_READ );
+ ByteString sLine;
+ while ( !aSDFIn.IsEof()) {
+ aSDFIn.ReadLine( sLine );
+ if ( sLine.Len())
+ aSDF.WriteLine( sLine );
+ }
+ aSDFIn.Close();
+
+ aTemp.Kill();
}
- aSDFIn.Close();
-
- aTemp.Kill();
+ // reset current working directory
+ aOldCWD.SetCWD();
+ }
+ else {
+ fprintf( stdout, "ERROR: Iso code required for file %s\n", rFileName.GetBuffer());
}
- // reset current working directory
- aOldCWD.SetCWD();
}
/*****************************************************************************/
@@ -347,7 +370,7 @@ BOOL SourceTreeLocalizer::CheckPositiveList( const ByteString &rFileName )
void SourceTreeLocalizer::WorkOnFileType(
const ByteString &rDirectory, const ByteString &rExtension,
const ByteString &rExecutable, const ByteString &rParameter,
- const ByteString &rCollectMode
+ const ByteString &rCollectMode, const ByteString &rIso
)
/*****************************************************************************/
{
@@ -370,10 +393,8 @@ void SourceTreeLocalizer::WorkOnFileType(
else if ( rCollectMode == "positive" )
bAllowed = CheckPositiveList( sFile );
- if ( bAllowed ) {
- fprintf( stdout, "%s\n", sFile.GetBuffer());
- WorkOnFile( sFile, rExecutable, rParameter );
- }
+ if ( bAllowed )
+ WorkOnFile( sFile, rExecutable, rParameter, rIso );
}
}
@@ -386,6 +407,7 @@ void SourceTreeLocalizer::WorkOnDirectory( const ByteString &rDirectory )
ByteString sExecutable( ExeTable[ nIndex ][ 1 ] );
ByteString sParameter( ExeTable[ nIndex ][ 2 ] );
ByteString sCollectMode( ExeTable[ nIndex ][ 3 ] );
+ ByteString sIso( ExeTable[ nIndex ][ 4 ] );
while( sExtension != "NULL" ) {
WorkOnFileType(
@@ -393,7 +415,8 @@ void SourceTreeLocalizer::WorkOnDirectory( const ByteString &rDirectory )
sExtension,
sExecutable,
sParameter,
- sCollectMode
+ sCollectMode,
+ sIso
);
nIndex++;
@@ -402,6 +425,7 @@ void SourceTreeLocalizer::WorkOnDirectory( const ByteString &rDirectory )
sExecutable = ExeTable[ nIndex ][ 1 ];
sParameter = ExeTable[ nIndex ][ 2 ];
sCollectMode = ExeTable[ nIndex ][ 3 ];
+ sIso = ExeTable[ nIndex ][ 4 ];
}
}
@@ -471,7 +495,9 @@ int _cdecl main( int argc, char *argv[] )
}
SourceTreeLocalizer aIter( sRoot, sVersion );
- aIter.Extract( "x:\\nf\\test.txt" );
+ aIter.SetLanguageRestriction( "01,99=35" );
+ aIter.SetIsoCode99( "de-CH" );
+ aIter.Extract( "x:\\nf\\test.txt" );
return 0;
}
diff --git a/transex3/source/srclex.l b/transex3/source/srclex.l
index 6e4deede9b69..b5e28ef33c68 100644
--- a/transex3/source/srclex.l
+++ b/transex3/source/srclex.l
@@ -259,6 +259,10 @@ main( int argc, char* argv[])
fprintf( stdout, " -u: [english] and [german] are allowed, Id is Taken from DataBase \n" );
fprintf( stdout, " -UTF8: enable UTF8 as language independent encoding\n" );
fprintf( stdout, " -L: Restrict the handled languages. l1,l2,... are elements of (01,33,46,49...)\n" );
+ fprintf( stdout, " A fallback language can be defined like this: l1=f1.\n" );
+ fprintf( stdout, " f1, f2,... are also elements of (01,33,46,49...)\n" );
+ fprintf( stdout, " Example: -L 01,99=35\n" );
+ fprintf( stdout, " Restriction to 01 and 99, 35 will be fallback for 99\n" );
return 1;
}