Skip to content

Commit

Permalink
converter: Avoid duplicate msgid in po files
Browse files Browse the repository at this point in the history
  • Loading branch information
10110111 committed Jan 30, 2025
1 parent d54f8bc commit e8ef175
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions util/skyculture-converter/DescriptionOldLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <set>
#include <deque>
#include <string_view>
#include <unordered_set>
#include <QDir>
#include <QFile>
#include <QDebug>
Expand Down Expand Up @@ -635,6 +636,7 @@ void DescriptionOldLoader::loadTranslationsOfNames(const QString& poBaseDir, con

qDebug().nospace() << "Processing translations of names for locale " << locale << "...";
auto& dict = translations[locale];
std::unordered_set<QString> insertedNames;

// First try to find translation for the name of the sky culture
bool scNameTranslated = false;
Expand Down Expand Up @@ -735,6 +737,16 @@ void DescriptionOldLoader::loadTranslationsOfNames(const QString& poBaseDir, con
xcomments = "";
}
}
if(insertedNames.find(msgid) != insertedNames.end())
{
qWarning().nospace() << "msgid \"" << msgid
<< "\" already exists, skipping entry:"
<< "\n - comments: " << comments
<< "\n - extracted comments: " << xcomments
<< "\n - msgstr: \"" << msgstr << "\"";
continue;
}
insertedNames.insert(msgid);
dict.push_back({comments.toUtf8().constData(), xcomments, msgid, msgstr});
}
}
Expand Down

0 comments on commit e8ef175

Please sign in to comment.