Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Override NormalizeSurname for Polish Culture #555

Merged
merged 2 commits into from
May 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions projects/GKCore/GKCore/Cultures/PolishCulture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,28 @@ public class PolishCulture : EuropeanCulture
public PolishCulture()
{
}

public override string NormalizeSurname(string sn, bool aFemale)
{
if (string.IsNullOrEmpty(sn) || (sn[0] == '(' && sn[sn.Length - 1] == ')'))
{
sn = "?";
}
else
{
if (aFemale)
{
sn = GetMaidenSurname(sn);

if (sn.EndsWith("nа")) {
sn = sn.Substring(0, sn.Length - 1) + "y";
Comment on lines +44 to +45
Copy link
Contributor Author

@burtek burtek May 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's the most common case (other than -ska/-cka/-dzka). There are other cases that are not cover by this, but it depends on the whole word rather than ending and would be hard or impossible to account for all possibilities - though if needed, I can imagine those being in future PRs

} else if (sn.EndsWith("ska") || sn.EndsWith("cka") || sn.EndsWith("dzka")) {
sn = sn.Substring(0, sn.Length - 1) + "i";
}
}
}

return sn;
}
}
}