mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-26 17:16:20 +00:00
Merge with develop
This commit is contained in:
parent
e157a7453e
commit
4438ab108c
9 changed files with 244 additions and 226 deletions
|
@ -144,12 +144,10 @@ public:
|
|||
* 16 bits encoding can be recognized by the official header :
|
||||
* FF, FE, witch can be reversed if the data are MSB first.
|
||||
*
|
||||
* Optionally, you can force the reader to consider the file as
|
||||
* UTF-8 encoded.
|
||||
* Optionally, you can ask the reader to interpret #include commands.
|
||||
*/
|
||||
static void readTextFile(const std::string &filename,
|
||||
ucstring &result, bool forceUtf8 = false,
|
||||
ucstring &result,
|
||||
bool fileLookup = true,
|
||||
bool preprocess = false,
|
||||
TLineFormat lineFmt = LINE_FMT_NO_CARE,
|
||||
|
@ -259,7 +257,7 @@ private:
|
|||
|
||||
/// The internal read function, it does the real job of readTextFile
|
||||
static void _readTextFile(const std::string &filename,
|
||||
ucstring &result, bool forceUtf8,
|
||||
ucstring &result,
|
||||
bool fileLookup,
|
||||
bool preprocess,
|
||||
TLineFormat lineFmt,
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#include "nel/misc/app_context.h"
|
||||
#include "nel/misc/dynloadlib.h"
|
||||
#include "nel/misc/command.h"
|
||||
#include "nel/misc/system_utils.h"
|
||||
|
||||
#include <locale.h>
|
||||
|
||||
|
|
|
@ -412,7 +412,7 @@ void CConfigFile::reparse (bool lookupPaths)
|
|||
if (!CPath::lookup(fn, false).empty())
|
||||
{
|
||||
ucstring content;
|
||||
CI18N::readTextFile(fn, content, true, true, true);
|
||||
CI18N::readTextFile(fn, content, true, true);
|
||||
string utf8 = content.toUtf8();
|
||||
|
||||
CMemStream stream;
|
||||
|
|
|
@ -117,7 +117,7 @@ bool loadStringFile(const std::string filename, vector<TStringInfo> &stringInfos
|
|||
*/
|
||||
ucstring text;
|
||||
|
||||
CI18N::readTextFile(filename, text, false, false, true, CI18N::LINE_FMT_LF);
|
||||
CI18N::readTextFile(filename, text, false, true, CI18N::LINE_FMT_LF);
|
||||
// CI18N::readTextBuffer(buffer, size, text);
|
||||
// delete [] buffer;
|
||||
|
||||
|
@ -313,7 +313,7 @@ bool readPhraseFile(const std::string &filename, vector<TPhrase> &phrases, bool
|
|||
{
|
||||
ucstring doc;
|
||||
|
||||
CI18N::readTextFile(filename, doc, false, false, true, CI18N::LINE_FMT_LF);
|
||||
CI18N::readTextFile(filename, doc, false, true, CI18N::LINE_FMT_LF);
|
||||
|
||||
return readPhraseFileFromString(doc, filename, phrases, forceRehash);
|
||||
}
|
||||
|
@ -416,9 +416,14 @@ bool readPhraseFileFromString(ucstring const& doc, const std::string &filename,
|
|||
phrase.Clauses.size()+1);
|
||||
return false;
|
||||
}
|
||||
clause.Conditions += "(" + cond + ") ";
|
||||
|
||||
// only prepend a space if required
|
||||
if (!clause.Conditions.empty()) clause.Conditions += " ";
|
||||
|
||||
clause.Conditions += "(" + cond + ")";
|
||||
CI18N::skipWhiteSpace(first, last, &clause.Comments);
|
||||
}
|
||||
|
||||
if (first == last)
|
||||
{
|
||||
nlwarning("DT: in '%s': Found end of file in non closed block for phrase %s\n",
|
||||
|
@ -626,7 +631,7 @@ bool loadExcelSheet(const string filename, TWorksheet &worksheet, bool checkUniq
|
|||
fp.close();
|
||||
|
||||
ucstring str;
|
||||
CI18N::readTextFile(filename, str, false, false, false, CI18N::LINE_FMT_LF);
|
||||
CI18N::readTextFile(filename, str, false, false, CI18N::LINE_FMT_LF);
|
||||
|
||||
if (!readExcelSheet(str, worksheet, checkUnique))
|
||||
return false;
|
||||
|
|
|
@ -502,25 +502,39 @@ void CI18N::skipWhiteSpace(ucstring::const_iterator &it, ucstring::const_iterato
|
|||
if (storeComments && *it == '/' && it+1 != last && *(it+1) == '/')
|
||||
{
|
||||
// found a one line C comment. Store it until end of line.
|
||||
while (it != last && *it != '\n')
|
||||
while (it != last && (*it != '\n' && *it != '\r'))
|
||||
storeComments->push_back(*it++);
|
||||
|
||||
// store the final '\n'
|
||||
if (it != last)
|
||||
storeComments->push_back(*it++);
|
||||
storeComments->push_back('\n');
|
||||
}
|
||||
else if (storeComments && *it == '/' && it+1 != last && *(it+1) == '*')
|
||||
{
|
||||
// found a multi line C++ comment. store until we found the closing '*/'
|
||||
while (it != last && !(*it == '*' && it+1 != last && *(it+1) == '/'))
|
||||
storeComments->push_back(*it++);
|
||||
while (it != last && !(*it == '*' && it + 1 != last && *(it + 1) == '/'))
|
||||
{
|
||||
// don't put \r
|
||||
if (*it == '\r')
|
||||
{
|
||||
// skip it
|
||||
++it;
|
||||
}
|
||||
else
|
||||
{
|
||||
storeComments->push_back(*it++);
|
||||
}
|
||||
}
|
||||
|
||||
// store the final '*'
|
||||
if (it != last)
|
||||
storeComments->push_back(*it++);
|
||||
|
||||
// store the final '/'
|
||||
if (it != last)
|
||||
storeComments->push_back(*it++);
|
||||
|
||||
// and a new line.
|
||||
storeComments->push_back('\r');
|
||||
storeComments->push_back('\n');
|
||||
}
|
||||
else
|
||||
|
@ -656,7 +670,6 @@ bool CI18N::parseMarkedString(ucchar openMark, ucchar closeMark, ucstring::const
|
|||
|
||||
void CI18N::readTextFile(const string &filename,
|
||||
ucstring &result,
|
||||
bool forceUtf8,
|
||||
bool fileLookup,
|
||||
bool preprocess,
|
||||
TLineFormat lineFmt,
|
||||
|
@ -666,7 +679,7 @@ void CI18N::readTextFile(const string &filename,
|
|||
TReadContext readContext;
|
||||
|
||||
// call the inner function
|
||||
_readTextFile(filename, result, forceUtf8, fileLookup, preprocess, lineFmt, warnIfIncludesNotFound, readContext);
|
||||
_readTextFile(filename, result, fileLookup, preprocess, lineFmt, warnIfIncludesNotFound, readContext);
|
||||
|
||||
if (!readContext.IfStack.empty())
|
||||
{
|
||||
|
@ -709,7 +722,6 @@ void CI18N::skipLine(ucstring::const_iterator &it, ucstring::const_iterator end,
|
|||
|
||||
void CI18N::_readTextFile(const string &filename,
|
||||
ucstring &result,
|
||||
bool forceUtf8,
|
||||
bool fileLookup,
|
||||
bool preprocess,
|
||||
TLineFormat lineFmt,
|
||||
|
@ -819,7 +831,7 @@ void CI18N::_readTextFile(const string &filename,
|
|||
subFilename.c_str());
|
||||
|
||||
ucstring inserted;
|
||||
_readTextFile(subFilename, inserted, forceUtf8, fileLookup, preprocess, lineFmt, warnIfIncludesNotFound, readContext);
|
||||
_readTextFile(subFilename, inserted, fileLookup, preprocess, lineFmt, warnIfIncludesNotFound, readContext);
|
||||
final += inserted;
|
||||
}
|
||||
}
|
||||
|
@ -873,7 +885,7 @@ void CI18N::_readTextFile(const string &filename,
|
|||
subFilename.c_str());
|
||||
|
||||
ucstring inserted;
|
||||
_readTextFile(subFilename, inserted, forceUtf8, fileLookup, preprocess, lineFmt, warnIfIncludesNotFound, readContext);
|
||||
_readTextFile(subFilename, inserted, fileLookup, preprocess, lineFmt, warnIfIncludesNotFound, readContext);
|
||||
final += inserted;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -550,7 +550,7 @@ void executeScriptBuf(const string &text)
|
|||
void executeScriptFile(const string &filename)
|
||||
{
|
||||
ucstring temp;
|
||||
CI18N::readTextFile(filename, temp, false, false, false);
|
||||
CI18N::readTextFile(filename, temp, false, false);
|
||||
|
||||
if (temp.empty())
|
||||
{
|
||||
|
|
|
@ -98,6 +98,10 @@ int main(int argc, char *argv[])
|
|||
QApplication::setApplicationVersion(RYZOM_VERSION);
|
||||
QApplication::setWindowIcon(QIcon(":/icons/ryzom.ico"));
|
||||
|
||||
// remove first argument because it's not really an argument
|
||||
QStringList args = QApplication::arguments();
|
||||
args.removeFirst();
|
||||
|
||||
QLocale locale = QLocale::system();
|
||||
|
||||
// load application translations
|
||||
|
@ -199,7 +203,7 @@ int main(int argc, char *argv[])
|
|||
nlinfo("Launching %s", Q2C(tempFile));
|
||||
|
||||
// launch copy in TEMP directory with same arguments
|
||||
if (QProcess::startDetached(tempFile, QApplication::arguments())) return 0;
|
||||
if (QProcess::startDetached(tempFile, args, tempPath)) return 0;
|
||||
|
||||
nlwarning("Unable to launch %s", Q2C(tempFile));
|
||||
}
|
||||
|
@ -309,7 +313,7 @@ int main(int argc, char *argv[])
|
|||
QFile::setPermissions(config.getInstallerInstalledFilePath(), QFile::permissions(config.getInstallerInstalledFilePath()) | QFile::ExeGroup | QFile::ExeUser | QFile::ExeOther);
|
||||
#endif
|
||||
|
||||
if (QProcess::startDetached(config.getInstallerInstalledFilePath())) return 0;
|
||||
if (QProcess::startDetached(config.getInstallerInstalledFilePath(), args, config.getInstallationDirectory())) return 0;
|
||||
|
||||
nlwarning("Unable to restart Installer %s", Q2C(config.getInstallerInstalledFilePath()));
|
||||
#endif
|
||||
|
|
|
@ -74,7 +74,7 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
|
||||
ucstring str;
|
||||
CI18N::readTextFile(inputFile, str, false, false, false);
|
||||
CI18N::readTextFile(inputFile, str, false, false);
|
||||
|
||||
if (outMode == ASCII)
|
||||
{
|
||||
|
|
|
@ -151,13 +151,11 @@ void showUsage(char *exeName)
|
|||
LOG("Reference language is always the first language in languages.txt\n");
|
||||
}
|
||||
|
||||
|
||||
|
||||
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 version2("// DIFF_VERSION 2\r\n");
|
||||
ucstring version2("// DIFF_VERSION 2\n");
|
||||
ucstring::size_type version2Size = version2.size();
|
||||
|
||||
switch (versionId)
|
||||
|
@ -190,7 +188,7 @@ bool readPhraseFile1(const std::string &filename, vector<TPhrase> &phrases, bool
|
|||
{
|
||||
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);
|
||||
return readPhraseFileFromString(doc, filename, phrases, forceRehash);
|
||||
}
|
||||
|
@ -199,7 +197,7 @@ bool readPhraseFile2(const std::string &filename, vector<TPhrase> &phrases, bool
|
|||
{
|
||||
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);
|
||||
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
|
||||
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)
|
||||
{
|
||||
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
|
||||
}
|
||||
|
||||
void onAdd(uint addIndex, uint refIndex, TStringDiffContext &context)
|
||||
{
|
||||
TStringInfo si = context.Addition[addIndex];
|
||||
|
@ -442,6 +441,7 @@ public:
|
|||
nlinfo("Added %s at %u", si.Identifier.c_str(), addIndex);
|
||||
context.Diff.push_back(si);
|
||||
}
|
||||
|
||||
void onRemove(uint addIndex, uint refIndex, TStringDiffContext &context)
|
||||
{
|
||||
TStringInfo si = context.Reference[refIndex];
|
||||
|
@ -453,6 +453,7 @@ public:
|
|||
nlinfo("Removed %s at %u", si.Identifier.c_str(), addIndex);
|
||||
context.Diff.push_back(si);
|
||||
}
|
||||
|
||||
void onChanged(uint addIndex, uint refIndex, TStringDiffContext &context)
|
||||
{
|
||||
TStringInfo si = context.Addition[addIndex];
|
||||
|
@ -472,11 +473,9 @@ public:
|
|||
sprintf(temp, "// DIFF SWAP %u %u (swaping %s and %s)", newIndex, refIndex, context.Reference[newIndex].Identifier.c_str(), context.Reference[refIndex].Identifier.c_str());
|
||||
// sprintf(temp, "// DIFF SWAP %u %u", newIndex, refIndex);
|
||||
|
||||
si.Comments = ucstring(temp) + nl +nl;
|
||||
si.Comments = ucstring(temp) + nl + nl;
|
||||
context.Diff.push_back(si);
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@ -660,7 +659,7 @@ int makeStringDiff(int argc, char *argv[])
|
|||
ucstring str = prepareStringFile(diff, false);
|
||||
|
||||
// add the tag for non translation
|
||||
str += nl + ucstring ("// REMOVE THE FOLOWING LINE WHEN TRANSLATION IS DONE")+nl+ucstring("// DIFF NOT TRANSLATED")+nl;
|
||||
str += nl + ucstring ("// REMOVE THE FOLOWING LINE WHEN TRANSLATION IS DONE") + nl + ucstring("// DIFF NOT TRANSLATED") + nl;
|
||||
|
||||
std::string diffName(diffDir+Languages[l]+"_diff_"+diffVersion+".uxt");
|
||||
CI18N::writeTextFile(diffName, str);
|
||||
|
@ -679,7 +678,7 @@ void cleanComment(const std::string & filename)
|
|||
ucstring text;
|
||||
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::size_type last = 0;
|
||||
|
@ -697,7 +696,7 @@ void cleanComment(const std::string & filename)
|
|||
ucstring toAdd = text.substr(last, size);
|
||||
newText += toAdd;
|
||||
ucstring::size_type commentEnd = text.find(ucstring("*/"), commentBegin);
|
||||
if (commentEnd != ucstring::npos) { commentEnd += 4; }
|
||||
if (commentEnd != ucstring::npos) { commentEnd += 2 + nl.size(); }
|
||||
last = commentEnd;
|
||||
++nbOldValue;
|
||||
}
|
||||
|
@ -800,7 +799,7 @@ int mergeStringDiff(int argc, char *argv[])
|
|||
{
|
||||
// backup the original file
|
||||
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)
|
||||
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
|
||||
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);
|
||||
if (text.find(ucstring("DIFF NOT TRANSLATED")) != ucstring::npos)
|
||||
{
|
||||
|
@ -991,7 +990,7 @@ public:
|
|||
ucstring tempT = preparePhraseFile(tempV, false);
|
||||
CI18N::removeCComment(tempT);
|
||||
phrase.Comments = ucstring("// DIFF CHANGED ") + toString(addIndex) + nl + phrase.Comments;
|
||||
phrase.Comments = phrase.Comments + ucstring("/* OLD VALUE : ["+nl) + tabLines(1, tempT) +nl + "] */" + nl;
|
||||
phrase.Comments = phrase.Comments + ucstring("/* OLD VALUE : [" + nl) + tabLines(1, tempT) + nl + "] */" + nl;
|
||||
phrase.Comments = phrase.Comments + chg;
|
||||
|
||||
nlinfo("Changed %s at %u", phrase.Identifier.c_str(), addIndex);
|
||||
|
@ -1072,10 +1071,10 @@ int makePhraseDiff(int argc, char *argv[])
|
|||
{
|
||||
LOG("Writing difference file for language %s\n", Languages[l].c_str());
|
||||
ucstring text;
|
||||
text += "// DIFF_VERSION 1\r\n";
|
||||
text += "// DIFF_VERSION 1\n";
|
||||
text += preparePhraseFile(diff, false);
|
||||
// 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;
|
||||
CI18N::writeTextFile(diffDir+"phrase_"+Languages[l]+"_diff_"+diffVersion+".txt", text);
|
||||
}
|
||||
}
|
||||
|
@ -1164,7 +1163,7 @@ int mergePhraseDiff(int argc, char *argv[], int version)
|
|||
{
|
||||
// backup the original file
|
||||
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)
|
||||
CFile::moveFile(historyDir+CFile::getFilenameWithoutExtension(filename)+"_"+diffVersion+"."+CFile::getExtension(filename), filename);
|
||||
}
|
||||
|
@ -1270,7 +1269,7 @@ int makeClauseDiff(int argc, char *argv[])
|
|||
ucstring str = prepareStringFile(diff, false);
|
||||
|
||||
// add the tag for non translation
|
||||
str += nl + ucstring ("// REMOVE THE FOLOWING LINE WHEN TRANSLATION IS DONE")+nl+ucstring("// DIFF NOT TRANSLATED")+nl;
|
||||
str += nl + ucstring ("// REMOVE THE FOLOWING LINE WHEN TRANSLATION IS DONE") + nl + ucstring("// DIFF NOT TRANSLATED") + nl;
|
||||
|
||||
std::string diffName(diffDir+"clause_"+Languages[l]+"_diff_"+diffVersion+".txt");
|
||||
CI18N::writeTextFile(diffName, str);
|
||||
|
@ -1333,7 +1332,7 @@ int mergeClauseDiff(int argc, char *argv[])
|
|||
{
|
||||
// backup the original file
|
||||
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)
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
LOG("Diff file [%s] is not translated, merging it later.\n", CFile::getFilename(fileList[i]).c_str());
|
||||
|
@ -1662,7 +1661,7 @@ int makeWorksheetDiff(int argc, char *argv[], const std::string &additionFilenam
|
|||
ucstring str = prepareExcelSheet(diff);
|
||||
|
||||
// add the tag for non translation
|
||||
str += ucstring ("REMOVE THE FOLOWING TWO LINE WHEN TRANSLATION IS DONE")+nl+ucstring("DIFF NOT TRANSLATED")+nl;
|
||||
str += ucstring ("REMOVE THE FOLOWING TWO LINE WHEN TRANSLATION IS DONE") + nl + ucstring("DIFF NOT TRANSLATED") + nl;
|
||||
|
||||
string fn(CFile::getFilenameWithoutExtension(referenceFilename)), ext(CFile::getExtension(referenceFilename));
|
||||
std::string diffName(diffDir+fn+"_diff_"+diffVersion+"."+ext);
|
||||
|
@ -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.
|
||||
ucstring str;
|
||||
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);
|
||||
CI18N::writeTextFile(transDir+filename, str);
|
||||
// reread the file.
|
||||
|
@ -1711,7 +1710,7 @@ int mergeWorksheetDiff(int argc, char *argv[], const std::string &filename, cons
|
|||
{
|
||||
// backup the original file
|
||||
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)
|
||||
{
|
||||
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());
|
||||
|
||||
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();
|
||||
|
||||
|
@ -1910,7 +1909,7 @@ int makeWork()
|
|||
// change #include "*_en.txt" into #include "*_wk.txt"
|
||||
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();
|
||||
|
||||
bool changedFile = false;
|
||||
|
@ -2217,7 +2216,6 @@ ucstring preparePhraseFile2(const vector<TPhrase> &phrases, bool removeDiffComme
|
|||
ret += cond + nl;
|
||||
}
|
||||
ret += '\t';
|
||||
// ucstring text = CI18N::makeMarkedString('[', ']', c.Text);
|
||||
|
||||
ucstring text = CI18N::makeMarkedString('[', ']', c.Text);;
|
||||
ucstring text2;
|
||||
|
@ -2331,14 +2329,14 @@ bool sortTransPhrase()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
nlinfo("Updating hashcode of phrase file for %s.\n", Languages[l].c_str());
|
||||
nlinfo("Updating hashcode of phrase file for %s.", Languages[l].c_str());
|
||||
// build the diff file for each language.
|
||||
ucstring str = preparePhraseFile(phrases2, false);
|
||||
std::string pharseName(transDir+refFile);
|
||||
CFile::createDirectoryTree( CFile::getPath(pharseName) );
|
||||
CI18N::writeTextFile(pharseName, str);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -2348,7 +2346,7 @@ void patchWorkFile(vector<TPhrase> &updatedPhrase, const std::string & filename)
|
|||
{
|
||||
ucstring text;
|
||||
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 last(updatedPhrase.end());
|
||||
for (; first != last; ++first)
|
||||
|
@ -2415,7 +2413,6 @@ int updatePhraseWork()
|
|||
uint lastFile = (uint)outputResult.size();
|
||||
for (; firstFile != lastFile ; ++firstFile)
|
||||
{
|
||||
|
||||
ucstring doc = outputResult[firstFile].first;
|
||||
std::vector<TPhrase> phrases;
|
||||
readPhraseFileFromString(outputResult[firstFile].first, outputResult[firstFile].second, phrases, true);
|
||||
|
@ -2447,7 +2444,7 @@ int updatePhraseWork()
|
|||
firstClause->HashValue = clauseHashValue;
|
||||
}
|
||||
updatedPhrases.push_back(transPhrase);
|
||||
updatedPhrases.back().Comments= ucstring("");
|
||||
updatedPhrases.back().Comments.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2470,7 +2467,7 @@ int updatePhraseWork()
|
|||
}
|
||||
|
||||
updatePhraseHashValue(validPhraseHashValue, saveDir);
|
||||
updateClauseHashValue(validClauseHashValue, saveDir);
|
||||
updateClauseHashValue(validClauseHashValue, saveDir);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -2489,7 +2486,7 @@ bool mergePhraseDiff2(vector<TPhrase> &phrases, const string &language, bool onl
|
|||
{
|
||||
// Check if the diff is translated
|
||||
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);
|
||||
if (text.find(ucstring("DIFF NOT TRANSLATED")) != ucstring::npos)
|
||||
{
|
||||
|
@ -2701,7 +2698,7 @@ void CMakePhraseDiff2::onChanged(uint addIndex, uint refIndex, TPhraseDiffContex
|
|||
ucstring tempT = preparePhraseFile(tempV, false);
|
||||
CI18N::removeCComment(tempT);
|
||||
phrase.Comments = ucstring("// DIFF CHANGED ") + toString(addIndex) + nl + phrase.Comments;
|
||||
phrase.Comments = phrase.Comments + ucstring("/* OLD VALUE : ["+nl) + tabLines(1, tempT) +nl + "] */" + nl;
|
||||
phrase.Comments = phrase.Comments + ucstring("/* OLD VALUE : [" + nl) + tabLines(1, tempT) + nl + "] */" + nl;
|
||||
phrase.Comments = phrase.Comments + chg;
|
||||
|
||||
nlinfo("Changed %s at %u", phrase.Identifier.c_str(), addIndex);
|
||||
|
@ -2806,10 +2803,10 @@ int makePhraseDiff2(int argc, char *argv[])
|
|||
{
|
||||
LOG("Writing difference file for language %s\n", Languages[l].c_str());
|
||||
ucstring text;
|
||||
text += "// DIFF_VERSION 2\r\n";
|
||||
text += "// DIFF_VERSION 2\n";
|
||||
text += preparePhraseFile(diff, false);
|
||||
// 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;
|
||||
CI18N::writeTextFile(diffDir+"phrase_"+Languages[l]+"_diff_"+diffVersion+".txt", text);
|
||||
}
|
||||
}
|
||||
|
@ -2973,14 +2970,19 @@ void preprocessTextFile(const std::string &filename,
|
|||
|
||||
ucstring name = line.substr(firstFilename +1, lastFilename - firstFilename -1);
|
||||
string subFilename = name.toString();
|
||||
|
||||
if (!CFile::fileExists(subFilename))
|
||||
{
|
||||
CIFile testFile;
|
||||
if (!testFile.open(subFilename))
|
||||
{
|
||||
// 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);
|
||||
}
|
||||
else
|
||||
|
@ -2991,8 +2993,6 @@ void preprocessTextFile(const std::string &filename,
|
|||
|
||||
}
|
||||
|
||||
|
||||
|
||||
outputResult.push_back( std::pair<ucstring, std::string> ( current, fullName ) );
|
||||
}
|
||||
|
||||
|
@ -3029,7 +3029,7 @@ int mergePhraseDiff(int argc, char *argv[])
|
|||
{
|
||||
// backup the original file
|
||||
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)
|
||||
CFile::moveFile((historyDir+CFile::getFilenameWithoutExtension(filename)+"_"+diffVersion+"."+CFile::getExtension(filename)).c_str(), filename.c_str());
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue