|
|
@ -151,13 +151,11 @@ void showUsage(char *exeName)
|
|
|
|
LOG("Reference language is always the first language in languages.txt\n");
|
|
|
|
LOG("Reference language is always the first language in languages.txt\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void verifyVersion(ucstring& doc, int versionId)
|
|
|
|
void verifyVersion(ucstring& doc, int versionId)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
ucstring version1("// DIFF_VERSION 1\r\n");
|
|
|
|
ucstring version1("// DIFF_VERSION 1\n");
|
|
|
|
ucstring::size_type version1Size = version1.size();
|
|
|
|
ucstring::size_type version1Size = version1.size();
|
|
|
|
ucstring version2("// DIFF_VERSION 2\r\n");
|
|
|
|
ucstring version2("// DIFF_VERSION 2\n");
|
|
|
|
ucstring::size_type version2Size = version2.size();
|
|
|
|
ucstring::size_type version2Size = version2.size();
|
|
|
|
|
|
|
|
|
|
|
|
switch (versionId)
|
|
|
|
switch (versionId)
|
|
|
@ -190,7 +188,7 @@ bool readPhraseFile1(const std::string &filename, vector<TPhrase> &phrases, bool
|
|
|
|
{
|
|
|
|
{
|
|
|
|
ucstring doc;
|
|
|
|
ucstring doc;
|
|
|
|
|
|
|
|
|
|
|
|
CI18N::readTextFile(filename, doc, false, false, false, CI18N::LINE_FMT_LF);
|
|
|
|
CI18N::readTextFile(filename, doc, false, false, CI18N::LINE_FMT_LF);
|
|
|
|
verifyVersion(doc, 1);
|
|
|
|
verifyVersion(doc, 1);
|
|
|
|
return readPhraseFileFromString(doc, filename, phrases, forceRehash);
|
|
|
|
return readPhraseFileFromString(doc, filename, phrases, forceRehash);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -199,7 +197,7 @@ bool readPhraseFile2(const std::string &filename, vector<TPhrase> &phrases, bool
|
|
|
|
{
|
|
|
|
{
|
|
|
|
ucstring doc;
|
|
|
|
ucstring doc;
|
|
|
|
|
|
|
|
|
|
|
|
CI18N::readTextFile(filename, doc, false, false, false, CI18N::LINE_FMT_LF);
|
|
|
|
CI18N::readTextFile(filename, doc, false, false, CI18N::LINE_FMT_LF);
|
|
|
|
verifyVersion(doc, 2);
|
|
|
|
verifyVersion(doc, 2);
|
|
|
|
return readPhraseFileFromString(doc, filename, phrases, forceRehash);
|
|
|
|
return readPhraseFileFromString(doc, filename, phrases, forceRehash);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -352,7 +350,7 @@ bool mergeStringDiff(vector<TStringInfo> &strings, const string &language, const
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Check if the diff is translated
|
|
|
|
// Check if the diff is translated
|
|
|
|
ucstring text;
|
|
|
|
ucstring text;
|
|
|
|
CI18N::readTextFile(diffs[i], text, false, false, false, CI18N::LINE_FMT_LF);
|
|
|
|
CI18N::readTextFile(diffs[i], text, false, false, CI18N::LINE_FMT_LF);
|
|
|
|
if (text.find(ucstring("DIFF NOT TRANSLATED")) != ucstring::npos)
|
|
|
|
if (text.find(ucstring("DIFF NOT TRANSLATED")) != ucstring::npos)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
LOG("Diff file [%s] is not translated, merging it later.\n", CFile::getFilename(diffs[i]).c_str());
|
|
|
|
LOG("Diff file [%s] is not translated, merging it later.\n", CFile::getFilename(diffs[i]).c_str());
|
|
|
@ -432,6 +430,7 @@ public:
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// nothing to do
|
|
|
|
// nothing to do
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void onAdd(uint addIndex, uint refIndex, TStringDiffContext &context)
|
|
|
|
void onAdd(uint addIndex, uint refIndex, TStringDiffContext &context)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
TStringInfo si = context.Addition[addIndex];
|
|
|
|
TStringInfo si = context.Addition[addIndex];
|
|
|
@ -442,6 +441,7 @@ public:
|
|
|
|
nlinfo("Added %s at %u", si.Identifier.c_str(), addIndex);
|
|
|
|
nlinfo("Added %s at %u", si.Identifier.c_str(), addIndex);
|
|
|
|
context.Diff.push_back(si);
|
|
|
|
context.Diff.push_back(si);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void onRemove(uint addIndex, uint refIndex, TStringDiffContext &context)
|
|
|
|
void onRemove(uint addIndex, uint refIndex, TStringDiffContext &context)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
TStringInfo si = context.Reference[refIndex];
|
|
|
|
TStringInfo si = context.Reference[refIndex];
|
|
|
@ -453,6 +453,7 @@ public:
|
|
|
|
nlinfo("Removed %s at %u", si.Identifier.c_str(), addIndex);
|
|
|
|
nlinfo("Removed %s at %u", si.Identifier.c_str(), addIndex);
|
|
|
|
context.Diff.push_back(si);
|
|
|
|
context.Diff.push_back(si);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void onChanged(uint addIndex, uint refIndex, TStringDiffContext &context)
|
|
|
|
void onChanged(uint addIndex, uint refIndex, TStringDiffContext &context)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
TStringInfo si = context.Addition[addIndex];
|
|
|
|
TStringInfo si = context.Addition[addIndex];
|
|
|
@ -475,8 +476,6 @@ public:
|
|
|
|
si.Comments = ucstring(temp) + nl + nl;
|
|
|
|
si.Comments = ucstring(temp) + nl + nl;
|
|
|
|
context.Diff.push_back(si);
|
|
|
|
context.Diff.push_back(si);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -679,7 +678,7 @@ void cleanComment(const std::string & filename)
|
|
|
|
ucstring text;
|
|
|
|
ucstring text;
|
|
|
|
uint nbOldValue=0;
|
|
|
|
uint nbOldValue=0;
|
|
|
|
|
|
|
|
|
|
|
|
CI18N::readTextFile(filename, text, false, false, false, CI18N::LINE_FMT_LF);
|
|
|
|
CI18N::readTextFile(filename, text, false, false, CI18N::LINE_FMT_LF);
|
|
|
|
|
|
|
|
|
|
|
|
ucstring newText;
|
|
|
|
ucstring newText;
|
|
|
|
ucstring::size_type last = 0;
|
|
|
|
ucstring::size_type last = 0;
|
|
|
@ -697,7 +696,7 @@ void cleanComment(const std::string & filename)
|
|
|
|
ucstring toAdd = text.substr(last, size);
|
|
|
|
ucstring toAdd = text.substr(last, size);
|
|
|
|
newText += toAdd;
|
|
|
|
newText += toAdd;
|
|
|
|
ucstring::size_type commentEnd = text.find(ucstring("*/"), commentBegin);
|
|
|
|
ucstring::size_type commentEnd = text.find(ucstring("*/"), commentBegin);
|
|
|
|
if (commentEnd != ucstring::npos) { commentEnd += 4; }
|
|
|
|
if (commentEnd != ucstring::npos) { commentEnd += 2 + nl.size(); }
|
|
|
|
last = commentEnd;
|
|
|
|
last = commentEnd;
|
|
|
|
++nbOldValue;
|
|
|
|
++nbOldValue;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -800,7 +799,7 @@ int mergeStringDiff(int argc, char *argv[])
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// backup the original file
|
|
|
|
// backup the original file
|
|
|
|
ucstring old;
|
|
|
|
ucstring old;
|
|
|
|
CI18N::readTextFile(filename, old, false, true, false, CI18N::LINE_FMT_LF);
|
|
|
|
CI18N::readTextFile(filename, old, true, false, CI18N::LINE_FMT_LF);
|
|
|
|
if (old != str)
|
|
|
|
if (old != str)
|
|
|
|
CFile::moveFile(historyDir+CFile::getFilenameWithoutExtension(filename)+"_"+diffVersion+"."+CFile::getExtension(filename), filename);
|
|
|
|
CFile::moveFile(historyDir+CFile::getFilenameWithoutExtension(filename)+"_"+diffVersion+"."+CFile::getExtension(filename), filename);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -840,7 +839,7 @@ bool mergePhraseDiff(vector<TPhrase> &phrases, const string &language, bool only
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Check if the diff is translated
|
|
|
|
// Check if the diff is translated
|
|
|
|
ucstring text;
|
|
|
|
ucstring text;
|
|
|
|
CI18N::readTextFile(diffs[i], text, false, false, false, CI18N::LINE_FMT_LF);
|
|
|
|
CI18N::readTextFile(diffs[i], text, false, false, CI18N::LINE_FMT_LF);
|
|
|
|
verifyVersion(text, 1);
|
|
|
|
verifyVersion(text, 1);
|
|
|
|
if (text.find(ucstring("DIFF NOT TRANSLATED")) != ucstring::npos)
|
|
|
|
if (text.find(ucstring("DIFF NOT TRANSLATED")) != ucstring::npos)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -1072,7 +1071,7 @@ int makePhraseDiff(int argc, char *argv[])
|
|
|
|
{
|
|
|
|
{
|
|
|
|
LOG("Writing difference file for language %s\n", Languages[l].c_str());
|
|
|
|
LOG("Writing difference file for language %s\n", Languages[l].c_str());
|
|
|
|
ucstring text;
|
|
|
|
ucstring text;
|
|
|
|
text += "// DIFF_VERSION 1\r\n";
|
|
|
|
text += "// DIFF_VERSION 1\n";
|
|
|
|
text += preparePhraseFile(diff, false);
|
|
|
|
text += preparePhraseFile(diff, false);
|
|
|
|
// add the tag for non translation
|
|
|
|
// add the tag for non translation
|
|
|
|
text += nl + ucstring ("// REMOVE THE FOLOWING LINE WHEN TRANSLATION IS DONE") + nl + ucstring("// DIFF NOT TRANSLATED") + nl;
|
|
|
|
text += nl + ucstring ("// REMOVE THE FOLOWING LINE WHEN TRANSLATION IS DONE") + nl + ucstring("// DIFF NOT TRANSLATED") + nl;
|
|
|
@ -1164,7 +1163,7 @@ int mergePhraseDiff(int argc, char *argv[], int version)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// backup the original file
|
|
|
|
// backup the original file
|
|
|
|
ucstring old;
|
|
|
|
ucstring old;
|
|
|
|
CI18N::readTextFile(filename, old, false, true, false, CI18N::LINE_FMT_LF);
|
|
|
|
CI18N::readTextFile(filename, old, true, false, CI18N::LINE_FMT_LF);
|
|
|
|
if (old != str)
|
|
|
|
if (old != str)
|
|
|
|
CFile::moveFile(historyDir+CFile::getFilenameWithoutExtension(filename)+"_"+diffVersion+"."+CFile::getExtension(filename), filename);
|
|
|
|
CFile::moveFile(historyDir+CFile::getFilenameWithoutExtension(filename)+"_"+diffVersion+"."+CFile::getExtension(filename), filename);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1333,7 +1332,7 @@ int mergeClauseDiff(int argc, char *argv[])
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// backup the original file
|
|
|
|
// backup the original file
|
|
|
|
ucstring old;
|
|
|
|
ucstring old;
|
|
|
|
CI18N::readTextFile(filename, old, false, true, false, CI18N::LINE_FMT_LF);
|
|
|
|
CI18N::readTextFile(filename, old, true, false, CI18N::LINE_FMT_LF);
|
|
|
|
if (old != str)
|
|
|
|
if (old != str)
|
|
|
|
CFile::moveFile(historyDir+CFile::getFilenameWithoutExtension(filename)+"_"+diffVersion+"."+CFile::getExtension(filename), filename);
|
|
|
|
CFile::moveFile(historyDir+CFile::getFilenameWithoutExtension(filename)+"_"+diffVersion+"."+CFile::getExtension(filename), filename);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1358,7 +1357,7 @@ bool mergeWorksheetDiff(const std::string filename, TWorksheet &sheet, bool only
|
|
|
|
if (onlyTranslated)
|
|
|
|
if (onlyTranslated)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
ucstring text;
|
|
|
|
ucstring text;
|
|
|
|
CI18N::readTextFile(fileList[i], text, false, false, false, CI18N::LINE_FMT_LF);
|
|
|
|
CI18N::readTextFile(fileList[i], text, false, false, CI18N::LINE_FMT_LF);
|
|
|
|
if (text.find(ucstring("DIFF NOT TRANSLATED")) != ucstring::npos)
|
|
|
|
if (text.find(ucstring("DIFF NOT TRANSLATED")) != ucstring::npos)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
LOG("Diff file [%s] is not translated, merging it later.\n", CFile::getFilename(fileList[i]).c_str());
|
|
|
|
LOG("Diff file [%s] is not translated, merging it later.\n", CFile::getFilename(fileList[i]).c_str());
|
|
|
@ -1691,7 +1690,7 @@ int mergeWorksheetDiff(int argc, char *argv[], const std::string &filename, cons
|
|
|
|
// there is no translated file yet, build one from the working file.
|
|
|
|
// there is no translated file yet, build one from the working file.
|
|
|
|
ucstring str;
|
|
|
|
ucstring str;
|
|
|
|
string addfn = addDir+additionFile;
|
|
|
|
string addfn = addDir+additionFile;
|
|
|
|
CI18N::readTextFile(addfn, str, false, false, false, CI18N::LINE_FMT_LF);
|
|
|
|
CI18N::readTextFile(addfn, str, false, false, CI18N::LINE_FMT_LF);
|
|
|
|
str = str.substr(0, str.find(nl)+2);
|
|
|
|
str = str.substr(0, str.find(nl)+2);
|
|
|
|
CI18N::writeTextFile(transDir+filename, str);
|
|
|
|
CI18N::writeTextFile(transDir+filename, str);
|
|
|
|
// reread the file.
|
|
|
|
// reread the file.
|
|
|
@ -1711,7 +1710,7 @@ int mergeWorksheetDiff(int argc, char *argv[], const std::string &filename, cons
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// backup the original file
|
|
|
|
// backup the original file
|
|
|
|
ucstring old;
|
|
|
|
ucstring old;
|
|
|
|
CI18N::readTextFile(transDir+filename, old, false, true, false, CI18N::LINE_FMT_LF);
|
|
|
|
CI18N::readTextFile(transDir+filename, old, true, false, CI18N::LINE_FMT_LF);
|
|
|
|
if (old != str)
|
|
|
|
if (old != str)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
string fn(CFile::getFilenameWithoutExtension(filename)), ext(CFile::getExtension(filename));
|
|
|
|
string fn(CFile::getFilenameWithoutExtension(filename)), ext(CFile::getExtension(filename));
|
|
|
@ -1865,7 +1864,7 @@ void cropLines(const std::string &filename, uint32 nbLines)
|
|
|
|
|
|
|
|
|
|
|
|
LOG("Cropping %u lines from file '%s'\n", nbLines, filename.c_str());
|
|
|
|
LOG("Cropping %u lines from file '%s'\n", nbLines, filename.c_str());
|
|
|
|
|
|
|
|
|
|
|
|
CI18N::readTextFile(filename, utext, false, false, false, CI18N::LINE_FMT_LF);
|
|
|
|
CI18N::readTextFile(filename, utext, false, false, CI18N::LINE_FMT_LF);
|
|
|
|
|
|
|
|
|
|
|
|
string text = utext.toUtf8();
|
|
|
|
string text = utext.toUtf8();
|
|
|
|
|
|
|
|
|
|
|
@ -1910,7 +1909,7 @@ int makeWork()
|
|
|
|
// change #include "*_en.txt" into #include "*_wk.txt"
|
|
|
|
// change #include "*_en.txt" into #include "*_wk.txt"
|
|
|
|
ucstring utext;
|
|
|
|
ucstring utext;
|
|
|
|
|
|
|
|
|
|
|
|
CI18N::readTextFile(filename, utext, false, false, false, CI18N::LINE_FMT_LF);
|
|
|
|
CI18N::readTextFile(filename, utext, false, false, CI18N::LINE_FMT_LF);
|
|
|
|
string text = utext.toUtf8();
|
|
|
|
string text = utext.toUtf8();
|
|
|
|
|
|
|
|
|
|
|
|
bool changedFile = false;
|
|
|
|
bool changedFile = false;
|
|
|
@ -2217,7 +2216,6 @@ ucstring preparePhraseFile2(const vector<TPhrase> &phrases, bool removeDiffComme
|
|
|
|
ret += cond + nl;
|
|
|
|
ret += cond + nl;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ret += '\t';
|
|
|
|
ret += '\t';
|
|
|
|
// ucstring text = CI18N::makeMarkedString('[', ']', c.Text);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ucstring text = CI18N::makeMarkedString('[', ']', c.Text);;
|
|
|
|
ucstring text = CI18N::makeMarkedString('[', ']', c.Text);;
|
|
|
|
ucstring text2;
|
|
|
|
ucstring text2;
|
|
|
@ -2331,14 +2329,14 @@ bool sortTransPhrase()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
nlinfo("Updating hashcode of phrase file for %s.", Languages[l].c_str());
|
|
|
|
nlinfo("Updating hashcode of phrase file for %s.\n", Languages[l].c_str());
|
|
|
|
|
|
|
|
// build the diff file for each language.
|
|
|
|
// build the diff file for each language.
|
|
|
|
ucstring str = preparePhraseFile(phrases2, false);
|
|
|
|
ucstring str = preparePhraseFile(phrases2, false);
|
|
|
|
std::string pharseName(transDir+refFile);
|
|
|
|
std::string pharseName(transDir+refFile);
|
|
|
|
CFile::createDirectoryTree( CFile::getPath(pharseName) );
|
|
|
|
CFile::createDirectoryTree( CFile::getPath(pharseName) );
|
|
|
|
CI18N::writeTextFile(pharseName, str);
|
|
|
|
CI18N::writeTextFile(pharseName, str);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -2348,7 +2346,7 @@ void patchWorkFile(vector<TPhrase> &updatedPhrase, const std::string & filename)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
ucstring text;
|
|
|
|
ucstring text;
|
|
|
|
if ( updatedPhrase.empty() ) { return; }
|
|
|
|
if ( updatedPhrase.empty() ) { return; }
|
|
|
|
CI18N::readTextFile(filename, text, false, false, false, CI18N::LINE_FMT_LF);
|
|
|
|
CI18N::readTextFile(filename, text, false, false, CI18N::LINE_FMT_LF);
|
|
|
|
vector<TPhrase>::const_iterator first(updatedPhrase.begin());
|
|
|
|
vector<TPhrase>::const_iterator first(updatedPhrase.begin());
|
|
|
|
vector<TPhrase>::const_iterator last(updatedPhrase.end());
|
|
|
|
vector<TPhrase>::const_iterator last(updatedPhrase.end());
|
|
|
|
for (; first != last; ++first)
|
|
|
|
for (; first != last; ++first)
|
|
|
@ -2415,7 +2413,6 @@ int updatePhraseWork()
|
|
|
|
uint lastFile = (uint)outputResult.size();
|
|
|
|
uint lastFile = (uint)outputResult.size();
|
|
|
|
for (; firstFile != lastFile ; ++firstFile)
|
|
|
|
for (; firstFile != lastFile ; ++firstFile)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
ucstring doc = outputResult[firstFile].first;
|
|
|
|
ucstring doc = outputResult[firstFile].first;
|
|
|
|
std::vector<TPhrase> phrases;
|
|
|
|
std::vector<TPhrase> phrases;
|
|
|
|
readPhraseFileFromString(outputResult[firstFile].first, outputResult[firstFile].second, phrases, true);
|
|
|
|
readPhraseFileFromString(outputResult[firstFile].first, outputResult[firstFile].second, phrases, true);
|
|
|
@ -2447,7 +2444,7 @@ int updatePhraseWork()
|
|
|
|
firstClause->HashValue = clauseHashValue;
|
|
|
|
firstClause->HashValue = clauseHashValue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
updatedPhrases.push_back(transPhrase);
|
|
|
|
updatedPhrases.push_back(transPhrase);
|
|
|
|
updatedPhrases.back().Comments= ucstring("");
|
|
|
|
updatedPhrases.back().Comments.clear();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -2489,7 +2486,7 @@ bool mergePhraseDiff2(vector<TPhrase> &phrases, const string &language, bool onl
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Check if the diff is translated
|
|
|
|
// Check if the diff is translated
|
|
|
|
ucstring text;
|
|
|
|
ucstring text;
|
|
|
|
CI18N::readTextFile(diffs[i], text, false, false, false, CI18N::LINE_FMT_LF);
|
|
|
|
CI18N::readTextFile(diffs[i], text, false, false, CI18N::LINE_FMT_LF);
|
|
|
|
verifyVersion(text, 2);
|
|
|
|
verifyVersion(text, 2);
|
|
|
|
if (text.find(ucstring("DIFF NOT TRANSLATED")) != ucstring::npos)
|
|
|
|
if (text.find(ucstring("DIFF NOT TRANSLATED")) != ucstring::npos)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -2806,7 +2803,7 @@ int makePhraseDiff2(int argc, char *argv[])
|
|
|
|
{
|
|
|
|
{
|
|
|
|
LOG("Writing difference file for language %s\n", Languages[l].c_str());
|
|
|
|
LOG("Writing difference file for language %s\n", Languages[l].c_str());
|
|
|
|
ucstring text;
|
|
|
|
ucstring text;
|
|
|
|
text += "// DIFF_VERSION 2\r\n";
|
|
|
|
text += "// DIFF_VERSION 2\n";
|
|
|
|
text += preparePhraseFile(diff, false);
|
|
|
|
text += preparePhraseFile(diff, false);
|
|
|
|
// add the tag for non translation
|
|
|
|
// add the tag for non translation
|
|
|
|
text += nl + ucstring ("// REMOVE THE FOLOWING LINE WHEN TRANSLATION IS DONE") + nl + ucstring("// DIFF NOT TRANSLATED") + nl;
|
|
|
|
text += nl + ucstring ("// REMOVE THE FOLOWING LINE WHEN TRANSLATION IS DONE") + nl + ucstring("// DIFF NOT TRANSLATED") + nl;
|
|
|
@ -2973,14 +2970,19 @@ void preprocessTextFile(const std::string &filename,
|
|
|
|
|
|
|
|
|
|
|
|
ucstring name = line.substr(firstFilename +1, lastFilename - firstFilename -1);
|
|
|
|
ucstring name = line.substr(firstFilename +1, lastFilename - firstFilename -1);
|
|
|
|
string subFilename = name.toString();
|
|
|
|
string subFilename = name.toString();
|
|
|
|
{
|
|
|
|
|
|
|
|
CIFile testFile;
|
|
|
|
if (!CFile::fileExists(subFilename))
|
|
|
|
if (!testFile.open(subFilename))
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// try to open the include file relative to current file
|
|
|
|
// try to open the include file relative to current file
|
|
|
|
subFilename = CFile::getPath(filename)+subFilename;
|
|
|
|
subFilename = CFile::getPath(filename)+subFilename;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!CFile::fileExists(subFilename))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
nlwarning("Unable to open %s", subFilename.c_str());
|
|
|
|
|
|
|
|
subFilename.clear();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
preprocessTextFile(subFilename, outputResult);
|
|
|
|
preprocessTextFile(subFilename, outputResult);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
@ -2991,8 +2993,6 @@ void preprocessTextFile(const std::string &filename,
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
outputResult.push_back( std::pair<ucstring, std::string> ( current, fullName ) );
|
|
|
|
outputResult.push_back( std::pair<ucstring, std::string> ( current, fullName ) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -3029,7 +3029,7 @@ int mergePhraseDiff(int argc, char *argv[])
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// backup the original file
|
|
|
|
// backup the original file
|
|
|
|
ucstring old;
|
|
|
|
ucstring old;
|
|
|
|
CI18N::readTextFile(filename, old, false, true, false, CI18N::LINE_FMT_LF);
|
|
|
|
CI18N::readTextFile(filename, old, true, false, CI18N::LINE_FMT_LF);
|
|
|
|
if (old != str)
|
|
|
|
if (old != str)
|
|
|
|
CFile::moveFile((historyDir+CFile::getFilenameWithoutExtension(filename)+"_"+diffVersion+"."+CFile::getExtension(filename)).c_str(), filename.c_str());
|
|
|
|
CFile::moveFile((historyDir+CFile::getFilenameWithoutExtension(filename)+"_"+diffVersion+"."+CFile::getExtension(filename)).c_str(), filename.c_str());
|
|
|
|
}
|
|
|
|
}
|
|
|
|