diff options
author | Zolnai Tamás <zolnaitamas2000@gmail.com> | 2013-04-13 07:21:07 +0200 |
---|---|---|
committer | Zolnai Tamás <zolnaitamas2000@gmail.com> | 2013-04-13 07:22:22 +0200 |
commit | 4146406205ce6f939944685e1931dcd45f3de708 (patch) | |
tree | acaf35336c3c9c41046f31e8be83f9500f30b699 /l10ntools | |
parent | c1a2f580f0a5a479282cfa7ffa538de6d30b216a (diff) |
l10ntools: export use only en-US
So no need to ad it in a commandline parameter.
No need to use a vector to store languages.
Change-Id: I1f7d3bd131b5a9ff23d403cee4ac6804ae8e0a0b
Diffstat (limited to 'l10ntools')
-rw-r--r-- | l10ntools/inc/cfgmerge.hxx | 3 | ||||
-rw-r--r-- | l10ntools/inc/export.hxx | 2 | ||||
-rw-r--r-- | l10ntools/inc/helpmerge.hxx | 2 | ||||
-rw-r--r-- | l10ntools/inc/lngmerge.hxx | 2 | ||||
-rw-r--r-- | l10ntools/source/cfgmerge.cxx | 24 | ||||
-rw-r--r-- | l10ntools/source/export.cxx | 55 | ||||
-rw-r--r-- | l10ntools/source/helpex.cxx | 2 | ||||
-rw-r--r-- | l10ntools/source/helpmerge.cxx | 39 | ||||
-rw-r--r-- | l10ntools/source/lngex.cxx | 2 | ||||
-rw-r--r-- | l10ntools/source/lngmerge.cxx | 22 | ||||
-rw-r--r-- | l10ntools/source/localize.cxx | 1 | ||||
-rw-r--r-- | l10ntools/source/uimerge.cxx | 8 | ||||
-rw-r--r-- | l10ntools/source/xrmmerge.cxx | 17 |
13 files changed, 63 insertions, 116 deletions
diff --git a/l10ntools/inc/cfgmerge.hxx b/l10ntools/inc/cfgmerge.hxx index c34ba06d5f9c..00838dea6c71 100644 --- a/l10ntools/inc/cfgmerge.hxx +++ b/l10ntools/inc/cfgmerge.hxx @@ -160,8 +160,7 @@ protected: public: CfgExport( const OString &rOutputFile, - const OString &rFilePath, - const OString &rLanguage + const OString &rFilePath ); ~CfgExport(); }; diff --git a/l10ntools/inc/export.hxx b/l10ntools/inc/export.hxx index 10223cda974f..719102dfb5b4 100644 --- a/l10ntools/inc/export.hxx +++ b/l10ntools/inc/export.hxx @@ -243,7 +243,7 @@ private: void CutComment( OString &rText ); public: - Export(const OString &rOutput, const OString &rLanguage); + Export( const OString &rOutput ); Export(const OString &rMergeSource, const OString &rOutput, const OString &rLanguage); ~Export(); diff --git a/l10ntools/inc/helpmerge.hxx b/l10ntools/inc/helpmerge.hxx index 95aad6d15ab3..1f9c90acd5aa 100644 --- a/l10ntools/inc/helpmerge.hxx +++ b/l10ntools/inc/helpmerge.hxx @@ -43,7 +43,7 @@ public: /// Method append a PO file with the content of a parsed XML file /// @PRECOND rHelpFile is valid - static bool CreatePO( const OString &rPOFile_in, const OString &sHelpFile, const OString &rLanguage, + static bool CreatePO( const OString &rPOFile_in, const OString &sHelpFile, XMLFile *pXmlFile, const OString &rGsi1 ); /// Method merges the String from the POfile into XMLfile. Both Strings must diff --git a/l10ntools/inc/lngmerge.hxx b/l10ntools/inc/lngmerge.hxx index 8441824339ba..0f98eac2dc9c 100644 --- a/l10ntools/inc/lngmerge.hxx +++ b/l10ntools/inc/lngmerge.hxx @@ -53,7 +53,7 @@ public: sal_Bool bULFFormat); ~LngParser(); - sal_Bool CreatePO( const OString &rPOFile, const OString &rLanguage ); + sal_Bool CreatePO( const OString &rPOFile ); sal_Bool Merge(const OString &rPOFile, const OString &rDestinationFile, const OString &rLanguage ); }; diff --git a/l10ntools/source/cfgmerge.cxx b/l10ntools/source/cfgmerge.cxx index dcbcfb94957a..d6a72ed03fb5 100644 --- a/l10ntools/source/cfgmerge.cxx +++ b/l10ntools/source/cfgmerge.cxx @@ -72,7 +72,7 @@ FILE * init(int argc, char ** argv) { } else { global::parser.reset( new CfgExport( - aArgs.m_sOutputFile, global::inputPathname, aArgs.m_sLanguage )); + aArgs.m_sOutputFile, global::inputPathname )); } return pFile; @@ -359,8 +359,7 @@ void CfgParser::Error(const OString& rError) /*****************************************************************************/ CfgExport::CfgExport( const OString &rOutputFile, - const OString &rFilePath, - const OString &rLanguage + const OString &rFilePath ) /*****************************************************************************/ : sPath( rFilePath ) @@ -371,7 +370,6 @@ CfgExport::CfgExport( std::cerr << "ERROR: Unable to open output file: " << rOutputFile << "\n"; std::exit(EXIT_FAILURE); } - aLanguages.push_back( rLanguage ); } /*****************************************************************************/ @@ -388,7 +386,6 @@ void CfgExport::WorkOnResourceEnd() if ( bLocalize ) { if ( pStackData->sText[OString(RTL_CONSTASCII_STRINGPARAM("en-US"))].getLength() ) { - OString sFallback = pStackData->sText[OString(RTL_CONSTASCII_STRINGPARAM("en-US"))]; OString sXComment = pStackData->sText[OString(RTL_CONSTASCII_STRINGPARAM("x-comment"))]; OString sLocalId = pStackData->sIdentifier; OString sGroupId; @@ -400,20 +397,13 @@ void CfgExport::WorkOnResourceEnd() sGroupId = aStack.GetAccessPath( aStack.size() - 2 ); } - for (size_t n = 0; n < aLanguages.size(); n++) - { - OString sCur = aLanguages[ n ]; - - OString sText = pStackData->sText[ sCur ]; - if ( sText.isEmpty()) - sText = sFallback; - sText = helper::UnQuotHTML( sText ); + OString sText = pStackData->sText[ "en-US" ]; + sText = helper::UnQuotHTML( sText ); - common::writePoEntry( - "Cfgex", pOutputStream, sPath, pStackData->sResTyp, - sGroupId, sLocalId, sXComment, sText); - } + common::writePoEntry( + "Cfgex", pOutputStream, sPath, pStackData->sResTyp, + sGroupId, sLocalId, sXComment, sText); } } } diff --git a/l10ntools/source/export.cxx b/l10ntools/source/export.cxx index d4d6e043bd6b..6a93531ed50c 100644 --- a/l10ntools/source/export.cxx +++ b/l10ntools/source/export.cxx @@ -72,7 +72,7 @@ FILE * init(int argc, char ** argv) { global::exporter.reset( new Export(aArgs.m_sMergeSrc, aArgs.m_sOutputFile, aArgs.m_sLanguage)); } else { - global::exporter.reset(new Export(aArgs.m_sOutputFile, aArgs.m_sLanguage)); + global::exporter.reset(new Export(aArgs.m_sOutputFile)); } global::exporter->Init(); @@ -176,7 +176,7 @@ static sal_Int32 lcl_countOccurrences(const OString& text, char c) } -Export::Export(const OString &rOutput, const OString &rLanguage) +Export::Export(const OString &rOutput) : bDefine( sal_False ), bNextMustBeDefineEOL( sal_False ), @@ -191,12 +191,9 @@ Export::Export(const OString &rOutput, const OString &rLanguage) bDontWriteOutput( sal_False ), isInitialized( false ), sFilename( global::inputPathname ), - sLanguages( rLanguage ), + sLanguages( OString() ), pParseQueue( new ParserQueue( *this ) ) { - InitLanguages(); - // used when export is enabled - // open output stream aOutput.mPo = new PoOfstream( rOutput, PoOfstream::APP ); if (!aOutput.mPo->isOpen()) { @@ -1018,39 +1015,31 @@ sal_Bool Export::WriteExportList(ResData *pResData, ExportList *pExportList, } } - OString sCur; for ( size_t i = 0; pExportList != NULL && i < pExportList->size(); i++ ) { ExportListEntry *pEntry = (*pExportList)[ i ]; - OString sLID(OString::valueOf(static_cast<sal_Int64>(i + 1))); - for (unsigned int n = 0; n < aLanguages.size(); ++n) - { - sCur = aLanguages[ n ]; - if (!(*pEntry)[ SOURCE_LANGUAGE ].isEmpty()) - { - OString sText((*pEntry)[ SOURCE_LANGUAGE ] ); + OString sLID; + OString sText((*pEntry)[ SOURCE_LANGUAGE ] ); - // Strip PairList Line String - if (rTyp.equalsIgnoreAsciiCaseL(RTL_CONSTASCII_STRINGPARAM("pairedlist"))) - { - sLID = GetPairedListID( sText ); - if (!(*pEntry)[ sCur ].isEmpty()) - sText = (*pEntry)[ sCur ]; - sText = GetPairedListString( sText ); - } - else - { - sText = StripList( (*pEntry)[ sCur ] ); - if( sText == "\\\"" ) - sText = "\""; - } - ConvertExportContent(sText); - common::writePoEntry( - "Transex3", *aOutput.mPo, global::inputPathname, - rTyp, sGID, sLID, OString(), sText); - } + // Strip PairList Line String + if (rTyp.equalsIgnoreAsciiCase("pairedlist")) + { + sLID = GetPairedListID( sText ); + sText = GetPairedListString( sText ); } + else + { + sLID = OString::valueOf(static_cast<sal_Int64>(i + 1)); + sText = StripList( sText ); + if( sText == "\\\"" ) + sText = "\""; + } + ConvertExportContent(sText); + common::writePoEntry( + "Transex3", *aOutput.mPo, global::inputPathname, + rTyp, sGID, sLID, OString(), sText); + if ( bCreateNew ) delete [] pEntry; } diff --git a/l10ntools/source/helpex.cxx b/l10ntools/source/helpex.cxx index 35aec5e3b8d9..b1486553a67e 100644 --- a/l10ntools/source/helpex.cxx +++ b/l10ntools/source/helpex.cxx @@ -115,7 +115,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) { HelpParser aParser( aArgs.m_sInputFile ); hasNoError = aParser.CreatePO( - aArgs.m_sOutputFile, aArgs.m_sInputFile, aArgs.m_sLanguage, + aArgs.m_sOutputFile, aArgs.m_sInputFile, new XMLFile( OUString('0') ), "help" ); } diff --git a/l10ntools/source/helpmerge.cxx b/l10ntools/source/helpmerge.cxx index b7c389131c56..71ad315a7b48 100644 --- a/l10ntools/source/helpmerge.cxx +++ b/l10ntools/source/helpmerge.cxx @@ -76,7 +76,7 @@ HelpParser::HelpParser( const OString &rHelpFile ) /*****************************************************************************/ bool HelpParser::CreatePO( /*****************************************************************************/ - const OString &rPOFile_in, const OString &sHelpFile, const OString &rLanguage, + const OString &rPOFile_in, const OString &sHelpFile, XMLFile *pXmlFile, const OString &rGsi1){ SimpleXMLParser aParser; OUString sXmlFile( @@ -111,9 +111,6 @@ bool HelpParser::CreatePO( LangHashMap* pElem; XMLElement* pXMLElement = NULL; - std::vector<OString> aLanguages; - aLanguages.push_back( rLanguage ); - std::vector<OString> order = file->getOrder(); std::vector<OString>::iterator pos; XMLHashMap::iterator posm; @@ -124,28 +121,24 @@ bool HelpParser::CreatePO( pElem = posm->second; OString sCur; - for( unsigned int n = 0; n < aLanguages.size(); n++ ) - { - sCur = aLanguages[ n ]; - pXMLElement = (*pElem)[ sCur ]; + pXMLElement = (*pElem)[ "en-US" ]; - if( pXMLElement != NULL ) - { - OString data( - OUStringToOString( pXMLElement->ToOUString(), RTL_TEXTENCODING_UTF8 ). - replaceAll("\n",OString()). - replaceAll("\t",OString()).trim()); + if( pXMLElement != NULL ) + { + OString data( + OUStringToOString( pXMLElement->ToOUString(), RTL_TEXTENCODING_UTF8 ). + replaceAll("\n",OString()). + replaceAll("\t",OString()).trim()); - common::writePoEntry( - "Helpex", aPoOutput, sHelpFile, rGsi1, - posm->first, pXMLElement->GetOldref(), OString(), data); + common::writePoEntry( + "Helpex", aPoOutput, sHelpFile, rGsi1, + posm->first, pXMLElement->GetOldref(), OString(), data); - pXMLElement=NULL; - } - else - { - fprintf(stdout,"\nDBG: NullPointer in HelpParser::CreatePO, Language %s, File %s\n", sCur.getStr(), sHelpFile.getStr()); - } + pXMLElement=NULL; + } + else + { + fprintf(stdout,"\nDBG: NullPointer in HelpParser::CreatePO, Language %s, File %s\n", sCur.getStr(), sHelpFile.getStr()); } } aPoOutput.close(); diff --git a/l10ntools/source/lngex.cxx b/l10ntools/source/lngex.cxx index 957ebd4645a9..399c9cf16f9a 100644 --- a/l10ntools/source/lngex.cxx +++ b/l10ntools/source/lngex.cxx @@ -39,7 +39,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) { aParser.Merge( aArgs.m_sMergeSrc, aArgs.m_sOutputFile, aArgs.m_sLanguage ); else - aParser.CreatePO( aArgs.m_sOutputFile, aArgs.m_sLanguage ); + aParser.CreatePO( aArgs.m_sOutputFile ); return 0; } diff --git a/l10ntools/source/lngmerge.cxx b/l10ntools/source/lngmerge.cxx index 273fe190f42c..27c7d5d9dcb8 100644 --- a/l10ntools/source/lngmerge.cxx +++ b/l10ntools/source/lngmerge.cxx @@ -89,11 +89,8 @@ LngParser::~LngParser() delete pLines; } -sal_Bool LngParser::CreatePO( - const OString &rPOFile, - const OString &rLanguage ) +sal_Bool LngParser::CreatePO( const OString &rPOFile ) { - aLanguages.push_back(rLanguage); PoOfstream aPOStream( rPOFile, PoOfstream::APP ); if (!aPOStream.isOpen()) { std::cerr << "Ulfex error: Can't open po file:" << rPOFile.getStr() << "\n"; @@ -130,18 +127,11 @@ void LngParser::WritePO(PoOfstream &aPOStream, { sal_Bool bExport = true; - if ( bExport ) { - OString sCur; - for( unsigned int n = 0; n < aLanguages.size(); n++ ){ - sCur = aLanguages[ n ]; - OString sAct = rText_inout[ sCur ]; - if ( sAct.isEmpty() && !sCur.isEmpty() ) - sAct = rText_inout[ OString("en-US") ]; - - common::writePoEntry( - "Ulfex", aPOStream, rActFileName, "LngText", - rID, OString(), OString(), sAct); - } + if ( bExport ) + { + common::writePoEntry( + "Ulfex", aPOStream, rActFileName, "LngText", + rID, OString(), OString(), rText_inout["en-US"]); } } diff --git a/l10ntools/source/localize.cxx b/l10ntools/source/localize.cxx index 53f1d0e36392..8bdec4191e73 100644 --- a/l10ntools/source/localize.cxx +++ b/l10ntools/source/localize.cxx @@ -139,7 +139,6 @@ void handleCommand( buf.append(rInPath); buf.append(" -o "); buf.append(rOutPath); - buf.append(" -l en-US"); const OString cmd = buf.makeStringAndClear(); if (system(cmd.getStr()) != 0) diff --git a/l10ntools/source/uimerge.cxx b/l10ntools/source/uimerge.cxx index e724b83126b4..91a0283f0b4e 100644 --- a/l10ntools/source/uimerge.cxx +++ b/l10ntools/source/uimerge.cxx @@ -196,13 +196,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) if (!aArgs.m_bMergeMode) { - if (aArgs.m_sLanguage != "en-US") - { - fprintf(stderr, "only en-US can exist in source .ui files\n"); - nRetValue = 1; - } - else - nRetValue = extractTranslations(); + nRetValue = extractTranslations(); } else { diff --git a/l10ntools/source/xrmmerge.cxx b/l10ntools/source/xrmmerge.cxx index 218765ba8b8c..7fd0797f8da3 100644 --- a/l10ntools/source/xrmmerge.cxx +++ b/l10ntools/source/xrmmerge.cxx @@ -325,7 +325,6 @@ XRMResExport::XRMResExport( pResData( NULL ), sPath( rFilePath ) { - aLanguages.push_back( sLanguage ); pOutputStream.open( rOutputFile, PoOfstream::APP ); if (!pOutputStream.isOpen()) { @@ -395,18 +394,12 @@ void XRMResExport::EndOfText( { if ( pResData ) { - OString sCur; - for( unsigned int n = 0; n < aLanguages.size(); n++ ) - { - sCur = aLanguages[ n ]; + OString sAct = pResData->sText["en-US"]; - OString sAct = pResData->sText[sCur]; - - if( !sAct.isEmpty() ) - common::writePoEntry( - "Xrmex", pOutputStream, sPath, sResourceType, - pResData->sGId, OString(), OString(), sAct ); - } + if( !sAct.isEmpty() ) + common::writePoEntry( + "Xrmex", pOutputStream, sPath, sResourceType, + pResData->sGId, OString(), OString(), sAct ); } delete pResData; pResData = NULL; |