[Libreoffice-commits] core.git: 2 commits - l10ntools/source
jan Iversen
jani at documentfoundation.org
Wed May 4 11:24:10 UTC 2016
l10ntools/source/gConvPo.cxx | 17 +++++++++++++++--
l10ntools/source/gConvXcu.cxx | 8 ++++++--
l10ntools/source/gLexXcu.l | 3 ++-
3 files changed, 23 insertions(+), 5 deletions(-)
New commits:
commit e8fb6ae467feef14e89913588be1b845c41c3c46
Author: jan Iversen <jani at documentfoundation.org>
Date: Wed May 4 11:11:43 2016 +0000
genlang keygen with newline changed
when generating the keyid for text, all newlines
\n must be converted to 0x0A
Change-Id: I626776e94a6573d044522990a7f9ccc3d52b825b
diff --git a/l10ntools/source/gConvPo.cxx b/l10ntools/source/gConvPo.cxx
index 29cb2fe..431b58e 100644
--- a/l10ntools/source/gConvPo.cxx
+++ b/l10ntools/source/gConvPo.cxx
@@ -206,7 +206,7 @@ void convert_po::save(const string& sFileName,
{
string sName;
ostream outFile(&mfOutBuffer);
- int newPos;
+ int newPos, oldPos;
// isolate filename
newPos = sFileName.find_last_of("/\\", sFileName.length());
@@ -224,7 +224,16 @@ void convert_po::save(const string& sFileName,
outFile << "\"" << sResource << ".text\"" << endl;
if (bFuzzy)
outFile << "#, fuzzy" << endl;
- outFile << "msgid \"" << sENUStext << "\"" << endl
+ outFile << "msgid \"";
+ newPos = oldPos = 0;
+ while ((newPos = sENUStext.find("\\n", oldPos)) > 0) {
+ newPos += 2;
+ outFile << "\"" << endl
+ << "\"" << sENUStext.substr(oldPos, newPos - oldPos);
+ oldPos = newPos;
+ }
+ outFile << "\"" << endl
+ << "\"" << sENUStext.substr(oldPos) << "\"" << endl
<< "msgstr \"" << sText << "\"" << endl;
}
@@ -249,6 +258,10 @@ string convert_po::genKeyId(const string& text)
for (i = 0; (i = newText.find("\\\"", 0)) != (int)string::npos;) {
newText.erase(i, 1);
}
+ for (i = 0; (i = newText.find("\\n", 0)) != (int)string::npos;) {
+ newText.erase(i, 1);
+ newText[i] = 0x0A;
+ }
aCRC32.process_bytes(newText.c_str(), newText.length());
unsigned int nCRC = aCRC32.checksum();
string key;
commit 7031189b9ce472ed908e719be67dd2ca057d5f06
Author: jan Iversen <jani at documentfoundation.org>
Date: Tue May 3 21:36:57 2016 +0000
genlang correct xcu filter
modified algorithm for adding "."
Change-Id: Ibaa59cf5faa7bf211ead222dbb2e5a391929d679
diff --git a/l10ntools/source/gConvXcu.cxx b/l10ntools/source/gConvXcu.cxx
index 0352e98..fe5d921 100644
--- a/l10ntools/source/gConvXcu.cxx
+++ b/l10ntools/source/gConvXcu.cxx
@@ -125,8 +125,12 @@ void convert_xcu::stopCollectData(char *syyText)
if (useText.size()) {
// locate key and extract it
- for (nL = 0; nL < (int)mcStack.size() -1; ++nL)
- useKey += "." + mcStack[nL];
+ int max = (int)mcStack.size() - 1;
+ for (nL = 0; nL < max; ++nL) {
+ useKey += mcStack[nL];
+ if (nL < max -1)
+ useKey += ".";
+ }
mcMemory.setSourceKey(miLineNo, msSourceFile, useKey, useText, "", "value", mcStack[nL], mbMergeMode);
}
diff --git a/l10ntools/source/gLexXcu.l b/l10ntools/source/gLexXcu.l
index 8cc02c4..5eb55a0 100644
--- a/l10ntools/source/gLexXcu.l
+++ b/l10ntools/source/gLexXcu.l
@@ -50,13 +50,14 @@ FIN [^/>]*">"
"component-data" {
LOCptr->addLevel();
LOCptr->pushKey("");
-// LOCptr->copySource(yytext, false);
+ LOCptr->copySource(yytext, false);
}
"<oor:component-data"{NAME} {
LOCptr->addLevel();
+ LOCptr->pushKey("");
LOCptr->pushKey(yytext);
}
More information about the Libreoffice-commits
mailing list