diff --git a/code/ryzom/tools/translation_tools/main.cpp b/code/ryzom/tools/translation_tools/main.cpp index 9a472478b..8967cecee 100644 --- a/code/ryzom/tools/translation_tools/main.cpp +++ b/code/ryzom/tools/translation_tools/main.cpp @@ -111,7 +111,8 @@ enum TDiffCommand diff_add, diff_changed, diff_removed, - diff_swap + diff_swap, + diff_keep }; struct TDiffInfo @@ -246,6 +247,8 @@ bool parseDiffCommandFromComment(const ucstring &comments, TDiffInfo &diffInfo) diffInfo.Command = diff_changed; else if (commandStr == "REMOVED") diffInfo.Command = diff_removed; + else if (commandStr == "KEEP") + diffInfo.Command = diff_keep; else { nlwarning("Invalid diff command '%s'", commandStr.c_str()); @@ -402,6 +405,10 @@ bool mergeStringDiff(vector &strings, const string &language, const nlassert(diffInfo.Index1 < strings.size()); strings.erase(strings.begin()+diffInfo.Index1); break; + case diff_keep: + nlassert(diffInfo.Index1 < strings.size()); + strings[diffInfo.Index1].HashValue = diff[j].HashValue; + break; default: nlassert(false); } @@ -904,6 +911,11 @@ bool mergePhraseDiff(vector &phrases, const string &language, bool only ("In REMOVED, Index1 (%u) is not less than number of phrase (%u)", diffInfo.Index1, phrases.size())); phrases.erase(phrases.begin()+diffInfo.Index1); break; + case diff_keep: + nlassertex(diffInfo.Index1 < phrases.size(), + ("In KEEP, Index1 (%u) is not less than number of phrase (%u)", diffInfo.Index1, phrases.size())); + phrases[diffInfo.Index1].HashValue = diff[j].HashValue; + break; default: nlassert(false); } @@ -1443,6 +1455,14 @@ bool mergeWorksheetDiff(const std::string filename, TWorksheet &sheet, bool only // nlassertex(diffInfo.Index2 > 0); swap(sheet[diffInfo.Index1], sheet[diffInfo.Index2]); break; + case diff_keep: + { + nlassertex(diffInfo.Index1 <= sheet.Data.size(), + ("KEEP cmd in diff file reference row %u, but worksheet only contains %u entries", + diffInfo.Index1, sheet.Data.size())); + nlerror("diff_keep not implemented"); // TODO + } + break; default: nlassert(false); } @@ -2059,13 +2079,17 @@ void mergePhraseDiff2Impl(vector& reference, const vector& add { nlassert( phrases.find(first->Identifier) == phrases.end() ); phrases[first->Identifier] = *first; - } else if ( first->Comments.find(ucstring("DIFF REMOVED")) != ucstring::npos) { nlassert( phrases.find(first->Identifier) != phrases.end() ); phrases.erase( phrases.find(first->Identifier)); } + else if ( first->Comments.find(ucstring("DIFF KEEP")) != ucstring::npos) + { + nlassert( phrases.find(first->Identifier) != phrases.end() ); + phrases[first->Identifier].HashValue = first->HashValue; + } else { // nlassert(0 && "INVALID DIFF COMMAND");