[Libreoffice-commits] core.git: l10ntools/inc l10ntools/source
Zolnai Tamás
zolnaitamas2000 at gmail.com
Sat Apr 13 00:04:14 PDT 2013
l10ntools/inc/cfgmerge.hxx | 3 --
l10ntools/inc/export.hxx | 2 -
l10ntools/inc/helpmerge.hxx | 2 -
l10ntools/inc/lngmerge.hxx | 2 -
l10ntools/source/cfgmerge.cxx | 24 +++++------------
l10ntools/source/export.cxx | 55 ++++++++++++++++-------------------------
l10ntools/source/helpex.cxx | 2 -
l10ntools/source/helpmerge.cxx | 39 +++++++++++------------------
l10ntools/source/lngex.cxx | 2 -
l10ntools/source/lngmerge.cxx | 22 ++++------------
l10ntools/source/localize.cxx | 1
l10ntools/source/uimerge.cxx | 8 -----
l10ntools/source/xrmmerge.cxx | 17 +++---------
13 files changed, 63 insertions(+), 116 deletions(-)
New commits:
commit 4146406205ce6f939944685e1931dcd45f3de708
Author: Zolnai Tamás <zolnaitamas2000 at gmail.com>
Date: Sat Apr 13 07:21:07 2013 +0200
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
diff --git a/l10ntools/inc/cfgmerge.hxx b/l10ntools/inc/cfgmerge.hxx
index c34ba06..00838de 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 10223cd..719102d 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 95aad6d..1f9c90a 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 8441824..0f98eac 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 dcbcfb9..d6a72ed 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 d4d6e04..6a93531 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 35aec5e..b148655 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 b7c3891..71ad315 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 957ebd4..399c9cf 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 273fe19..27c7d5d 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 53f1d0e..8bdec41 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 e724b83..91a0283 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 218765b..7fd0797 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;
More information about the Libreoffice-commits
mailing list