2000-11-20 12:49:48 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-10 08:38:36 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2000-11-20 12:49:48 +00:00
|
|
|
*
|
2010-02-12 15:01:35 +01:00
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
2000-11-20 12:49:48 +00:00
|
|
|
*
|
2008-04-10 08:38:36 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2000-11-20 12:49:48 +00:00
|
|
|
*
|
2008-04-10 08:38:36 +00:00
|
|
|
* This file is part of OpenOffice.org.
|
2000-11-20 12:49:48 +00:00
|
|
|
*
|
2008-04-10 08:38:36 +00:00
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
* only, as published by the Free Software Foundation.
|
2000-11-20 12:49:48 +00:00
|
|
|
*
|
2008-04-10 08:38:36 +00:00
|
|
|
* OpenOffice.org is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public License version 3 for more details
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
2000-11-20 12:49:48 +00:00
|
|
|
*
|
2008-04-10 08:38:36 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
* for a copy of the LGPLv3 License.
|
2000-11-20 12:49:48 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
2006-09-17 07:16:23 +00:00
|
|
|
|
|
|
|
// MARKER(update_precomp.py): autogen include statement, do not remove
|
2010-01-25 17:20:55 +01:00
|
|
|
#include "precompiled_l10ntools.hxx"
|
2000-11-20 12:49:48 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <tools/string.hxx>
|
|
|
|
#include <tools/fsys.hxx>
|
|
|
|
|
|
|
|
// local includes
|
|
|
|
#include "export.hxx"
|
2000-11-20 13:45:29 +00:00
|
|
|
#include "cfgmerge.hxx"
|
2000-11-20 12:49:48 +00:00
|
|
|
#include "tokens.h"
|
|
|
|
#include "utf8conv.hxx"
|
|
|
|
|
2003-06-13 10:40:34 +00:00
|
|
|
extern "C" { int yyerror( char * ); }
|
|
|
|
extern "C" { int YYWarning( char * ); }
|
2000-11-20 12:49:48 +00:00
|
|
|
|
|
|
|
// defines to parse command line
|
|
|
|
#define STATE_NON 0x0001
|
|
|
|
#define STATE_INPUT 0x0002
|
|
|
|
#define STATE_OUTPUT 0x0003
|
|
|
|
#define STATE_PRJ 0x0004
|
|
|
|
#define STATE_ROOT 0x0005
|
|
|
|
#define STATE_MERGESRC 0x0006
|
|
|
|
#define STATE_ERRORLOG 0x0007
|
2001-04-25 09:17:04 +00:00
|
|
|
#define STATE_UTF8 0x0008
|
2001-05-23 07:05:40 +00:00
|
|
|
#define STATE_LANGUAGES 0X0009
|
2001-05-28 07:25:29 +00:00
|
|
|
#define STATE_ISOCODE99 0x000A
|
2003-03-27 16:10:50 +00:00
|
|
|
#define STATE_FORCE 0x000B
|
2000-11-20 12:49:48 +00:00
|
|
|
|
|
|
|
// set of global variables
|
|
|
|
BOOL bEnableExport;
|
|
|
|
BOOL bMergeMode;
|
|
|
|
BOOL bErrorLog;
|
2003-03-27 16:10:50 +00:00
|
|
|
BOOL bForce;
|
2001-04-25 09:17:04 +00:00
|
|
|
BOOL bUTF8;
|
2000-11-20 12:49:48 +00:00
|
|
|
ByteString sPrj;
|
|
|
|
ByteString sPrjRoot;
|
|
|
|
ByteString sInputFileName;
|
|
|
|
ByteString sActFileName;
|
2008-06-04 08:48:29 +00:00
|
|
|
ByteString sFullEntry;
|
2000-11-20 12:49:48 +00:00
|
|
|
ByteString sOutputFile;
|
|
|
|
ByteString sMergeSrc;
|
2004-11-02 15:03:47 +00:00
|
|
|
String sUsedTempFile;
|
2000-11-20 12:49:48 +00:00
|
|
|
|
2000-11-22 09:53:28 +00:00
|
|
|
CfgParser *pParser;
|
|
|
|
|
2000-11-20 12:49:48 +00:00
|
|
|
extern "C" {
|
|
|
|
// the whole interface to lexer is in this extern "C" section
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
extern char *GetOutputFile( int argc, char* argv[])
|
|
|
|
/*****************************************************************************/
|
|
|
|
{
|
2004-07-13 12:51:15 +00:00
|
|
|
bEnableExport = FALSE;
|
|
|
|
bMergeMode = FALSE;
|
|
|
|
bErrorLog = TRUE;
|
|
|
|
bForce = FALSE;
|
|
|
|
bUTF8 = TRUE;
|
|
|
|
sPrj = "";
|
|
|
|
sPrjRoot = "";
|
|
|
|
sInputFileName = "";
|
|
|
|
sActFileName = "";
|
2000-11-20 12:49:48 +00:00
|
|
|
|
|
|
|
USHORT nState = STATE_NON;
|
|
|
|
BOOL bInput = FALSE;
|
|
|
|
|
|
|
|
// parse command line
|
|
|
|
for( int i = 1; i < argc; i++ ) {
|
2006-06-19 16:21:15 +00:00
|
|
|
ByteString sSwitch( argv[ i ] );
|
|
|
|
sSwitch.ToUpperAscii();
|
|
|
|
|
|
|
|
if ( sSwitch == "-I" ) {
|
2000-11-20 12:49:48 +00:00
|
|
|
nState = STATE_INPUT; // next token specifies source file
|
|
|
|
}
|
2006-06-19 16:21:15 +00:00
|
|
|
else if ( sSwitch == "-O" ) {
|
2000-11-20 12:49:48 +00:00
|
|
|
nState = STATE_OUTPUT; // next token specifies the dest file
|
|
|
|
}
|
2006-06-19 16:21:15 +00:00
|
|
|
else if ( sSwitch == "-P" ) {
|
2000-11-20 12:49:48 +00:00
|
|
|
nState = STATE_PRJ; // next token specifies the cur. project
|
|
|
|
}
|
2006-06-19 16:21:15 +00:00
|
|
|
else if ( sSwitch == "-R" ) {
|
2000-11-20 12:49:48 +00:00
|
|
|
nState = STATE_ROOT; // next token specifies path to project root
|
|
|
|
}
|
2006-06-19 16:21:15 +00:00
|
|
|
else if ( sSwitch == "-M" ) {
|
2000-11-20 12:49:48 +00:00
|
|
|
nState = STATE_MERGESRC; // next token specifies the merge database
|
|
|
|
}
|
2006-06-19 16:21:15 +00:00
|
|
|
else if ( sSwitch == "-E" ) {
|
2000-11-20 12:49:48 +00:00
|
|
|
nState = STATE_ERRORLOG;
|
|
|
|
bErrorLog = FALSE;
|
|
|
|
}
|
2006-06-19 16:21:15 +00:00
|
|
|
else if ( sSwitch == "-UTF8" ) {
|
2001-04-25 09:17:04 +00:00
|
|
|
nState = STATE_UTF8;
|
2001-05-16 07:18:11 +00:00
|
|
|
bUTF8 = TRUE;
|
2001-04-25 09:17:04 +00:00
|
|
|
}
|
2006-06-19 16:21:15 +00:00
|
|
|
else if ( sSwitch == "-NOUTF8" ) {
|
2001-05-31 08:44:37 +00:00
|
|
|
nState = STATE_UTF8;
|
|
|
|
bUTF8 = FALSE;
|
|
|
|
}
|
2006-06-19 16:21:15 +00:00
|
|
|
else if ( sSwitch == "-F" ) {
|
2003-03-27 16:10:50 +00:00
|
|
|
nState = STATE_FORCE;
|
|
|
|
bForce = TRUE;
|
|
|
|
}
|
2006-06-19 16:21:15 +00:00
|
|
|
else if ( sSwitch == "-L" ) {
|
2001-05-23 07:05:40 +00:00
|
|
|
nState = STATE_LANGUAGES;
|
|
|
|
}
|
2006-06-19 16:21:15 +00:00
|
|
|
else if ( sSwitch.ToUpperAscii() == "-ISO99" ) {
|
2001-05-28 07:25:29 +00:00
|
|
|
nState = STATE_ISOCODE99;
|
|
|
|
}
|
2000-11-20 12:49:48 +00:00
|
|
|
else {
|
|
|
|
switch ( nState ) {
|
|
|
|
case STATE_NON: {
|
|
|
|
return NULL; // no valid command line
|
|
|
|
}
|
|
|
|
case STATE_INPUT: {
|
|
|
|
sInputFileName = argv[ i ];
|
|
|
|
bInput = TRUE; // source file found
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case STATE_OUTPUT: {
|
|
|
|
sOutputFile = argv[ i ]; // the dest. file
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case STATE_PRJ: {
|
|
|
|
sPrj = ByteString( argv[ i ]);
|
2001-06-11 12:49:22 +00:00
|
|
|
// sPrj.ToLowerAscii(); // the project
|
2000-11-20 12:49:48 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case STATE_ROOT: {
|
|
|
|
sPrjRoot = ByteString( argv[ i ]); // path to project root
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case STATE_MERGESRC: {
|
|
|
|
sMergeSrc = ByteString( argv[ i ]);
|
|
|
|
bMergeMode = TRUE; // activate merge mode, cause merge database found
|
|
|
|
}
|
2001-05-23 07:05:40 +00:00
|
|
|
break;
|
|
|
|
case STATE_LANGUAGES: {
|
|
|
|
Export::sLanguages = ByteString( argv[ i ]);
|
|
|
|
}
|
|
|
|
break;
|
2000-11-20 12:49:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( bInput ) {
|
|
|
|
// command line is valid
|
|
|
|
bEnableExport = TRUE;
|
|
|
|
char *pReturn = new char[ sOutputFile.Len() + 1 ];
|
2002-12-12 16:00:09 +00:00
|
|
|
strcpy( pReturn, sOutputFile.GetBuffer()); // #100211# - checked
|
2000-11-20 12:49:48 +00:00
|
|
|
return pReturn;
|
|
|
|
}
|
|
|
|
|
|
|
|
// command line is not valid
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
/*****************************************************************************/
|
2006-03-29 12:26:12 +00:00
|
|
|
int InitCfgExport( char *pOutput , char* pFilename )
|
2000-11-20 12:49:48 +00:00
|
|
|
/*****************************************************************************/
|
|
|
|
{
|
|
|
|
// instanciate Export
|
|
|
|
ByteString sOutput( pOutput );
|
2006-03-29 12:26:12 +00:00
|
|
|
ByteString sFilename( pFilename );
|
2004-06-25 11:40:34 +00:00
|
|
|
Export::InitLanguages();
|
2000-11-22 09:53:28 +00:00
|
|
|
|
2000-11-22 12:56:02 +00:00
|
|
|
if ( bMergeMode )
|
2006-06-19 16:21:15 +00:00
|
|
|
pParser = new CfgMerge( sMergeSrc, sOutputFile, sFilename );
|
|
|
|
else if ( sOutputFile.Len())
|
2000-11-22 11:57:00 +00:00
|
|
|
pParser = new CfgExport( sOutputFile, sPrj, sActFileName );
|
2006-06-19 16:21:15 +00:00
|
|
|
|
2000-11-20 12:49:48 +00:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
int EndCfgExport()
|
|
|
|
/*****************************************************************************/
|
|
|
|
{
|
2000-11-22 09:53:28 +00:00
|
|
|
delete pParser;
|
|
|
|
|
2000-11-20 12:49:48 +00:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2004-11-02 15:03:47 +00:00
|
|
|
void removeTempFile(){
|
|
|
|
if( !sUsedTempFile.EqualsIgnoreCaseAscii( "" ) ){
|
|
|
|
DirEntry aTempFile( sUsedTempFile );
|
|
|
|
aTempFile.Kill();
|
|
|
|
}
|
|
|
|
}
|
2006-03-29 12:26:12 +00:00
|
|
|
extern const char* getFilename()
|
|
|
|
{
|
2006-08-14 16:23:18 +00:00
|
|
|
return sInputFileName.GetBuffer();
|
2006-03-29 12:26:12 +00:00
|
|
|
}
|
2000-11-20 12:49:48 +00:00
|
|
|
/*****************************************************************************/
|
|
|
|
extern FILE *GetCfgFile()
|
|
|
|
/*****************************************************************************/
|
|
|
|
{
|
2004-11-02 15:03:47 +00:00
|
|
|
FILE *pFile = 0;
|
2000-11-20 12:49:48 +00:00
|
|
|
// look for valid filename
|
|
|
|
if ( sInputFileName.Len()) {
|
2004-11-02 15:03:47 +00:00
|
|
|
if( Export::fileHasUTF8ByteOrderMarker( sInputFileName ) ){
|
|
|
|
DirEntry aTempFile = Export::GetTempFile();
|
|
|
|
DirEntry aSourceFile( String( sInputFileName , RTL_TEXTENCODING_ASCII_US ) );
|
|
|
|
aSourceFile.CopyTo( aTempFile , FSYS_ACTION_COPYFILE );
|
|
|
|
String sTempFile = aTempFile.GetFull();
|
|
|
|
Export::RemoveUTF8ByteOrderMarkerFromFile( ByteString( sTempFile , RTL_TEXTENCODING_ASCII_US ) );
|
|
|
|
pFile = fopen( ByteString( sTempFile , RTL_TEXTENCODING_ASCII_US ).GetBuffer(), "r" );
|
|
|
|
sUsedTempFile = sTempFile;
|
|
|
|
}else{
|
|
|
|
// able to open file?
|
|
|
|
pFile = fopen( sInputFileName.GetBuffer(), "r" );
|
|
|
|
sUsedTempFile = String::CreateFromAscii("");
|
|
|
|
}
|
2006-01-03 13:45:56 +00:00
|
|
|
if ( !pFile ){
|
2000-11-20 12:49:48 +00:00
|
|
|
fprintf( stderr, "Error: Could not open file %s\n",
|
|
|
|
sInputFileName.GetBuffer());
|
2010-07-07 15:30:32 +02:00
|
|
|
exit( -13 );
|
2006-01-03 13:45:56 +00:00
|
|
|
}
|
2000-11-20 12:49:48 +00:00
|
|
|
else {
|
|
|
|
// this is a valid file which can be opened, so
|
|
|
|
// create path to project root
|
|
|
|
DirEntry aEntry( String( sInputFileName, RTL_TEXTENCODING_ASCII_US ));
|
|
|
|
aEntry.ToAbs();
|
2008-06-04 08:48:29 +00:00
|
|
|
sFullEntry= ByteString( aEntry.GetFull(), RTL_TEXTENCODING_ASCII_US );
|
2000-11-20 12:49:48 +00:00
|
|
|
aEntry += DirEntry( String( "..", RTL_TEXTENCODING_ASCII_US ));
|
|
|
|
aEntry += DirEntry( sPrjRoot );
|
|
|
|
ByteString sPrjEntry( aEntry.GetFull(), RTL_TEXTENCODING_ASCII_US );
|
|
|
|
|
|
|
|
// create file name, beginnig with project root
|
|
|
|
// (e.g.: source\ui\src\menue.src)
|
2008-06-04 08:48:29 +00:00
|
|
|
// printf("sFullEntry = %s\n",sFullEntry.GetBuffer());
|
2000-11-20 12:49:48 +00:00
|
|
|
sActFileName = sFullEntry.Copy( sPrjEntry.Len() + 1 );
|
2008-06-04 08:48:29 +00:00
|
|
|
// printf("sActFileName = %s\n",sActFileName.GetBuffer());
|
2001-06-06 07:12:57 +00:00
|
|
|
|
|
|
|
sActFileName.SearchAndReplaceAll( "/", "\\" );
|
|
|
|
|
2000-11-20 12:49:48 +00:00
|
|
|
return pFile;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// this means the file could not be opened
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
int WorkOnTokenSet( int nTyp, char *pTokenText )
|
|
|
|
/*****************************************************************************/
|
|
|
|
{
|
2000-11-22 09:53:28 +00:00
|
|
|
pParser->Execute( nTyp, pTokenText );
|
2000-11-20 12:49:48 +00:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
int SetError()
|
|
|
|
/*****************************************************************************/
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
int GetError()
|
|
|
|
/*****************************************************************************/
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-05-28 07:25:29 +00:00
|
|
|
//
|
|
|
|
// class CfgStackData
|
|
|
|
//
|
|
|
|
|
2006-06-19 16:21:15 +00:00
|
|
|
CfgStackData* CfgStack::Push( const ByteString &rTag, const ByteString &rId )
|
|
|
|
{
|
|
|
|
CfgStackData *pD = new CfgStackData( rTag, rId );
|
|
|
|
Insert( pD, LIST_APPEND );
|
|
|
|
return pD;
|
|
|
|
}
|
|
|
|
|
2000-11-20 13:45:29 +00:00
|
|
|
//
|
|
|
|
// class CfgStack
|
|
|
|
//
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
CfgStack::~CfgStack()
|
|
|
|
/*****************************************************************************/
|
|
|
|
{
|
|
|
|
for ( ULONG i = 0; i < Count(); i++ )
|
|
|
|
delete GetObject( i );
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
ByteString CfgStack::GetAccessPath( ULONG nPos )
|
|
|
|
/*****************************************************************************/
|
|
|
|
{
|
|
|
|
if ( nPos == LIST_APPEND )
|
|
|
|
nPos = Count() - 1;
|
|
|
|
|
|
|
|
ByteString sReturn;
|
|
|
|
for ( ULONG i = 0; i <= nPos; i++ ) {
|
|
|
|
if ( i )
|
|
|
|
sReturn += ".";
|
|
|
|
sReturn += GetStackData( i )->GetIdentifier();
|
|
|
|
}
|
|
|
|
|
|
|
|
return sReturn;
|
|
|
|
}
|
2000-11-22 09:53:28 +00:00
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
CfgStackData *CfgStack::GetStackData( ULONG nPos )
|
|
|
|
/*****************************************************************************/
|
|
|
|
{
|
|
|
|
if ( nPos == LIST_APPEND )
|
|
|
|
nPos = Count() - 1;
|
|
|
|
|
|
|
|
return GetObject( nPos );
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// class CfgParser
|
|
|
|
//
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
CfgParser::CfgParser()
|
|
|
|
/*****************************************************************************/
|
2000-12-05 09:34:16 +00:00
|
|
|
: pStackData( NULL ),
|
|
|
|
bLocalize( FALSE )
|
2000-11-22 09:53:28 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
CfgParser::~CfgParser()
|
|
|
|
/*****************************************************************************/
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
BOOL CfgParser::IsTokenClosed( const ByteString &rToken )
|
|
|
|
/*****************************************************************************/
|
|
|
|
{
|
|
|
|
return rToken.GetChar( rToken.Len() - 2 ) == '/';
|
|
|
|
}
|
|
|
|
|
2000-11-22 12:56:02 +00:00
|
|
|
/*****************************************************************************/
|
|
|
|
void CfgParser::AddText(
|
|
|
|
ByteString &rText,
|
|
|
|
const ByteString &rIsoLang,
|
|
|
|
const ByteString &rResTyp
|
2000-11-22 09:53:28 +00:00
|
|
|
)
|
|
|
|
/*****************************************************************************/
|
|
|
|
{
|
2003-07-11 09:10:59 +00:00
|
|
|
USHORT nTextLen = 0;
|
2003-07-14 07:39:00 +00:00
|
|
|
while ( rText.Len() != nTextLen ) {
|
|
|
|
nTextLen = rText.Len();
|
|
|
|
rText.SearchAndReplaceAll( "\n", " " );
|
|
|
|
rText.SearchAndReplaceAll( "\r", " " );
|
|
|
|
rText.SearchAndReplaceAll( "\t", " " );
|
|
|
|
rText.SearchAndReplaceAll( " ", " " );
|
2003-07-11 09:10:59 +00:00
|
|
|
}
|
2000-11-22 12:56:02 +00:00
|
|
|
pStackData->sResTyp = rResTyp;
|
2006-06-19 16:21:15 +00:00
|
|
|
WorkOnText( rText, rIsoLang );
|
|
|
|
|
2004-06-25 11:40:34 +00:00
|
|
|
pStackData->sText[ rIsoLang ] = rText;
|
|
|
|
}
|
|
|
|
|
2000-11-22 09:53:28 +00:00
|
|
|
|
|
|
|
/*****************************************************************************/
|
2000-11-22 12:56:02 +00:00
|
|
|
void CfgParser::WorkOnRessourceEnd()
|
2000-11-22 09:53:28 +00:00
|
|
|
/*****************************************************************************/
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
int CfgParser::ExecuteAnalyzedToken( int nToken, char *pToken )
|
|
|
|
/*****************************************************************************/
|
|
|
|
{
|
|
|
|
ByteString sToken( pToken );
|
|
|
|
|
2000-11-28 13:53:39 +00:00
|
|
|
if ( sToken == " " || sToken == "\t" )
|
|
|
|
sLastWhitespace += sToken;
|
|
|
|
|
2000-11-22 09:53:28 +00:00
|
|
|
ByteString sTokenName;
|
|
|
|
ByteString sTokenId;
|
|
|
|
|
2000-11-22 12:56:02 +00:00
|
|
|
BOOL bOutput = TRUE;
|
|
|
|
|
2000-11-22 09:53:28 +00:00
|
|
|
switch ( nToken ) {
|
|
|
|
case CFG_TOKEN_PACKAGE:
|
|
|
|
case CFG_TOKEN_COMPONENT:
|
|
|
|
case CFG_TOKEN_TEMPLATE:
|
|
|
|
case CFG_TOKEN_CONFIGNAME:
|
2002-06-03 12:02:59 +00:00
|
|
|
case CFG_TOKEN_OORNAME:
|
2003-04-29 15:47:57 +00:00
|
|
|
case CFG_TOKEN_OORVALUE:
|
2000-11-22 09:53:28 +00:00
|
|
|
case CFG_TAG:
|
|
|
|
case ANYTOKEN:
|
|
|
|
case CFG_TEXT_START:
|
|
|
|
{
|
2003-04-29 15:47:57 +00:00
|
|
|
sTokenName = sToken.GetToken( 1, '<' ).GetToken( 0, '>' ).GetToken( 0, ' ' );
|
2000-11-22 09:53:28 +00:00
|
|
|
|
2003-04-29 15:47:57 +00:00
|
|
|
if ( !IsTokenClosed( sToken )) {
|
2000-11-22 09:53:28 +00:00
|
|
|
ByteString sSearch;
|
|
|
|
switch ( nToken ) {
|
|
|
|
case CFG_TOKEN_PACKAGE:
|
|
|
|
sSearch = "package-id=";
|
|
|
|
break;
|
|
|
|
case CFG_TOKEN_COMPONENT:
|
|
|
|
sSearch = "component-id=";
|
|
|
|
break;
|
|
|
|
case CFG_TOKEN_TEMPLATE:
|
|
|
|
sSearch = "template-id=";
|
|
|
|
break;
|
|
|
|
case CFG_TOKEN_CONFIGNAME:
|
|
|
|
sSearch = "cfg:name=";
|
|
|
|
break;
|
2002-06-03 12:02:59 +00:00
|
|
|
case CFG_TOKEN_OORNAME:
|
|
|
|
sSearch = "oor:name=";
|
|
|
|
bLocalize = TRUE;
|
|
|
|
break;
|
2003-04-29 15:47:57 +00:00
|
|
|
case CFG_TOKEN_OORVALUE:
|
|
|
|
sSearch = "oor:value=";
|
|
|
|
break;
|
2000-11-22 09:53:28 +00:00
|
|
|
case CFG_TEXT_START: {
|
2003-03-27 16:10:50 +00:00
|
|
|
if ( sCurrentResTyp != sTokenName ) {
|
|
|
|
WorkOnRessourceEnd();
|
2004-06-25 11:40:34 +00:00
|
|
|
ByteString sCur;
|
2006-06-19 16:21:15 +00:00
|
|
|
for( unsigned int n = 0; n < aLanguages.size(); n++ ){
|
2004-06-25 11:40:34 +00:00
|
|
|
sCur = aLanguages[ n ];
|
|
|
|
pStackData->sText[ sCur ] = ByteString("");
|
|
|
|
}
|
2006-06-19 16:21:15 +00:00
|
|
|
}
|
2000-11-22 09:53:28 +00:00
|
|
|
sCurrentResTyp = sTokenName;
|
|
|
|
|
|
|
|
ByteString sTemp = sToken.Copy( sToken.Search( "xml:lang=" ));
|
|
|
|
sCurrentIsoLang = sTemp.GetToken( 1, '\"' ).GetToken( 0, '\"' );
|
|
|
|
|
2003-04-29 15:47:57 +00:00
|
|
|
if ( sCurrentIsoLang == NO_TRANSLATE_ISO )
|
|
|
|
bLocalize = FALSE;
|
|
|
|
|
2000-11-22 09:53:28 +00:00
|
|
|
pStackData->sTextTag = sToken;
|
|
|
|
|
|
|
|
sCurrentText = "";
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if ( sSearch.Len()) {
|
|
|
|
ByteString sTemp = sToken.Copy( sToken.Search( sSearch ));
|
|
|
|
sTokenId = sTemp.GetToken( 1, '\"' ).GetToken( 0, '\"' );
|
|
|
|
}
|
|
|
|
pStackData = aStack.Push( sTokenName, sTokenId );
|
2006-06-19 16:21:15 +00:00
|
|
|
|
2000-12-05 09:34:16 +00:00
|
|
|
if ( sSearch == "cfg:name=" ) {
|
|
|
|
ByteString sTemp( sToken );
|
|
|
|
sTemp.ToUpperAscii();
|
|
|
|
bLocalize = (( sTemp.Search( "CFG:TYPE=\"STRING\"" ) != STRING_NOTFOUND ) &&
|
|
|
|
( sTemp.Search( "CFG:LOCALIZED=\"TRUE\"" ) != STRING_NOTFOUND ));
|
|
|
|
}
|
2000-11-22 09:53:28 +00:00
|
|
|
}
|
2003-04-29 15:47:57 +00:00
|
|
|
else if ( sTokenName == "label" ) {
|
|
|
|
if ( sCurrentResTyp != sTokenName ) {
|
|
|
|
WorkOnRessourceEnd();
|
2004-06-25 11:40:34 +00:00
|
|
|
ByteString sCur;
|
2006-06-19 16:21:15 +00:00
|
|
|
for( unsigned int n = 0; n < aLanguages.size(); n++ ){
|
2004-06-25 11:40:34 +00:00
|
|
|
sCur = aLanguages[ n ];
|
|
|
|
pStackData->sText[ sCur ] = ByteString("");
|
|
|
|
}
|
2003-04-29 15:47:57 +00:00
|
|
|
}
|
|
|
|
sCurrentResTyp = sTokenName;
|
|
|
|
}
|
2000-11-22 09:53:28 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case CFG_CLOSETAG:
|
|
|
|
sTokenName = sToken.GetToken( 1, '/' ).GetToken( 0, '>' ).GetToken( 0, ' ' );
|
|
|
|
if ( aStack.GetStackData() && ( aStack.GetStackData()->GetTagType() == sTokenName )) {
|
2000-11-28 13:53:39 +00:00
|
|
|
if ( ! sCurrentText.Len())
|
|
|
|
WorkOnRessourceEnd();
|
2000-11-22 09:53:28 +00:00
|
|
|
aStack.Pop();
|
|
|
|
pStackData = aStack.GetStackData();
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
ByteString sError( "Missplaced close tag: " );
|
2008-06-04 08:48:29 +00:00
|
|
|
ByteString sInFile(" in file ");
|
2000-11-22 09:53:28 +00:00
|
|
|
sError += sToken;
|
2008-06-04 08:48:29 +00:00
|
|
|
sError += sInFile;
|
|
|
|
sError += sFullEntry;
|
2000-11-22 09:53:28 +00:00
|
|
|
Error( sError );
|
2006-01-03 13:45:56 +00:00
|
|
|
exit ( 13 );
|
2000-11-22 09:53:28 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case CFG_TEXTCHAR:
|
|
|
|
sCurrentText += sToken;
|
2000-11-22 12:56:02 +00:00
|
|
|
bOutput = FALSE;
|
2000-11-22 09:53:28 +00:00
|
|
|
break;
|
2003-04-29 15:47:57 +00:00
|
|
|
|
|
|
|
case CFG_TOKEN_NO_TRANSLATE:
|
|
|
|
bLocalize = FALSE;
|
|
|
|
break;
|
2000-11-22 09:53:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if ( sCurrentText.Len() && nToken != CFG_TEXTCHAR ) {
|
2000-11-22 12:56:02 +00:00
|
|
|
AddText( sCurrentText, sCurrentIsoLang, sCurrentResTyp );
|
|
|
|
Output( sCurrentText );
|
2000-11-22 09:53:28 +00:00
|
|
|
sCurrentText = "";
|
|
|
|
pStackData->sEndTextTag = sToken;
|
|
|
|
}
|
|
|
|
|
2000-11-22 12:56:02 +00:00
|
|
|
if ( bOutput )
|
|
|
|
Output( sToken );
|
|
|
|
|
2000-11-28 13:53:39 +00:00
|
|
|
if ( sToken != " " && sToken != "\t" )
|
|
|
|
sLastWhitespace = "";
|
|
|
|
|
2000-11-22 09:53:28 +00:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2000-11-22 12:56:02 +00:00
|
|
|
/*****************************************************************************/
|
2006-06-19 16:21:15 +00:00
|
|
|
void CfgExport::Output( const ByteString& rOutput )
|
2000-11-22 12:56:02 +00:00
|
|
|
/*****************************************************************************/
|
|
|
|
{
|
2006-06-19 16:21:15 +00:00
|
|
|
// Dummy operation to suppress warnings caused by poor class design
|
|
|
|
ByteString a( rOutput );
|
2000-11-22 12:56:02 +00:00
|
|
|
}
|
|
|
|
|
2000-11-22 09:53:28 +00:00
|
|
|
/*****************************************************************************/
|
|
|
|
int CfgParser::Execute( int nToken, char * pToken )
|
|
|
|
/*****************************************************************************/
|
|
|
|
{
|
|
|
|
ByteString sToken( pToken );
|
|
|
|
|
|
|
|
switch ( nToken ) {
|
|
|
|
case CFG_TAG:
|
|
|
|
if ( sToken.Search( "package-id=" ) != STRING_NOTFOUND )
|
|
|
|
return ExecuteAnalyzedToken( CFG_TOKEN_PACKAGE, pToken );
|
|
|
|
else if ( sToken.Search( "component-id=" ) != STRING_NOTFOUND )
|
|
|
|
return ExecuteAnalyzedToken( CFG_TOKEN_COMPONENT, pToken );
|
|
|
|
else if ( sToken.Search( "template-id=" ) != STRING_NOTFOUND )
|
|
|
|
return ExecuteAnalyzedToken( CFG_TOKEN_TEMPLATE, pToken );
|
|
|
|
else if ( sToken.Search( "cfg:name=" ) != STRING_NOTFOUND )
|
2002-06-03 12:02:59 +00:00
|
|
|
return ExecuteAnalyzedToken( CFG_TOKEN_OORNAME, pToken );
|
|
|
|
else if ( sToken.Search( "oor:name=" ) != STRING_NOTFOUND )
|
|
|
|
return ExecuteAnalyzedToken( CFG_TOKEN_OORNAME, pToken );
|
2003-04-29 15:47:57 +00:00
|
|
|
else if ( sToken.Search( "oor:value=" ) != STRING_NOTFOUND )
|
|
|
|
return ExecuteAnalyzedToken( CFG_TOKEN_OORVALUE, pToken );
|
2000-11-22 09:53:28 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
return ExecuteAnalyzedToken( nToken, pToken );
|
|
|
|
}
|
|
|
|
|
2000-11-22 11:57:00 +00:00
|
|
|
|
2000-11-22 09:53:28 +00:00
|
|
|
/*****************************************************************************/
|
2000-11-22 11:57:00 +00:00
|
|
|
void CfgParser::Error( const ByteString &rError )
|
2000-11-22 09:53:28 +00:00
|
|
|
/*****************************************************************************/
|
|
|
|
{
|
2008-06-04 08:48:29 +00:00
|
|
|
// ByteString sError( rError );
|
|
|
|
// sError.Append("Error: In file ");
|
|
|
|
// sError.Append( sActFileName );
|
2000-11-22 11:57:00 +00:00
|
|
|
yyerror(( char * ) rError.GetBuffer());
|
2000-11-22 09:53:28 +00:00
|
|
|
}
|
|
|
|
|
2000-11-22 11:57:00 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// class CfgOutputParser
|
|
|
|
//
|
|
|
|
|
2000-11-22 09:53:28 +00:00
|
|
|
/*****************************************************************************/
|
2000-11-22 11:57:00 +00:00
|
|
|
CfgOutputParser::CfgOutputParser( const ByteString &rOutputFile )
|
2000-11-22 09:53:28 +00:00
|
|
|
/*****************************************************************************/
|
|
|
|
{
|
2000-11-22 11:57:00 +00:00
|
|
|
pOutputStream =
|
|
|
|
new SvFileStream(
|
|
|
|
String( rOutputFile, RTL_TEXTENCODING_ASCII_US ),
|
|
|
|
STREAM_STD_WRITE | STREAM_TRUNC
|
|
|
|
);
|
2004-08-02 15:24:39 +00:00
|
|
|
pOutputStream->SetStreamCharSet( RTL_TEXTENCODING_UTF8 );
|
2000-11-22 11:57:00 +00:00
|
|
|
|
|
|
|
if ( !pOutputStream->IsOpen()) {
|
2006-01-03 13:45:56 +00:00
|
|
|
ByteString sError( "ERROR: Unable to open output file: " );
|
2000-11-22 11:57:00 +00:00
|
|
|
sError += rOutputFile;
|
|
|
|
Error( sError );
|
|
|
|
delete pOutputStream;
|
|
|
|
pOutputStream = NULL;
|
2010-07-07 15:30:32 +02:00
|
|
|
exit( -13 );
|
2000-11-22 11:57:00 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
CfgOutputParser::~CfgOutputParser()
|
|
|
|
/*****************************************************************************/
|
|
|
|
{
|
|
|
|
if ( pOutputStream ) {
|
|
|
|
pOutputStream->Close();
|
|
|
|
delete pOutputStream;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// class CfgExport
|
|
|
|
//
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
CfgExport::CfgExport(
|
|
|
|
const ByteString &rOutputFile,
|
|
|
|
const ByteString &rProject,
|
|
|
|
const ByteString &rFilePath
|
|
|
|
)
|
|
|
|
/*****************************************************************************/
|
|
|
|
: CfgOutputParser( rOutputFile ),
|
|
|
|
sPrj( rProject ),
|
|
|
|
sPath( rFilePath )
|
|
|
|
{
|
2004-06-25 11:40:34 +00:00
|
|
|
Export::InitLanguages( false );
|
|
|
|
aLanguages = Export::GetLanguages();
|
2000-11-22 11:57:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
CfgExport::~CfgExport()
|
|
|
|
/*****************************************************************************/
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
2000-11-22 12:56:02 +00:00
|
|
|
void CfgExport::WorkOnRessourceEnd()
|
2000-11-22 11:57:00 +00:00
|
|
|
/*****************************************************************************/
|
|
|
|
{
|
2000-12-05 09:34:16 +00:00
|
|
|
if ( pOutputStream && bLocalize ) {
|
2007-04-19 14:18:05 +00:00
|
|
|
if (( pStackData->sText[ ByteString("en-US") ].Len()
|
|
|
|
) ||
|
2004-06-25 11:40:34 +00:00
|
|
|
( bForce &&
|
|
|
|
( pStackData->sText[ ByteString("de") ].Len() ||
|
2005-02-16 17:12:35 +00:00
|
|
|
pStackData->sText[ ByteString("en-US") ].Len() )))
|
2000-11-22 11:57:00 +00:00
|
|
|
{
|
2007-04-19 14:18:05 +00:00
|
|
|
ByteString sFallback = pStackData->sText[ ByteString("en-US") ];
|
2004-06-25 11:40:34 +00:00
|
|
|
|
2007-04-19 14:18:05 +00:00
|
|
|
//if ( pStackData->sText[ ByteString("en-US") ].Len())
|
|
|
|
// sFallback = pStackData->sText[ ByteString("en-US") ];
|
2000-11-22 11:57:00 +00:00
|
|
|
|
|
|
|
ByteString sLocalId = pStackData->sIdentifier;
|
|
|
|
ByteString sGroupId;
|
|
|
|
if ( aStack.Count() == 1 ) {
|
|
|
|
sGroupId = sLocalId;
|
|
|
|
sLocalId = "";
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
sGroupId = aStack.GetAccessPath( aStack.Count() - 2 );
|
|
|
|
}
|
|
|
|
|
2001-06-07 12:33:31 +00:00
|
|
|
ByteString sTimeStamp( Export::GetTimeStamp());
|
2000-11-22 11:57:00 +00:00
|
|
|
|
2004-06-25 11:40:34 +00:00
|
|
|
ByteString sCur;
|
2006-06-19 16:21:15 +00:00
|
|
|
for( unsigned int n = 0; n < aLanguages.size(); n++ ){
|
2004-06-25 11:40:34 +00:00
|
|
|
sCur = aLanguages[ n ];
|
|
|
|
|
|
|
|
ByteString sText = pStackData->sText[ sCur ];
|
2000-11-22 11:57:00 +00:00
|
|
|
if ( !sText.Len())
|
|
|
|
sText = sFallback;
|
|
|
|
|
2004-11-18 07:16:25 +00:00
|
|
|
Export::UnquotHTML( sText );
|
|
|
|
|
2000-11-22 11:57:00 +00:00
|
|
|
ByteString sOutput( sPrj ); sOutput += "\t";
|
|
|
|
sOutput += sPath;
|
|
|
|
sOutput += "\t0\t";
|
2000-11-22 12:56:02 +00:00
|
|
|
sOutput += pStackData->sResTyp; sOutput += "\t";
|
2000-11-22 11:57:00 +00:00
|
|
|
sOutput += sGroupId; sOutput += "\t";
|
|
|
|
sOutput += sLocalId; sOutput += "\t\t\t0\t";
|
2004-06-25 11:40:34 +00:00
|
|
|
sOutput += sCur;
|
2000-11-22 11:57:00 +00:00
|
|
|
sOutput += "\t";
|
2004-08-02 15:24:39 +00:00
|
|
|
|
2000-11-22 11:57:00 +00:00
|
|
|
sOutput += sText; sOutput += "\t\t\t\t";
|
|
|
|
sOutput += sTimeStamp;
|
|
|
|
|
2007-04-19 14:18:05 +00:00
|
|
|
//if( !sCur.EqualsIgnoreCaseAscii("de") ||( sCur.EqualsIgnoreCaseAscii("de") && !Export::isMergingGermanAllowed( sPrj ) ) )
|
2000-11-22 11:57:00 +00:00
|
|
|
pOutputStream->WriteLine( sOutput );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2000-11-22 09:53:28 +00:00
|
|
|
}
|
2000-11-22 12:56:02 +00:00
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
void CfgExport::WorkOnText(
|
|
|
|
ByteString &rText,
|
2006-06-19 16:21:15 +00:00
|
|
|
const ByteString &rIsoLang
|
2000-11-22 12:56:02 +00:00
|
|
|
)
|
|
|
|
/*****************************************************************************/
|
|
|
|
{
|
2006-06-19 16:21:15 +00:00
|
|
|
if( rIsoLang.Len() ) Export::UnquotHTML( rText );
|
2000-11-22 12:56:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// class CfgMerge
|
|
|
|
//
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
CfgMerge::CfgMerge(
|
|
|
|
const ByteString &rMergeSource, const ByteString &rOutputFile,
|
2006-06-19 16:21:15 +00:00
|
|
|
ByteString &rFilename )
|
2000-11-22 12:56:02 +00:00
|
|
|
/*****************************************************************************/
|
|
|
|
: CfgOutputParser( rOutputFile ),
|
|
|
|
pMergeDataFile( NULL ),
|
2001-06-19 09:42:11 +00:00
|
|
|
pResData( NULL ),
|
|
|
|
bGerman( FALSE ),
|
2006-03-29 12:26:12 +00:00
|
|
|
sFilename( rFilename ),
|
2001-06-19 09:42:11 +00:00
|
|
|
bEnglish( FALSE )
|
2000-11-22 12:56:02 +00:00
|
|
|
{
|
2004-06-25 11:40:34 +00:00
|
|
|
if ( rMergeSource.Len()){
|
2000-11-22 12:56:02 +00:00
|
|
|
pMergeDataFile = new MergeDataFile(
|
2006-09-15 12:36:17 +00:00
|
|
|
rMergeSource, sInputFileName , bErrorLog, RTL_TEXTENCODING_MS_1252, true );
|
2004-06-25 11:40:34 +00:00
|
|
|
if( Export::sLanguages.EqualsIgnoreCaseAscii("ALL") ){
|
|
|
|
Export::SetLanguages( pMergeDataFile->GetLanguages() );
|
|
|
|
aLanguages = pMergeDataFile->GetLanguages();
|
|
|
|
}
|
|
|
|
else aLanguages = Export::GetLanguages();
|
|
|
|
}else
|
|
|
|
aLanguages = Export::GetLanguages();
|
2000-11-22 12:56:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
CfgMerge::~CfgMerge()
|
|
|
|
/*****************************************************************************/
|
|
|
|
{
|
|
|
|
delete pMergeDataFile;
|
|
|
|
delete pResData;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
void CfgMerge::WorkOnText(
|
|
|
|
ByteString &rText,
|
2006-06-19 16:21:15 +00:00
|
|
|
const ByteString& nLangIndex
|
2000-11-22 12:56:02 +00:00
|
|
|
)
|
|
|
|
/*****************************************************************************/
|
|
|
|
{
|
2004-06-25 11:40:34 +00:00
|
|
|
|
2000-12-05 09:34:16 +00:00
|
|
|
if ( pMergeDataFile && bLocalize ) {
|
2000-11-22 12:56:02 +00:00
|
|
|
if ( !pResData ) {
|
|
|
|
ByteString sLocalId = pStackData->sIdentifier;
|
|
|
|
ByteString sGroupId;
|
|
|
|
if ( aStack.Count() == 1 ) {
|
|
|
|
sGroupId = sLocalId;
|
|
|
|
sLocalId = "";
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
sGroupId = aStack.GetAccessPath( aStack.Count() - 2 );
|
|
|
|
}
|
|
|
|
|
|
|
|
ByteString sPlatform( "" );
|
|
|
|
|
2006-03-29 12:26:12 +00:00
|
|
|
pResData = new ResData( sPlatform, sGroupId , sFilename );
|
2000-11-22 12:56:02 +00:00
|
|
|
pResData->sId = sLocalId;
|
|
|
|
pResData->sResTyp = pStackData->sResTyp;
|
|
|
|
}
|
|
|
|
|
2007-04-19 14:18:05 +00:00
|
|
|
//if ( nLangIndex.EqualsIgnoreCaseAscii("de") )
|
|
|
|
// bGerman = TRUE;
|
2004-06-25 11:40:34 +00:00
|
|
|
if (( nLangIndex.EqualsIgnoreCaseAscii("en-US") ))
|
|
|
|
bEnglish = TRUE;
|
2001-06-19 09:42:11 +00:00
|
|
|
|
2006-07-25 07:28:26 +00:00
|
|
|
PFormEntrys *pEntrys = pMergeDataFile->GetPFormEntrysCaseSensitive( pResData );
|
2000-11-22 12:56:02 +00:00
|
|
|
if ( pEntrys ) {
|
|
|
|
ByteString sContent;
|
2005-09-23 13:28:23 +00:00
|
|
|
pEntrys->GetText( sContent, STRING_TYP_TEXT, nLangIndex );
|
|
|
|
|
|
|
|
if ( Export::isAllowed( nLangIndex ) &&
|
2000-12-19 15:12:17 +00:00
|
|
|
( sContent != "-" ) && ( sContent.Len()))
|
2000-11-22 12:56:02 +00:00
|
|
|
{
|
2005-09-23 13:28:23 +00:00
|
|
|
#ifdef MERGE_SOURCE_LANGUAGES
|
|
|
|
if( nLangIndex.EqualsIgnoreCaseAscii("de") || nLangIndex.EqualsIgnoreCaseAscii("en-US") )
|
|
|
|
rText = sContent;
|
|
|
|
#endif
|
2000-11-22 12:56:02 +00:00
|
|
|
Export::QuotHTML( rText );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
void CfgMerge::Output( const ByteString& rOutput )
|
|
|
|
/*****************************************************************************/
|
|
|
|
{
|
|
|
|
if ( pOutputStream )
|
|
|
|
pOutputStream->Write( rOutput.GetBuffer(), rOutput.Len());
|
|
|
|
}
|
|
|
|
|
2006-06-19 16:21:15 +00:00
|
|
|
ULONG CfgStack::Push( CfgStackData *pStackData )
|
|
|
|
{
|
|
|
|
Insert( pStackData, LIST_APPEND );
|
|
|
|
return Count() - 1;
|
|
|
|
}
|
|
|
|
|
2000-11-22 12:56:02 +00:00
|
|
|
/*****************************************************************************/
|
|
|
|
void CfgMerge::WorkOnRessourceEnd()
|
|
|
|
/*****************************************************************************/
|
|
|
|
{
|
2004-06-25 11:40:34 +00:00
|
|
|
|
2007-04-19 14:18:05 +00:00
|
|
|
if ( pMergeDataFile && pResData && bLocalize && (( bEnglish ) || bForce )) {
|
2006-07-25 07:28:26 +00:00
|
|
|
PFormEntrys *pEntrys = pMergeDataFile->GetPFormEntrysCaseSensitive( pResData );
|
2000-11-22 12:56:02 +00:00
|
|
|
if ( pEntrys ) {
|
2004-06-25 11:40:34 +00:00
|
|
|
ByteString sCur;
|
|
|
|
|
2006-06-19 16:21:15 +00:00
|
|
|
for( unsigned int n = 0; n < aLanguages.size(); n++ ){
|
2004-06-25 11:40:34 +00:00
|
|
|
sCur = aLanguages[ n ];
|
|
|
|
|
2000-11-22 12:56:02 +00:00
|
|
|
ByteString sContent;
|
2005-09-23 13:28:23 +00:00
|
|
|
pEntrys->GetText( sContent, STRING_TYP_TEXT, sCur , TRUE );
|
|
|
|
if (
|
2007-04-19 14:18:05 +00:00
|
|
|
// (!sCur.EqualsIgnoreCaseAscii("de") ) &&
|
2005-09-23 13:28:23 +00:00
|
|
|
( !sCur.EqualsIgnoreCaseAscii("en-US") ) &&
|
|
|
|
|
2000-11-22 12:56:02 +00:00
|
|
|
( sContent != "-" ) && ( sContent.Len()))
|
|
|
|
{
|
|
|
|
|
2004-06-25 11:40:34 +00:00
|
|
|
ByteString sText = sContent;
|
2000-11-22 12:56:02 +00:00
|
|
|
Export::QuotHTML( sText );
|
|
|
|
|
2000-11-28 13:53:39 +00:00
|
|
|
ByteString sAdditionalLine( "\t" );
|
|
|
|
|
|
|
|
ByteString sTextTag = pStackData->sTextTag;
|
|
|
|
ByteString sTemp = sTextTag.Copy( sTextTag.Search( "xml:lang=" ));
|
|
|
|
|
|
|
|
ByteString sSearch = sTemp.GetToken( 0, '\"' );
|
|
|
|
sSearch += "\"";
|
|
|
|
sSearch += sTemp.GetToken( 1, '\"' );
|
|
|
|
sSearch += "\"";
|
2000-11-22 12:56:02 +00:00
|
|
|
|
2000-11-28 13:53:39 +00:00
|
|
|
ByteString sReplace = sTemp.GetToken( 0, '\"' );
|
|
|
|
sReplace += "\"";
|
2004-06-25 11:40:34 +00:00
|
|
|
sReplace += sCur;
|
2000-11-28 13:53:39 +00:00
|
|
|
sReplace += "\"";
|
|
|
|
|
|
|
|
sTextTag.SearchAndReplace( sSearch, sReplace );
|
|
|
|
|
|
|
|
sAdditionalLine += sTextTag;
|
2000-11-22 12:56:02 +00:00
|
|
|
sAdditionalLine += sText;
|
|
|
|
sAdditionalLine += pStackData->sEndTextTag;
|
|
|
|
|
2000-11-28 13:53:39 +00:00
|
|
|
sAdditionalLine += "\n";
|
|
|
|
sAdditionalLine += sLastWhitespace;
|
|
|
|
|
2000-11-22 12:56:02 +00:00
|
|
|
Output( sAdditionalLine );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
delete pResData;
|
|
|
|
pResData = NULL;
|
2001-06-19 09:42:11 +00:00
|
|
|
bGerman = FALSE;
|
|
|
|
bEnglish = FALSE;
|
2000-11-22 12:56:02 +00:00
|
|
|
}
|