Commit 3410116a authored by Volker Krause's avatar Volker Krause
Browse files

Consider transliteration when comparing person names

Particularly relevant in the context of IATA BCBPs which are 7bit ASCII
only.
parent ddd9c3e3
Pipeline #235656 passed with stage
in 3 minutes and 35 seconds
......@@ -143,6 +143,11 @@ private Q_SLOTS:
{_("DANIEL VRATIL"), {}, {} },
{_("DANIEL VRATIL"), _("DANIEL"), _("VRATIL") }
};
QTest::newRow("transliteration") << QVector<QStringList> {
{_("Bjärn Lastname"), {}, {} },
{_("BJAERN LASTNAME"), _("BJAERN"), _("LASTNAME") },
};
}
void testIsSamePerson()
......
......@@ -494,8 +494,21 @@ static bool isNameEqualish(const QString &lhs, const QString &rhs)
bool MergeUtil::isSamePerson(const Person& lhs, const Person& rhs)
{
return isNameEqualish(lhs.name(), rhs.name()) ||
(isNameEqualish(lhs.givenName(), rhs.givenName()) && isNameEqualish(lhs.familyName(), rhs.familyName()));
if (isNameEqualish(lhs.name(), rhs.name()) ||
(isNameEqualish(lhs.givenName(), rhs.givenName()) && isNameEqualish(lhs.familyName(), rhs.familyName()))) {
return true;
}
const auto lhsNameT = StringUtil::transliterate(lhs.name());
const auto lhsGivenNameT = StringUtil::transliterate(lhs.givenName());
const auto lhsFamilyNameT = StringUtil::transliterate(lhs.familyName());
const auto rhsNameT = StringUtil::transliterate(rhs.name());
const auto rhsGivenNameT = StringUtil::transliterate(rhs.givenName());
const auto rhsFamilyNameT = StringUtil::transliterate(rhs.familyName());
return isNameEqualish(lhsNameT, rhsNameT) ||
(isNameEqualish(lhsGivenNameT, rhsGivenNameT) && isNameEqualish(lhsFamilyNameT, rhsFamilyNameT));
}
static bool isSameEvent(const Event &lhs, const Event &rhs)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment