diff options
author | jan Iversen <jani@documentfoundation.org> | 2016-05-04 11:11:43 +0000 |
---|---|---|
committer | jan Iversen <jani@documentfoundation.org> | 2016-05-04 11:21:37 +0000 |
commit | e8fb6ae467feef14e89913588be1b845c41c3c46 (patch) | |
tree | ba7259a9f8374f6e88e35462beb358cc9cbe3735 /l10ntools | |
parent | 7031189b9ce472ed908e719be67dd2ca057d5f06 (diff) |
genlang keygen with newline changed
when generating the keyid for text, all newlines
\n must be converted to 0x0A
Change-Id: I626776e94a6573d044522990a7f9ccc3d52b825b
Diffstat (limited to 'l10ntools')
-rw-r--r-- | l10ntools/source/gConvPo.cxx | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/l10ntools/source/gConvPo.cxx b/l10ntools/source/gConvPo.cxx index 29cb2fe4acfc..431b58ee8685 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; |