diff options
29 files changed, 159 insertions, 244 deletions
diff --git a/crashrep/CustomTarget_crashrep_res.mk b/crashrep/CustomTarget_crashrep_res.mk index c64f4cb8cc21..be6c68899211 100644 --- a/crashrep/CustomTarget_crashrep_res.mk +++ b/crashrep/CustomTarget_crashrep_res.mk @@ -38,7 +38,7 @@ $(call gb_CustomTarget_get_workdir,crashrep/source/win32)/crashrep.ulf : \ $(call gb_Executable_get_runtime_dependencies,ulfex) MERGEINPUT=`$(gb_MKTEMP)` && \ echo $(foreach lang,$(gb_TRANS_LANGS),$(gb_POLOCATION)/$(lang)/$(patsubst %/,%,$(subst $(SRCDIR)/,,$(dir $<))).po) > $${MERGEINPUT} && \ - $(call gb_Executable_get_command,ulfex) -p crashrep -i $< -o $@ -m $${MERGEINPUT} -l all && \ + $(call gb_Executable_get_command,ulfex) -i $< -o $@ -m $${MERGEINPUT} -l all && \ rm -f $${MERGEINPUT} # vim: set shiftwidth=4 tabstop=4 noexpandtab: diff --git a/instsetoo_native/CustomTarget_install.mk b/instsetoo_native/CustomTarget_install.mk index 0087239415d9..ca3f2def3f3c 100644 --- a/instsetoo_native/CustomTarget_install.mk +++ b/instsetoo_native/CustomTarget_install.mk @@ -44,7 +44,7 @@ $(call gb_CustomTarget_get_workdir,instsetoo_native/install)/win_ulffiles/%.ulf: MERGEINPUT=`$(gb_MKTEMP)` && \ echo $(foreach lang,$(gb_TRANS_LANGS),$(gb_POLOCATION)/$(lang)/instsetoo_native/inc_openoffice/windows/msi_languages.po) > $${MERGEINPUT} && \ $(call gb_Helper_abbreviate_dirs,\ - $(call gb_Executable_get_command,ulfex) -p instsetoo_native -i $< -o $@ -m $${MERGEINPUT} -l all ) && \ + $(call gb_Executable_get_command,ulfex) -i $< -o $@ -m $${MERGEINPUT} -l all ) && \ rm -rf $${MERGEINPUT} else $(call gb_CustomTarget_get_workdir,instsetoo_native/install)/win_ulffiles/%.ulf: \ diff --git a/l10ntools/inc/cfgmerge.hxx b/l10ntools/inc/cfgmerge.hxx index 05987281cc71..bbe68eb14f85 100644 --- a/l10ntools/inc/cfgmerge.hxx +++ b/l10ntools/inc/cfgmerge.hxx @@ -144,7 +144,6 @@ public: class CfgExport : public CfgParser { private: - rtl::OString sPrj; rtl::OString sPath; std::vector<rtl::OString> aLanguages; @@ -160,9 +159,9 @@ protected: void Output(const rtl::OString& rOutput); public: CfgExport( - const rtl::OString &rOutputFile, - const rtl::OString &rProject, - const rtl::OString &rFilePath + const OString &rOutputFile, + const OString &rFilePath, + const OString &rLanguage ); ~CfgExport(); }; @@ -190,8 +189,9 @@ protected: void Output(const rtl::OString& rOutput); public: - CfgMerge(const rtl::OString &rMergeSource, - const rtl::OString &rOutputFile, const rtl::OString &rFilename); + CfgMerge( + const OString &rMergeSource, const OString &rOutputFile, + const OString &rFilename, const OString &rLanguage ); ~CfgMerge(); }; diff --git a/l10ntools/inc/export.hxx b/l10ntools/inc/export.hxx index 564e87717bf6..fbe7adac497c 100644 --- a/l10ntools/inc/export.hxx +++ b/l10ntools/inc/export.hxx @@ -247,20 +247,16 @@ class ParserQueue; //result type of handleArguments() struct HandledArgs { - OString m_sPrj; - OString m_sPrjRoot; OString m_sInputFile; OString m_sOutputFile; OString m_sMergeSrc; - OString m_sLanguages; + OString m_sLanguage; bool m_bMergeMode; HandledArgs() - : m_sPrj( OString() ) - , m_sPrjRoot( OString() ) - , m_sInputFile( OString() ) + : m_sInputFile( OString() ) , m_sOutputFile( OString() ) , m_sMergeSrc( OString() ) - , m_sLanguages( OString() ) + , m_sLanguage( OString() ) , m_bMergeMode( false ) {} }; @@ -289,8 +285,6 @@ private: std::size_t nListIndex; std::size_t nListLevel; bool bSkipFile; - rtl::OString sProject; - rtl::OString sRoot; sal_Bool bMergeMode; rtl::OString sMergeSrc; rtl::OString sLastListLine; diff --git a/l10ntools/inc/helpmerge.hxx b/l10ntools/inc/helpmerge.hxx index d248d9c84460..fd11609a9a59 100644 --- a/l10ntools/inc/helpmerge.hxx +++ b/l10ntools/inc/helpmerge.hxx @@ -44,8 +44,8 @@ public: /// Method append a PO file with the content of a parsed XML file /// @PRECOND rHelpFile is valid - static bool CreatePO( const rtl::OString &rPOFile_in, const rtl::OString &sHelpFile, - XMLFile *pXmlFile, const rtl::OString &rGsi1 ); + static bool CreatePO( const OString &rPOFile_in, const OString &sHelpFile, const OString &rLanguage, + XMLFile *pXmlFile, const OString &rGsi1 ); /// Method merges the String from the POfile into XMLfile. Both Strings must /// point to existing files. diff --git a/l10ntools/inc/lngmerge.hxx b/l10ntools/inc/lngmerge.hxx index d18bce3bdd97..4631bb3536f8 100644 --- a/l10ntools/inc/lngmerge.hxx +++ b/l10ntools/inc/lngmerge.hxx @@ -53,9 +53,9 @@ public: sal_Bool bULFFormat); ~LngParser(); - sal_Bool CreatePO( const rtl::OString &rPOFile ); - sal_Bool Merge(const rtl::OString &rPOFile, - const rtl::OString &rDestinationFile); + sal_Bool CreatePO( const OString &rPOFile, const OString &rLanguage ); + sal_Bool Merge(const OString &rPOFile, const OString &rDestinationFile, + const OString &rLanguage ); }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/l10ntools/inc/xrmmerge.hxx b/l10ntools/inc/xrmmerge.hxx index c5671eb4255c..83736263796c 100644 --- a/l10ntools/inc/xrmmerge.hxx +++ b/l10ntools/inc/xrmmerge.hxx @@ -81,7 +81,6 @@ class XRMResExport : public XRMResParser { private: ResData *pResData; - rtl::OString sPrj; rtl::OString sPath; PoOfstream pOutputStream; protected: @@ -101,9 +100,8 @@ protected: public: XRMResExport( - const rtl::OString &rOutputFile, - const rtl::OString &rProject, - const rtl::OString &rFilePath + const OString &rOutputFile, + const OString &rFilePath ); virtual ~XRMResExport(); }; 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()) { diff --git a/librelogo/CustomTarget_librelogo.mk b/librelogo/CustomTarget_librelogo.mk index 2251346e2db8..92c8504a0551 100644 --- a/librelogo/CustomTarget_librelogo.mk +++ b/librelogo/CustomTarget_librelogo.mk @@ -40,7 +40,6 @@ $(librelogo_DIR)/LibreLogo_%.properties : \ MERGEINPUT=`$(gb_MKTEMP)` && \ echo $(POFILE) > $${MERGEINPUT} && \ $(call gb_Executable_get_command,propex) \ - -p librelogo \ -i $(SOURCE) \ -o $@ \ -m $${MERGEINPUT} \ diff --git a/readlicense_oo/CustomTarget_readme.mk b/readlicense_oo/CustomTarget_readme.mk index 0989598b3614..047f36cc6308 100644 --- a/readlicense_oo/CustomTarget_readme.mk +++ b/readlicense_oo/CustomTarget_readme.mk @@ -40,7 +40,6 @@ $(readlicense_oo_DIR)/readme.xrm : \ MERGEINPUT=`$(gb_MKTEMP)` && \ echo $(foreach lang,$(filter-out qtz,$(filter-out en-US,$(gb_WITH_LANG))),$(gb_POLOCATION)/$(lang)/readlicense_oo/docs.po) > $${MERGEINPUT} && \ $(call gb_Executable_get_command,xrmex) \ - -p readlicense_oo \ -i $< \ -o $@ \ -m $${MERGEINPUT} \ diff --git a/setup_native/CustomTarget_mac.mk b/setup_native/CustomTarget_mac.mk index d91c6bddaa55..d3b171b6716e 100644 --- a/setup_native/CustomTarget_mac.mk +++ b/setup_native/CustomTarget_mac.mk @@ -18,7 +18,7 @@ $(call gb_CustomTarget_get_workdir,setup_native/mac)/macinstall.ulf: $(SRCDIR)/s MERGEINPUT=`$(gb_MKTEMP)` && \ echo $(foreach lang,$(gb_TRANS_LANGS),$(gb_POLOCATION)/$(lang)/setup_native/source/mac.po) > $${MERGEINPUT} && \ $(call gb_Helper_abbreviate_dirs,\ - $(call gb_Executable_get_command,ulfex) -p setup_native -i $< -o $@ -m $${MERGEINPUT} -l all ) && \ + $(call gb_Executable_get_command,ulfex) -i $< -o $@ -m $${MERGEINPUT} -l all ) && \ rm -rf $${MERGEINPUT} else $(call gb_CustomTarget_get_workdir,setup_native/mac)/macinstall.ulf: $(SRCDIR)/setup_native/source/mac/macinstall.ulf diff --git a/shell/CustomTarget_shlxthdl_res.mk b/shell/CustomTarget_shlxthdl_res.mk index 1e0e12b68479..382724f52390 100644 --- a/shell/CustomTarget_shlxthdl_res.mk +++ b/shell/CustomTarget_shlxthdl_res.mk @@ -54,7 +54,7 @@ $(call gb_CustomTarget_get_workdir,shell/source/win32/shlxthandler/res)/shlxthdl $(call gb_Executable_get_runtime_dependencies,ulfex) MERGEINPUT=`$(gb_MKTEMP)` && \ echo $(foreach lang,$(gb_TRANS_LANGS),$(gb_POLOCATION)/$(lang)/$(patsubst %/,%,$(subst $(SRCDIR)/,,$(dir $<))).po) > $${MERGEINPUT} && \ - $(call gb_Executable_get_command,ulfex) -p shell -i $< -o $@ -m $${MERGEINPUT} -l all && \ + $(call gb_Executable_get_command,ulfex) -i $< -o $@ -m $${MERGEINPUT} -l all && \ rm -f $${MERGEINPUT} # vim: set shiftwidth=4 tabstop=4 noexpandtab: diff --git a/solenv/gbuild/AllLangResTarget.mk b/solenv/gbuild/AllLangResTarget.mk index 6bb25468d1da..f6f7feba1700 100644 --- a/solenv/gbuild/AllLangResTarget.mk +++ b/solenv/gbuild/AllLangResTarget.mk @@ -57,7 +57,6 @@ echo $(POFILES) > $${MERGEINPUT} && \ $(call gb_Helper_abbreviate_dirs,\ mkdir -p $(dir $(1)) && \ $(gb_SrsPartMergeTarget_TRANSEXCOMMAND) \ - -p $(firstword $(subst /, ,$(2))) \ -i $(3) \ -o $(1) \ -m $${MERGEINPUT} \ diff --git a/solenv/gbuild/Configuration.mk b/solenv/gbuild/Configuration.mk index 068bbd54ee54..65e9885e219d 100644 --- a/solenv/gbuild/Configuration.mk +++ b/solenv/gbuild/Configuration.mk @@ -269,7 +269,6 @@ echo $(POFILES) > $${MERGEINPUT} && \ $(call gb_Helper_abbreviate_dirs,\ mkdir -p $(dir $(1)) && \ $(gb_XcuMergeTarget_CFGEXCOMMAND) \ - -p $(firstword $(subst /, ,$(2))) \ -i $(3) \ -o $(1) \ -m $${MERGEINPUT} \ diff --git a/solenv/gbuild/ExtensionTarget.mk b/solenv/gbuild/ExtensionTarget.mk index 171d754c1e48..575007091438 100644 --- a/solenv/gbuild/ExtensionTarget.mk +++ b/solenv/gbuild/ExtensionTarget.mk @@ -94,7 +94,6 @@ $(call gb_ExtensionTarget_get_workdir,%)/description.xml : $(gb_ExtensionTarget_ $(call gb_Helper_abbreviate_dirs,\ mkdir -p $(call gb_ExtensionTarget_get_workdir,$*) && \ $(gb_ExtensionTarget_XRMEXCOMMAND) \ - -p $(PRJNAME) \ -i $(filter %.xml,$^) \ -o $@ \ -m $${MERGEINPUT} \ @@ -132,7 +131,6 @@ $(call gb_ExtensionTarget_get_target,$(1)) : FILES := META-INF description.xml $(call gb_ExtensionTarget_get_target,$(1)) : LICENSE := $(call gb_ExtensionTarget_get_target,$(1)) : LOCATION := $(SRCDIR)/$(2) $(call gb_ExtensionTarget_get_target,$(1)) : PLATFORM := $(PLATFORMID) -$(call gb_ExtensionTarget_get_target,$(1)) : PRJNAME := $(firstword $(subst /, ,$(2))) $(call gb_ExtensionTarget_get_workdir,$(1))/description.xml : \ $(SRCDIR)/$(2)/description.xml $(call gb_ExtensionTarget_get_workdir,$(1))/description.xml :| \ diff --git a/solenv/gbuild/InstallModuleTarget.mk b/solenv/gbuild/InstallModuleTarget.mk index 7d22385bae78..6d1c710af2b3 100644 --- a/solenv/gbuild/InstallModuleTarget.mk +++ b/solenv/gbuild/InstallModuleTarget.mk @@ -121,7 +121,7 @@ $(call gb_Output_announce,$(2),$(true),SUM,1) MERGEINPUT=`$(gb_MKTEMP)` && \ echo $(SCP_POFILES) > $${MERGEINPUT} && \ $(call gb_Helper_abbreviate_dirs,\ - $(gb_ScpMergeTarget_COMMAND) -p scp2 -i $(SCP_SOURCE) -o $(1) -m $${MERGEINPUT} -l all ) && \ + $(gb_ScpMergeTarget_COMMAND) -i $(SCP_SOURCE) -o $(1) -m $${MERGEINPUT} -l all ) && \ rm -rf $${MERGEINPUT} endef diff --git a/sysui/CustomTarget_share.mk b/sysui/CustomTarget_share.mk index aa1ab2af3b75..0c2f023ade29 100644 --- a/sysui/CustomTarget_share.mk +++ b/sysui/CustomTarget_share.mk @@ -217,7 +217,7 @@ $(share_WORKDIR)/%.ulf: $(share_SRCDIR)/share/%.ulf | $(call gb_Executable_get_r MERGEINPUT=`$(gb_MKTEMP)` && \ echo $(foreach lang,$(gb_TRANS_LANGS),$(gb_POLOCATION)/$(lang)/$(patsubst %/,%,$(dir $@)).po) > $${MERGEINPUT} && \ $(call gb_Helper_abbreviate_dirs,\ - $(call gb_Executable_get_command,ulfex) -p sysui -i $< -o $@ -m $${MERGEINPUT} -l all ) && \ + $(call gb_Executable_get_command,ulfex) -i $< -o $@ -m $${MERGEINPUT} -l all ) && \ rm -rf $${MERGEINPUT} else $(share_WORKDIR)/%.ulf: $(share_SRCDIR)/share/%.ulf |