summaryrefslogtreecommitdiff
path: root/l10ntools/source
diff options
context:
space:
mode:
Diffstat (limited to 'l10ntools/source')
-rw-r--r--l10ntools/source/cfgmerge.cxx33
-rw-r--r--l10ntools/source/export.cxx11
-rw-r--r--l10ntools/source/export2.cxx34
-rw-r--r--l10ntools/source/helpex.cxx15
-rw-r--r--l10ntools/source/helpmerge.cxx10
-rw-r--r--l10ntools/source/lngex.cxx7
-rw-r--r--l10ntools/source/lngmerge.cxx20
-rw-r--r--l10ntools/source/localize.cxx45
-rw-r--r--l10ntools/source/propex.cxx4
-rw-r--r--l10ntools/source/stringex.cxx44
-rw-r--r--l10ntools/source/treex.cxx55
-rw-r--r--l10ntools/source/uimerge.cxx31
-rw-r--r--l10ntools/source/xrmmerge.cxx36
13 files changed, 137 insertions, 208 deletions
diff --git a/l10ntools/source/cfgmerge.cxx b/l10ntools/source/cfgmerge.cxx
index 50329fa3f3d2..4586e7192d4f 100644
--- a/l10ntools/source/cfgmerge.cxx
+++ b/l10ntools/source/cfgmerge.cxx
@@ -50,10 +50,9 @@ FILE * init(int argc, char ** argv) {
HandledArgs aArgs;
if ( !Export::handleArguments(argc, argv, aArgs) )
{
- Export::writeUsage("cfgex","xcu");
+ Export::writeUsage("cfgex","*.xcu");
std::exit(EXIT_FAILURE);
}
- Export::InitLanguages();
global::inputPathname = aArgs.m_sInputFile;
FILE * pFile = std::fopen(global::inputPathname.getStr(), "r");
@@ -67,13 +66,12 @@ FILE * init(int argc, char ** argv) {
if (aArgs.m_bMergeMode) {
global::parser.reset(
new CfgMerge(
- aArgs.m_sMergeSrc.getStr(), aArgs.m_sOutputFile.getStr(),
- global::inputPathname));
+ aArgs.m_sMergeSrc, aArgs.m_sOutputFile,
+ global::inputPathname, aArgs.m_sLanguage ));
} else {
global::parser.reset(
new CfgExport(
- aArgs.m_sOutputFile.getStr(), aArgs.m_sPrj.getStr(),
- global::inputPathname ));
+ aArgs.m_sOutputFile, global::inputPathname, aArgs.m_sLanguage ));
}
return pFile;
@@ -359,13 +357,12 @@ void CfgParser::Error(const rtl::OString& rError)
/*****************************************************************************/
CfgExport::CfgExport(
- const rtl::OString &rOutputFile,
- const rtl::OString &rProject,
- const rtl::OString &rFilePath
+ const OString &rOutputFile,
+ const OString &rFilePath,
+ const OString &rLanguage
)
/*****************************************************************************/
- : sPrj( rProject ),
- sPath( rFilePath )
+ : sPath( rFilePath )
{
pOutputStream.open( rOutputFile, PoOfstream::APP );
if (!pOutputStream.isOpen())
@@ -373,8 +370,7 @@ CfgExport::CfgExport(
std::cerr << "ERROR: Unable to open output file: " << rOutputFile << "\n";
std::exit(EXIT_FAILURE);
}
- Export::InitLanguages( false );
- aLanguages = Export::GetLanguages();
+ aLanguages.push_back( rLanguage );
}
/*****************************************************************************/
@@ -435,8 +431,8 @@ void CfgExport::WorkOnText(
//
CfgMerge::CfgMerge(
- const rtl::OString &rMergeSource, const rtl::OString &rOutputFile,
- const rtl::OString &rFilename)
+ const OString &rMergeSource, const OString &rOutputFile,
+ const OString &rFilename, const OString &rLanguage )
: pMergeDataFile( NULL ),
pResData( NULL ),
sFilename( rFilename ),
@@ -454,15 +450,14 @@ CfgMerge::CfgMerge(
{
pMergeDataFile = new MergeDataFile(
rMergeSource, global::inputPathname, true );
- if (Export::sLanguages.equalsIgnoreAsciiCaseL(RTL_CONSTASCII_STRINGPARAM("ALL")))
+ if (rLanguage.equalsIgnoreAsciiCase("ALL") )
{
- Export::SetLanguages( pMergeDataFile->GetLanguages() );
aLanguages = pMergeDataFile->GetLanguages();
}
- else aLanguages = Export::GetLanguages();
+ else aLanguages.push_back(rLanguage);
}
else
- aLanguages = Export::GetLanguages();
+ aLanguages.push_back(rLanguage);
}
/*****************************************************************************/
diff --git a/l10ntools/source/export.cxx b/l10ntools/source/export.cxx
index 47cfc692d8f5..0071f0600910 100644
--- a/l10ntools/source/export.cxx
+++ b/l10ntools/source/export.cxx
@@ -41,8 +41,6 @@ MergeDataFile * pMergeDataFile = 0; //TODO
namespace global {
-OString prj;
-OString prjRoot;
OString inputPathname;
boost::scoped_ptr< Export > exporter;
@@ -56,12 +54,11 @@ FILE * init(int argc, char ** argv) {
HandledArgs aArgs;
if ( !Export::handleArguments(argc, argv, aArgs) )
{
- Export::writeUsage("transex3","src/hrc");
+ Export::writeUsage("transex3","*.src/*.hrc");
std::exit(EXIT_FAILURE);
}
+ Export::sLanguages = aArgs.m_sLanguage;
Export::InitLanguages();
- global::prj = aArgs.m_sPrj;
- global::prjRoot = aArgs.m_sPrjRoot;
global::inputPathname = aArgs.m_sInputFile;
FILE * pFile = std::fopen(global::inputPathname.getStr(), "r");
@@ -172,8 +169,6 @@ Export::Export(const rtl::OString &rOutput)
nListIndex( 0 ),
nListLevel( 0 ),
bSkipFile( false ),
- sProject( global::prj ),
- sRoot( global::prjRoot ),
bMergeMode( false ),
bError( sal_False ),
bReadOver( sal_False ),
@@ -203,8 +198,6 @@ Export::Export(const rtl::OString &rMergeSource, const rtl::OString &rOutput)
nListIndex( 0 ),
nListLevel( 0 ),
bSkipFile( false ),
- sProject( global::prj ),
- sRoot( global::prjRoot ),
bMergeMode( sal_True ),
sMergeSrc( rMergeSource ),
bError( sal_False ),
diff --git a/l10ntools/source/export2.cxx b/l10ntools/source/export2.cxx
index 7d2257d0e186..4c6891148966 100644
--- a/l10ntools/source/export2.cxx
+++ b/l10ntools/source/export2.cxx
@@ -94,7 +94,6 @@ bool Export::handleArguments(
int argc, char * argv[], HandledArgs& o_aHandledArgs)
{
o_aHandledArgs = HandledArgs();
- sLanguages = "";
sal_uInt16 nState = STATE_NON;
for( int i = 1; i < argc; i++ )
@@ -107,14 +106,6 @@ bool Export::handleArguments(
{
nState = STATE_OUTPUT; // next token specifies the dest file
}
- else if ( OString( argv[ i ] ).toAsciiUpperCase() == "-P" )
- {
- nState = STATE_PRJ; // next token specifies the cur. project
- }
- else if ( OString( argv[ i ] ).toAsciiUpperCase() == "-R" )
- {
- nState = STATE_ROOT; // next token specifies path to project root
- }
else if ( OString( argv[ i ] ).toAsciiUpperCase() == "-M" )
{
nState = STATE_MERGESRC; // next token specifies the merge database
@@ -141,16 +132,6 @@ bool Export::handleArguments(
o_aHandledArgs.m_sOutputFile = OString( argv[i] );
}
break;
- case STATE_PRJ:
- {
- o_aHandledArgs.m_sPrj = OString( argv[i] );
- }
- break;
- case STATE_ROOT:
- {
- o_aHandledArgs.m_sPrjRoot = OString( argv[i] );
- }
- break;
case STATE_MERGESRC:
{
o_aHandledArgs.m_sMergeSrc = OString( argv[i] );
@@ -159,7 +140,7 @@ bool Export::handleArguments(
break;
case STATE_LANGUAGES:
{
- sLanguages = OString( argv[i] );
+ o_aHandledArgs.m_sLanguage = OString( argv[i] );
}
break;
}
@@ -180,16 +161,13 @@ bool Export::handleArguments(
void Export::writeUsage(const OString& rName, const OString& rFileType)
{
std::cout
- << "Syntax: " << rName.getStr()
- << " [-p Prj] [-r PrjRoot] -i FileIn -o FileOut"
- << " [-m DataBase] [-l l1,l2,...]\n"
- << " Prj: Project\n"
- << " PrjRoot: Path to project root (../.. etc.)\n"
- << " FileIn: Source files (*." << rFileType.getStr() << ")\n"
+ << " Syntax: " << rName.getStr()
+ << " -i FileIn -o FileOut [-m DataBase] [-l Lang]\n"
+ << " FileIn: Source files (" << rFileType.getStr() << ")\n"
<< " FileOut: Destination file (*.*)\n"
<< " DataBase: Mergedata (*.po)\n"
- << " -l: Restrict the handled languages; l1, l2, ... are elements of"
- << " (de, en-US, ...)\n";
+ << " Lang: Restrict the handled languag; one element of\n"
+ << " (de, en-US, ...) or all\n";
}
void Export::writePoEntry(
diff --git a/l10ntools/source/helpex.cxx b/l10ntools/source/helpex.cxx
index 1cd7dce067c8..5d46262d80b4 100644
--- a/l10ntools/source/helpex.cxx
+++ b/l10ntools/source/helpex.cxx
@@ -36,17 +36,14 @@
void WriteUsage()
{
std::cout
- << "Syntax: Helpex [-p Prj] [-r Root] -[m]i FileIn -o FileOut"
- << " [-m DataBase] [-l l1,l2,...]\n"
- << " Prj: Project\n"
- << " Root: Path to project root (../.. etc.)\n"
+ << " Syntax: Helpex -[m]i FileIn -o FileOut [-m DataBase] [-l Lang]\n"
<< " FileIn + i: Source file (*.xhp)\n"
<< " FileIn + -mi: File including paths of source files"
<< " (only for merge)"
<< " FileOut: Destination file (*.*) or files (in case of -mi)\n"
<< " DataBase: Mergedata (*.po)\n"
- << " -l: Restrict the handled languages; l1, l2, ... are elements of"
- << " (de, en-US, ...)\n";
+ << " Lang: Restrict the handled languages; one element of\n"
+ << " (de, en-US, ...) or all\n";
}
SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) {
@@ -93,7 +90,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) {
aArgs.m_sOutputFile +
sXhpFile.copy( sXhpFile.lastIndexOf("/") ));
if( !aParser.Merge( aArgs.m_sMergeSrc, sOutput,
- Export::sLanguages, aMergeDataFile ))
+ aArgs.m_sLanguage, aMergeDataFile ))
{
hasNoError = false;
}
@@ -109,7 +106,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) {
hasNoError =
aParser.Merge(
aArgs.m_sMergeSrc, aArgs.m_sOutputFile,
- Export::sLanguages , aMergeDataFile );
+ aArgs.m_sLanguage, aMergeDataFile );
}
}
else
@@ -117,7 +114,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) {
HelpParser aParser( aArgs.m_sInputFile );
hasNoError =
aParser.CreatePO(
- aArgs.m_sOutputFile, aArgs.m_sInputFile,
+ aArgs.m_sOutputFile, aArgs.m_sInputFile, aArgs.m_sLanguage,
new XMLFile( OUString('0') ), "help" );
}
diff --git a/l10ntools/source/helpmerge.cxx b/l10ntools/source/helpmerge.cxx
index c9da3c947729..ddcece2b492c 100644
--- a/l10ntools/source/helpmerge.cxx
+++ b/l10ntools/source/helpmerge.cxx
@@ -75,8 +75,8 @@ HelpParser::HelpParser( const rtl::OString &rHelpFile )
/*****************************************************************************/
bool HelpParser::CreatePO(
/*****************************************************************************/
- const rtl::OString &rPOFile_in, const rtl::OString &sHelpFile,
- XMLFile *pXmlFile, const rtl::OString &rGsi1){
+ const OString &rPOFile_in, const OString &sHelpFile, const OString &rLanguage,
+ XMLFile *pXmlFile, const OString &rGsi1){
SimpleXMLParser aParser;
rtl::OUString sXmlFile(
rtl::OStringToOUString(sHelpFile, RTL_TEXTENCODING_ASCII_US));
@@ -110,8 +110,8 @@ bool HelpParser::CreatePO(
LangHashMap* pElem;
XMLElement* pXMLElement = NULL;
- Export::InitLanguages( false );
- std::vector<rtl::OString> aLanguages = Export::GetLanguages();
+ std::vector<rtl::OString> aLanguages;
+ aLanguages.push_back( rLanguage );
std::vector<rtl::OString> order = file->getOrder();
std::vector<rtl::OString>::iterator pos;
@@ -152,7 +152,7 @@ bool HelpParser::CreatePO(
return sal_True;
}
-bool HelpParser::Merge( const rtl::OString &rPOFile, const rtl::OString &rDestinationFile ,
+bool HelpParser::Merge( const rtl::OString &rPOFile, const rtl::OString &rDestinationFile,
const rtl::OString& rLanguage , MergeDataFile& aMergeDataFile )
{
diff --git a/l10ntools/source/lngex.cxx b/l10ntools/source/lngex.cxx
index 9f63b89b9d2f..0677e8a2172a 100644
--- a/l10ntools/source/lngex.cxx
+++ b/l10ntools/source/lngex.cxx
@@ -30,15 +30,16 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) {
HandledArgs aArgs;
if ( !Export::handleArguments(argc, argv, aArgs) )
{
- Export::writeUsage("ulfex","ulf");
+ Export::writeUsage("ulfex","*.ulf");
return 1;
}
LngParser aParser( aArgs.m_sInputFile, true );
if ( aArgs.m_bMergeMode )
- aParser.Merge(aArgs.m_sMergeSrc, aArgs.m_sOutputFile);
+ aParser.Merge(
+ aArgs.m_sMergeSrc, aArgs.m_sOutputFile, aArgs.m_sLanguage );
else
- aParser.CreatePO( aArgs.m_sOutputFile );
+ aParser.CreatePO( aArgs.m_sOutputFile, aArgs.m_sLanguage );
return 0;
}
diff --git a/l10ntools/source/lngmerge.cxx b/l10ntools/source/lngmerge.cxx
index 36580440a4ba..8586a8a84914 100644
--- a/l10ntools/source/lngmerge.cxx
+++ b/l10ntools/source/lngmerge.cxx
@@ -80,11 +80,11 @@ LngParser::~LngParser()
delete pLines;
}
-sal_Bool LngParser::CreatePO( const rtl::OString &rPOFile )
+sal_Bool LngParser::CreatePO(
+ const OString &rPOFile,
+ const OString &rLanguage )
{
-
- Export::InitLanguages( false );
- aLanguages = Export::GetLanguages();
+ aLanguages.push_back(rLanguage);
PoOfstream aPOStream( rPOFile, PoOfstream::APP );
if (!aPOStream.isOpen()) {
std::cerr << "Ulfex error: Can't open po file:" << rPOFile.getStr() << "\n";
@@ -161,10 +161,10 @@ void LngParser::ReadLine(const rtl::OString &rLine_in,
}
sal_Bool LngParser::Merge(
- const rtl::OString &rPOFile,
- const rtl::OString &rDestinationFile)
+ const OString &rPOFile,
+ const OString &rDestinationFile,
+ const OString &rLanguage )
{
- Export::InitLanguages( true );
std::ofstream aDestination(
rDestinationFile.getStr(), std::ios_base::out | std::ios_base::trunc);
if (!aDestination.is_open()) {
@@ -173,10 +173,8 @@ sal_Bool LngParser::Merge(
nError = LNG_OK;
MergeDataFile aMergeDataFile( rPOFile, sSource, false, true );
- rtl::OString sTmp( Export::sLanguages );
- if( sTmp.equalsIgnoreAsciiCaseL(RTL_CONSTASCII_STRINGPARAM("ALL")) )
- Export::SetLanguages( aMergeDataFile.GetLanguages() );
- aLanguages = Export::GetLanguages();
+ if( rLanguage.equalsIgnoreAsciiCase("ALL") )
+ aLanguages = aMergeDataFile.GetLanguages();
size_t nPos = 0;
sal_Bool bGroup = sal_False;
diff --git a/l10ntools/source/localize.cxx b/l10ntools/source/localize.cxx
index b19521ad84c6..53f1d0e36392 100644
--- a/l10ntools/source/localize.cxx
+++ b/l10ntools/source/localize.cxx
@@ -127,7 +127,6 @@ bool passesPositiveList(const OUString& rUrl) {
}
void handleCommand(
- const OString& rProject, const OString& rProjectRoot,
const OString& rInPath, const OString& rOutPath,
const OString& rExecutable)
{
@@ -136,10 +135,6 @@ void handleCommand(
buf.append(OString(getenv("INPATH_FOR_BUILD")));
buf.append("/bin/");
buf.append(rExecutable);
- buf.append(" -p ");
- buf.append(rProject);
- buf.append(" -r ");
- buf.append(rProjectRoot);
buf.append(" -i ");
buf.append(rInPath);
buf.append(" -o ");
@@ -195,9 +190,8 @@ void InitPoFile(
}
bool handleFile(
- const OString& rProject, const OString& rProjectRoot,
- const OUString& rUrl, const OString& rPotDir,
- bool bInitPoFile )
+ const OString& rProject, const OUString& rUrl,
+ const OString& rPotDir, bool bInitPoFile )
{
struct Command {
char const * extension;
@@ -243,9 +237,7 @@ bool handleFile(
{
InitPoFile(rProject, sInPath, rPotDir, sOutPath);
}
- handleCommand(
- rProject, rProjectRoot, sInPath,
- sOutPath, commands[i].executable);
+ handleCommand(sInPath, sOutPath, commands[i].executable);
return true;
}
break;
@@ -256,7 +248,7 @@ bool handleFile(
void handleFilesOfDir(
std::vector<OUString>& aFiles, const OString& rProject,
- const OString& rProjectRoot, const OString& rPotDir )
+ const OString& rPotDir )
{
///Handle files in lexical order
std::sort(aFiles.begin(), aFiles.end());
@@ -267,7 +259,7 @@ void handleFilesOfDir(
for( citer_t aIt = aFiles.begin(); aIt != aFiles.end(); ++aIt )
{
- if (handleFile( rProject, rProjectRoot, *aIt, rPotDir, bFirstLocFile))
+ if (handleFile( rProject, *aIt, rPotDir, bFirstLocFile))
{
bFirstLocFile = false;
}
@@ -380,13 +372,10 @@ bool includeProject(const OString& rProject) {
/// is a project directory; 2 if this is a directory inside a project
///
/// @param rProject the name of the project (empty and ignored if nLevel <= 0)
-///
-/// @param rProjectRoo the relative path back to the project root (empty and ignored if
-/// nLevel <= 0)
/// @param rPotDir the path of pot directory
void handleDirectory(
- const OUString& rUrl, int nLevel, const OString& rProject,
- const OString& rProjectRoot, const OString& rPotDir)
+ const OUString& rUrl, int nLevel,
+ const OString& rProject, const OString& rPotDir)
{
osl::Directory dir(rUrl);
if (dir.open() != osl::FileBase::E_None) {
@@ -418,34 +407,26 @@ void handleDirectory(
case -1: // the clone or src directory
if (stat.getFileType() == osl::FileStatus::Directory) {
handleDirectory(
- stat.getFileURL(), 0, OString(),
- OString(), rPotDir);
+ stat.getFileURL(), 0, OString(), rPotDir);
}
break;
case 0: // a root directory
if (stat.getFileType() == osl::FileStatus::Directory) {
if (includeProject(sDirName)) {
handleDirectory(
- stat.getFileURL(), 1, sDirName,
- OString(), rPotDir.concat("/").concat(sDirName));
+ stat.getFileURL(), 1, sDirName, rPotDir.concat("/").concat(sDirName));
} else if ( sDirName == "clone" ||
sDirName == "src" )
{
- handleDirectory(
- stat.getFileURL(), -1, OString(), OString(), rPotDir);
+ handleDirectory( stat.getFileURL(), -1, OString(), rPotDir);
}
}
break;
default:
if (stat.getFileType() == osl::FileStatus::Directory)
{
- OString pr(rProjectRoot);
- if (!pr.isEmpty()) {
- pr += OString('/');
- }
- pr += OString("..");
handleDirectory(
- stat.getFileURL(), 2, rProject, pr, rPotDir.concat("/").concat(sDirName));
+ stat.getFileURL(), 2, rProject, rPotDir.concat("/").concat(sDirName));
}
else
{
@@ -457,7 +438,7 @@ void handleDirectory(
if( !aFileNames.empty() )
{
- handleFilesOfDir( aFileNames, rProject, rProjectRoot, rPotDir );
+ handleFilesOfDir( aFileNames, rProject, rPotDir );
}
if (dir.close() != osl::FileBase::E_None) {
@@ -487,7 +468,7 @@ void handleProjects(char * sSourceRoot, char const * sDestRoot)
<< " root16: " << OUStringToOString(root16, RTL_TEXTENCODING_ASCII_US).getStr() << "\n";
throw false; //TODO
}
- handleDirectory(rootUrl, 0, OString(), OString(), OString(sDestRoot));
+ handleDirectory(rootUrl, 0, OString(), OString(sDestRoot));
}
}
diff --git a/l10ntools/source/propex.cxx b/l10ntools/source/propex.cxx
index 0c2e7dac41f9..8517bfb3bdd4 100644
--- a/l10ntools/source/propex.cxx
+++ b/l10ntools/source/propex.cxx
@@ -17,12 +17,12 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
HandledArgs aArgs;
if( !Export::handleArguments(argc, argv, aArgs) )
{
- Export::writeUsage("propex","properties");
+ Export::writeUsage("propex","*.properties");
return 1;
}
PropParser aParser(
- aArgs.m_sInputFile, Export::sLanguages, aArgs.m_bMergeMode );
+ aArgs.m_sInputFile, aArgs.m_sLanguage, aArgs.m_bMergeMode );
if( !aParser.isInitialized() )
{
return 1;
diff --git a/l10ntools/source/stringex.cxx b/l10ntools/source/stringex.cxx
index 305053816fc3..cf4a227c7a5a 100644
--- a/l10ntools/source/stringex.cxx
+++ b/l10ntools/source/stringex.cxx
@@ -13,45 +13,29 @@
#include "export.hxx"
#include "stringmerge.hxx"
-void WriteUsage()
-{
- std::cout
- << "Syntax: stringex [-p Prj] [-r Root] -i FileIn -o FileOut"
- << " [-m DataBase] [-l l1,l2,...]\n"
- << " Prj: Project\n"
- << " Root: Path to project root (../.. etc.)\n"
- << " FileIn: Source files (strings.xml)\n"
- << " FileOut: Destination file (*.*)\n"
- << " DataBase: Mergedata (*.po)\n"
- << " -l: Restrict the handled languages; l1, l2, ... are elements of"
- << " (de, en-US, ...)\n";
-}
-
-
SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
{
HandledArgs aArgs;
if( !Export::handleArguments(argc, argv, aArgs) )
{
- WriteUsage();
+ Export::writeUsage("stringex","string.xml");
return 1;
}
- StringParser aParser(aArgs.m_sInputFile, Export::sLanguages);
- if( !aParser.isInitialized() )
- {
- return 1;
- }
+ StringParser aParser(aArgs.m_sInputFile, aArgs.m_sLanguage);
+ if( !aParser.isInitialized() )
+ {
+ return 1;
+ }
- if( aArgs.m_bMergeMode || aArgs.m_sPrj.isEmpty() )
- {
- aParser.Merge(
- aArgs.m_sMergeSrc, aArgs.m_sOutputFile );
- }
- else
- {
- aParser.Extract( aArgs.m_sOutputFile );
- }
+ if( aArgs.m_bMergeMode )
+ {
+ aParser.Merge( aArgs.m_sMergeSrc, aArgs.m_sOutputFile );
+ }
+ else
+ {
+ aParser.Extract( aArgs.m_sOutputFile );
+ }
return 0;
}
diff --git a/l10ntools/source/treex.cxx b/l10ntools/source/treex.cxx
index d8565f8e664a..51874808b71e 100644
--- a/l10ntools/source/treex.cxx
+++ b/l10ntools/source/treex.cxx
@@ -8,6 +8,7 @@
*/
#include <iostream>
+#include <cstring>
#include "sal/main.h"
#include "export.hxx"
@@ -16,21 +17,34 @@
void WriteUsage()
{
std::cout
- << "Syntax: Treex [-p Prj] [-r Root] -i FileIn -o FileOut"
- << " [-m DataBase] [-l l1,l2,...]\n"
- << " Prj: Project\n"
- << " Root: Path to project root (../.. etc.)\n"
- << " or path to root of localized xhp files\n"
+ << "Syntax: Treex [-r Root] -i FileIn -o FileOut"
+ << " [-m DataBase] [-l Lang]\n"
+ << " Root: Path to root of localized xhp files\n"
<< " FileIn: Source files (*.tree)\n"
<< " FileOut: Destination file (*.*)\n"
<< " DataBase: Mergedata (*.po)\n"
- << " -l: Restrict the handled languages; l1, l2, ... are elements of"
- << " (de, en-US, ...)\n";
+ << " Lang: Restrict the handled languages; one element of\n"
+ << " (de, en-US, ...) or all\n";
}
SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
{
+ OString sXHPRoot;
+ for (int nIndex = 1; nIndex != argc; ++nIndex)
+ {
+ if (std::strcmp(argv[nIndex], "-r") == 0)
+ {
+ sXHPRoot = OString( argv[nIndex + 1] );
+ for( int nIndex2 = nIndex+3; nIndex2 < argc; nIndex2 = nIndex2 + 2 )
+ {
+ argv[nIndex-3] = argv[nIndex-1];
+ argv[nIndex-2] = argv[nIndex];
+ }
+ argc = argc - 2;
+ break;
+ }
+ }
HandledArgs aArgs;
if( !Export::handleArguments(argc, argv, aArgs) )
{
@@ -38,21 +52,20 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
return 1;
}
- TreeParser aParser(aArgs.m_sInputFile, Export::sLanguages);
- if( !aParser.isInitialized() )
- {
- return 1;
- }
+ TreeParser aParser(aArgs.m_sInputFile, aArgs.m_sLanguage );
+ if( !aParser.isInitialized() )
+ {
+ return 1;
+ }
- if( aArgs.m_bMergeMode || aArgs.m_sPrj.isEmpty() )
- {
- aParser.Merge(
- aArgs.m_sMergeSrc, aArgs.m_sOutputFile, aArgs.m_sPrjRoot );
- }
- else
- {
- aParser.Extract( aArgs.m_sOutputFile );
- }
+ if( aArgs.m_bMergeMode || !sXHPRoot.isEmpty() )
+ {
+ aParser.Merge( aArgs.m_sMergeSrc, aArgs.m_sOutputFile, sXHPRoot );
+ }
+ else
+ {
+ aParser.Extract( aArgs.m_sOutputFile );
+ }
return 0;
}
diff --git a/l10ntools/source/uimerge.cxx b/l10ntools/source/uimerge.cxx
index 63b08084a790..6e0ec03b33ca 100644
--- a/l10ntools/source/uimerge.cxx
+++ b/l10ntools/source/uimerge.cxx
@@ -28,8 +28,6 @@
#include <fstream>
#include <vector>
-rtl::OString sPrj;
-rtl::OString sPrjRoot;
rtl::OString sInputFileName;
rtl::OString sOutputFile;
@@ -186,9 +184,10 @@ namespace
}
bool Merge(
- const rtl::OString &rSDFFile,
- const rtl::OString &rSourceFile,
- const rtl::OString &rDestinationDir)
+ const OString &rPOFile,
+ const OString &rSourceFile,
+ const OString &rDestinationDir,
+ const OString &rLanguage )
{
{
bool bDestinationIsDir(false);
@@ -213,14 +212,12 @@ bool Merge(
}
}
- Export::InitLanguages( true );
-
- MergeDataFile aMergeDataFile( rSDFFile, rSourceFile, sal_False );
- rtl::OString sTmp( Export::sLanguages );
- if( sTmp.equalsIgnoreAsciiCaseL(RTL_CONSTASCII_STRINGPARAM("ALL")) )
- Export::SetLanguages( aMergeDataFile.GetLanguages() );
-
- std::vector<rtl::OString> aLanguages = Export::GetLanguages();
+ MergeDataFile aMergeDataFile( rPOFile, rSourceFile, sal_False );
+ std::vector<rtl::OString> aLanguages;
+ if( rLanguage.equalsIgnoreAsciiCase("ALL") )
+ aLanguages = aMergeDataFile.GetLanguages();
+ else
+ aLanguages.push_back(rLanguage);
const MergeDataHashMap& rMap = aMergeDataFile.getMap();
const rtl::OString aDestinationDir(rDestinationDir + "/");
@@ -246,18 +243,16 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
HandledArgs aArgs;
if ( !Export::handleArguments(argc, argv, aArgs) )
{
- Export::writeUsage("uiex","ui");
+ Export::writeUsage("uiex","*.ui");
return 1;
}
- sPrj = aArgs.m_sPrj;
- sPrjRoot = aArgs.m_sPrjRoot;
sInputFileName = aArgs.m_sInputFile;
sOutputFile = aArgs.m_sOutputFile;
if (!aArgs.m_bMergeMode)
{
- if (Export::sLanguages != "en-US")
+ if (aArgs.m_sLanguage != "en-US")
{
fprintf(stderr, "only en-US can exist in source .ui files\n");
nRetValue = 1;
@@ -267,7 +262,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
}
else
{
- Merge(aArgs.m_sMergeSrc, sInputFileName, sOutputFile);
+ Merge(aArgs.m_sMergeSrc, sInputFileName, sOutputFile, aArgs.m_sLanguage);
}
return nRetValue;
diff --git a/l10ntools/source/xrmmerge.cxx b/l10ntools/source/xrmmerge.cxx
index e231b5d883ea..ed0896e038be 100644
--- a/l10ntools/source/xrmmerge.cxx
+++ b/l10ntools/source/xrmmerge.cxx
@@ -41,13 +41,12 @@ void YYWarning( const char * );
bool bMergeMode;
sal_Bool bDisplayName;
sal_Bool bExtensionDescription;
-rtl::OString sPrj;
-rtl::OString sPrjRoot;
-rtl::OString sInputFileName;
-rtl::OString sOutputFile;
-rtl::OString sMergeSrc;
-rtl::OString sLangAttribute;
-rtl::OString sResourceType;
+OString sLanguage;
+OString sInputFileName;
+OString sOutputFile;
+OString sMergeSrc;
+OString sLangAttribute;
+OString sResourceType;
XRMResParser *pParser = NULL;
extern "C" {
@@ -65,8 +64,7 @@ extern char *GetOutputFile( int argc, char* argv[])
{
// command line is valid
bMergeMode = aArgs.m_bMergeMode;
- sPrj = aArgs.m_sPrj;
- sPrjRoot = aArgs.m_sPrjRoot;
+ sLanguage = aArgs.m_sLanguage;
sInputFileName = aArgs.m_sInputFile;
sOutputFile = aArgs.m_sOutputFile;
sMergeSrc = aArgs.m_sMergeSrc;
@@ -77,7 +75,7 @@ extern char *GetOutputFile( int argc, char* argv[])
else
{
// command line is not valid
- Export::writeUsage("xrmex","xrm/xml");
+ Export::writeUsage("xrmex","*.xrm/*.xml");
return NULL;
}
}
@@ -88,12 +86,11 @@ int InitXrmExport( char*, char* pFilename)
{
// instanciate Export
rtl::OString sFilename( pFilename );
- Export::InitLanguages( false );
if ( bMergeMode )
pParser = new XRMResMerge( sMergeSrc, sOutputFile, sFilename );
else if (!sOutputFile.isEmpty()) {
- pParser = new XRMResExport( sOutputFile, sPrj, sInputFileName );
+ pParser = new XRMResExport( sOutputFile, sInputFileName );
}
return 1;
@@ -335,15 +332,13 @@ void XRMResParser::ConvertStringToXMLFormat( rtl::OString &rString )
/*****************************************************************************/
XRMResExport::XRMResExport(
- const rtl::OString &rOutputFile, const rtl::OString &rProject,
- const rtl::OString &rFilePath )
+ const OString &rOutputFile, const OString &rFilePath )
/*****************************************************************************/
: XRMResParser(),
pResData( NULL ),
- sPrj( rProject ),
sPath( rFilePath )
{
- aLanguages = Export::GetLanguages();
+ aLanguages.push_back( sLanguage );
pOutputStream.open( rOutputFile, PoOfstream::APP );
if (!pOutputStream.isOpen())
{
@@ -441,8 +436,8 @@ void XRMResExport::EndOfText(
/*****************************************************************************/
XRMResMerge::XRMResMerge(
- const rtl::OString &rMergeSource, const rtl::OString &rOutputFile,
- const rtl::OString &rFilename)
+ const OString &rMergeSource, const OString &rOutputFile,
+ const OString &rFilename )
/*****************************************************************************/
: XRMResParser(),
pMergeDataFile( NULL ),
@@ -452,13 +447,12 @@ XRMResMerge::XRMResMerge(
if (!rMergeSource.isEmpty())
pMergeDataFile = new MergeDataFile(
rMergeSource, sInputFileName, false);
- if( Export::sLanguages.equalsIgnoreAsciiCaseL(RTL_CONSTASCII_STRINGPARAM("ALL")))
+ if( sLanguage.equalsIgnoreAsciiCase("ALL") )
{
- Export::SetLanguages( pMergeDataFile->GetLanguages() );
aLanguages = pMergeDataFile->GetLanguages();
}
else
- aLanguages = Export::GetLanguages();
+ aLanguages.push_back( sLanguage );
pOutputStream.open(
rOutputFile.getStr(), std::ios_base::out | std::ios_base::trunc);
if (!pOutputStream.is_open()) {