Skip to content

Commit

Permalink
Added normalization of Polish feminine forms of surnames to masculine…
Browse files Browse the repository at this point in the history
… ones (burtek, #552)
  • Loading branch information
Serg-Norseman committed May 15, 2024
1 parent cbacbde commit 092166d
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 12 deletions.
1 change: 1 addition & 0 deletions locales/help_enu/gkhHistory.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ <h1>Change log</h1>

<p>
<b>28.05.2024 [v2.30.0 &amp; v3.6.0]</b><ul>
<li>Added normalization of Polish feminine forms of surnames to masculine ones (burtek).
<li>Improved saving of notes with text aligned with spaces.
<li>Improved output of portraits from photos with DPI > 100 in GKv3.
<li>Improved age calculation for some date combinations.
Expand Down
1 change: 1 addition & 0 deletions locales/help_rus/gkhHistory.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ <h1>История версий</h1>

<p>
<b>28.05.2024 [v2.30.0 &amp; v3.6.0]</b><ul>
<li>Добавлена нормализация польских женских форм фамилий в мужские (burtek).
<li>Улучшено сохранение заметок с выравниванием текста пробелами.
<li>Улучшен вывод портретов из фотографий с DPI > 100 в GKv3.
<li>Улучшен расчет возраста при некоторых сочетаниях дат.
Expand Down
11 changes: 10 additions & 1 deletion projects/GKCore/GKCore/Cultures/DefaultCulture.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* "GEDKeeper", the personal genealogical database editor.
* Copyright (C) 2009-2023 by Sergey V. Zhdanovskih.
* Copyright (C) 2009-2024 by Sergey V. Zhdanovskih.
*
* This file is part of "GEDKeeper".
*
Expand Down Expand Up @@ -47,6 +47,15 @@ public virtual string NormalizeSurname(string sn, bool aFemale)
return sn;
}

public static string GetMaidenSurname(string surname)
{
if (string.IsNullOrEmpty(surname)) return string.Empty;

int p = surname.IndexOf(" (");
string result = ((p >= 0) ? surname.Substring(0, p) : surname);
return result;
}

public virtual string GetMarriedSurname(string husbSurname)
{
return husbSurname;
Expand Down
2 changes: 1 addition & 1 deletion projects/GKCore/GKCore/Cultures/PolishCulture.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* "GEDKeeper", the personal genealogical database editor.
* Copyright (C) 2009-2017 by Sergey V. Zhdanovskih.
* Copyright (C) 2009-2024 by Sergey V. Zhdanovskih, burtek.
*
* This file is part of "GEDKeeper".
*
Expand Down
9 changes: 0 additions & 9 deletions projects/GKCore/GKCore/Cultures/RussianCulture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,6 @@ public RussianCulture()
HasSurname = true;
}

private static string GetMaidenSurname(string surname)
{
if (string.IsNullOrEmpty(surname)) return "";

int p = surname.IndexOf(" (");
string result = ((p >= 0) ? surname.Substring(0, p) : surname);
return result;
}

public override string NormalizeSurname(string sn, bool aFemale)
{
if (string.IsNullOrEmpty(sn) || (sn[0] == '(' && sn[sn.Length - 1] == ')'))
Expand Down
17 changes: 16 additions & 1 deletion projects/GKTests/GKCore/CulturesTests.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* "GEDKeeper", the personal genealogical database editor.
* Copyright (C) 2009-2023 by Sergey V. Zhdanovskih.
* Copyright (C) 2009-2024 by Sergey V. Zhdanovskih.
*
* This file is part of "GEDKeeper".
*
Expand Down Expand Up @@ -195,5 +195,20 @@ public async Task Test_RussianCulture()

Assert.AreEqual("Иванова Ивана Ивановича", rusCulture.GetPossessiveName(iRec2));
}

[Test]
public void Test_PolishCulture()
{
ICulture culture = new PolishCulture();
Assert.IsNotNull(culture);
Assert.IsFalse(culture.HasPatronymic);
Assert.IsTrue(culture.HasSurname);

Assert.AreEqual("Kowalski", culture.NormalizeSurname("Kowalska", true));

Assert.AreEqual("?", culture.NormalizeSurname(null, false));
Assert.AreEqual("?", culture.NormalizeSurname("", false));
Assert.AreEqual("?", culture.NormalizeSurname("(Kowalska)", false));
}
}
}

0 comments on commit 092166d

Please sign in to comment.