Hyphenated Surnames

I am looking at my relatives that have hyphenated surnames. Right now they are entered as a single surname “Smith-Jones”, but Gramps allows for multiple surnames with connectors.

Question, Should I continue to view them as a single surname or split them?

One problem with splitting them and using “-” as a connector. Gramps displays the name as “Smith - Jones”. I have figured out how to remove the leading space but not the trailing space.

Advice? Other options?

What problem(s) are you trying to solve by splitting them? If you split them, you won’t be able to search for people with hyphenated surnames, or at least not as easily.

When I first entered them in another program, the only option was the single entry. Gramps allows for other options.

Not trying to solve a problem. And the search has never been a concern.

Just seeking advice before I do any work on them.

Interesting question.

I recently wondered the same since it is nice to be able to set the origin differently when the 2 parts of a hyphenated name originate from different parents {or spouse(s) & parent}.

I wonder if using the em-dash would be better hyphenation than the dash or en-dash? But collapsing the white space would be good, in any case.

@emyoulation: I don’t know how it’s used in English, but en- and em-dashes should not be used in that case, because they have other uses than a hyphen, which is used for combined surnames.

1 Like

Changing the function “_raw_full_surname” in gramps.gen.display.name should make this possible:

2 Likes

Making

result += "%s %s %s " % (raw_surn_data[_PREFIX_IN_LIST],
                         raw_surn_data[_SURNAME_IN_LIST],
                         raw_surn_data[_CONNECTOR_IN_LIST])

this

result += "%s %s%s" % (raw_surn_data[_PREFIX_IN_LIST],
                         raw_surn_data[_SURNAME_IN_LIST],
                         raw_surn_data[_CONNECTOR_IN_LIST])

only removed the leading space of " - ". But it also affects all connectors for other records.

I had added '-' to line 309 with the same results but not adversely affecting other records.

def cleanup_name(namestring):
    """Remove too long white space due to missing name parts,
       so "a   b" becomes "a b" and "a , b" becomes "a, b"
    """
    parts = namestring.split()
    if not parts:
        return ""
    result = parts[0]
    for val in parts[1:]:
        if len(val) == 1 and val in [',', ';', ':', '-',
                                     ARABIC_COMMA, ARABIC_SEMICOLON]:
            result +=  val
        else:
            result += ' ' + val

    return result

Attempting to make changes to def _raw_full_surname() causes other unwanted changes because as the primary surname construct it has an affect on most if not all other surnames. Looking to add if/else clauses to take into account a hyphen as a connector was beyond me.

The entire logic of the code is baffling and I am NOT a coder. I can only tweak what others have already written like modifying line 309.

I will either have to live with " - " or leave the hyphenated names as a single entry.

Thank you for pointing me to that section of the code.

2 Likes

I cannot help with the technical issues on removing spaces provided by Gramps. However, I would attempt to keep the hyphen. This is because here in Norway a hyphenated name is legally regarded a single name, whereas no hyphen makes them two names and the last one is the surname. In your example, no hyphen would make “Jones” the surname used for sorting names. “Smith” will be regarded a “middle” name, neither given name nor surname. The hyphenated name will be sorted by “S”. For the Norwegian practice, Gramps’ solution with connectors are better than other genealogical programs I have tried. However, I have yet to work out how to best register name changes, and will make a separate post for that.

I don’t use connectors but I think you could try to replace in the original cleanup_name function :
return result
by
return result.replace(’ - ‘,’-’)

or something like that.

Best regards.

Thank You but there is no joy in Mudville. :cry: I tried all combinations.

Not sure if it is worth a bug fix because as @herrtun pointed out the hyphenated name is often considered as a single legal entry.

I ve tried and seems to work if you set this in Preferences :

I don’t think it’s a bug but could eventualy become a proposal to have an option to choice the way connectors are rendering (with or without spaces)…

Best regards.

1 Like

@zebulon You set me on the right track.

My solution was Given Primary[pre] Primary[sur]Primary[con]Rest Make note that I did not add any space before or after Primary[con]

This solution does not require any edit of the name.py code.

I have left my standard display name as the default…Given Surname, Suffix. But for these few people that have taken a hyphenated name, I alter their display name from the default to the one above.

Note: I tested it on having a two-hyphen name. The Rest option continues the name adding the spaces around the second hyphen. I do not have any of these two-hyphen people (I think) so it will not be an issue.

1 Like