fisharebest / webtrees

Online genealogy
https://webtrees.net
GNU General Public License v3.0
487 stars 301 forks source link

Inconsistency in relationship module (2.0.0 beta 3) #2505

Closed norpan closed 5 years ago

norpan commented 5 years ago

Hi, when I do the following (in Swedish) http://familjen.eu/webtrees/index.php?route=module&module=relationships_chart&action=Chart&ged=Olivers&xref=13&xref2=I119&ancestors=0&recursion=0 I get "svärfars mormors mormors farmors far", which is very nice.

But when I do http://familjen.eu/webtrees/index.php?route=module&module=relationships_chart&action=Chart&ged=Olivers&xref=14&xref2=I119&ancestors=0&recursion=0 I just get "gammelfar 4 generationer bak".

I would expect it to say "farmors morfars morfar".

ric2016 commented 5 years ago

This cannot be reproduced viewing the links as a guest user - These individuals (either do not exist anymore or) aren't publicly visible.

fisharebest commented 5 years ago

@norpan - can you create an example GEDCOM file (e.g. using the clippings cart) that illustrates the problem. This will allow me to investigate it on my development server.

fisharebest commented 5 years ago

@norpan - I cannot investigate this if I cannot see it.

Can you provide a public example, or can you send me some data? Thanks!

t-karcher commented 5 years ago

I recreated the example in a public test tree and can confirm that the Swedish translation differs between the direct line and the partner's line:

great-great-grandfather --> gammelfar 2 generationer bak https://familie-dohl.de/index.php?route=module&module=relationships_chart&action=Chart&ged=test&xref=X1&xref2=X10&ancestors=0&recursion=0

partner’s great-great-grandmother --> svärfars morfars mor https://familie-dohl.de/index.php?route=module&module=relationships_chart&action=Chart&ged=test&xref=X1&xref2=X23&ancestors=0&recursion=0

Both are correct, but "svärfars morfars mor" is more precise (indicating whether it's the paternal or maternal line).

fisharebest commented 5 years ago

Some relationships have names. e.g. nephew, cousin, great-great-grandfather, etc.

More complex relationships have no name.

When this happens, webtrees breaks it down into several links.

Obviously, there can be many way's to do this.

https://familie-dohl.de/index.php?route=module&module=relationships_chart&action=Chart&ged=test&xref=X1&xref2=X23&ancestors=0&recursion=0

This could be (in English).

partner - great-great-grandmother
father-in-law - maternal great grandmother

When this happens, webtrees chooses the option with the shortest name (fewest characters).

So, I'm guessing that of all the possible ways to break this relationship into parts with names, the one chosen is the one that has the fewest characters in Swedish.

t-karcher commented 5 years ago

This is true for complex relationships, but not for direct ancestors (yet), which will always return "gammelfar x generationer bak" even if "farmors morfar" would be both shorter and more precise. I didn't think this through yet (let alone test it), but I think the result would be more consistent if the evaluation of direct ancestors would include a special case for the Swedish locale:

if (preg_match('/^((?:mot|fat|par)*)$/', $path, $match)) {
    // direct ancestors
    $up = intdiv(strlen($match[1]), 3);
    switch ($up) {
        case 4:
            switch (WT_LOCALE) {
                case 'sv': // return sth. like "farmors morfar" rather than "gammelfar 2 generationer bak" 
                    $path1 = substr($path, 0, 6);
                    $path2 = substr($path, 6);
                    return I18N::translate(
                        '%1$s’s %2$s',
                        self::getRelationshipNameFromPath($path1),
                        self::getRelationshipNameFromPath($path2)
                    );
                default:
                    if ($sex2 === 'M') {
                        return I18N::translate('great-great-grandfather');
                    }
                    if ($sex2 === 'F') {
                        return I18N::translate('great-great-grandmother');
                    }
            return I18N::translate('great-great-grandparent');
fisharebest commented 5 years ago

which will always return "gammelfar x generationer bak" even if "farmors morfar" would be both shorter and more precise

I think the result would be more consistent if the evaluation of direct ancestors would include a special case for the Swedish locale:

It is already planned to have a module for each language which handles these "calculated" relationship names. e.g.

See #2331

When this is implemented, it should solve this problem.