Skip to content

Commit

Permalink
Improved living all in same county code
Browse files Browse the repository at this point in the history
  • Loading branch information
nigelhorne committed Oct 7, 2024
1 parent c925ba9 commit 58cdbce
Showing 1 changed file with 25 additions and 8 deletions.
33 changes: 25 additions & 8 deletions gedcom
Original file line number Diff line number Diff line change
Expand Up @@ -5915,6 +5915,7 @@ sub print_person
}
}
foreach my $event(@events) {
next unless ref($event);
if(my $type = $event->type()) {
if(($type eq 'Military service') || ($type eq 'Military')) {
$all_in_one_county = 0; # Possibly served abroad
Expand Down Expand Up @@ -5958,8 +5959,8 @@ sub print_person
}
$bio->append("$firstname spent all of " .
(($person->pronoun() eq 'She') ? 'her' : 'his') .
" life in $all_in_county " .
(($ENV{'LANG'} && ($ENV{'LANG'} =~ /^en_US/)) ? ',' : 'in') .
" life in $all_in_county" .
(($ENV{'LANG'} && ($ENV{'LANG'} =~ /^en_US/)) ? ',' : ' in') .
" $all_in_country. ");
} else {
undef $all_in_country;
Expand Down Expand Up @@ -5989,25 +5990,41 @@ sub print_person
$residencestringarray[$i+1] = undef;
}
}
while(!defined($residencestringarray[scalar(@residencestringarray) - 1])) {
pop @residencestringarray;
}
# while(!defined($residencestringarray[scalar(@residencestringarray) - 1])) {
# pop @residencestringarray;
# }
# while(!defined($residencestringarray[0])) {
# shift @residencestringarray;
# }
@residencestringarray = grep { defined } @residencestringarray;
# $phrase->append(', ' . lcfirst($pronoun) . i18n(' was living ') .
# Lingua::EN::Inflect::WORDLIST(@residencestringarray, {sep => '; ', conj => i18n('and')});
my $s = ', ';
if(scalar(@residencelist) < 3) {
if(scalar(@residencestringarray) < 3) {
$s .= lcfirst($pronoun);
if(is_alive($person) && !$first->date()) {
$s .= i18n(' has lived');
} else {
$s .= ' lived';
}
} else {
$s .= "$firstname ";
if($all_in_county) {
$s .= lcfirst($pronoun) . ' ';
} else {
$s .= "$firstname ";
}
if(is_alive($person) && !$first->date()) {
$s .= 'has ';
}
$s .= 'lived in several places:';
$s .= 'lived in several places';
if($all_in_county) {
$s .= ' around the county';
@residencestringarray = map { if($_ =~ /(.+),\s*$all_in_county ([io]n .+)/) { "$1 $2" } else { $_ } } @residencestringarray;
} elsif($all_in_country) {
$s .= " around $all_in_country";
@residencestringarray = map { if($_ =~ /(.+),\s*$all_in_country ([io]n .+)/) { "$1 $2" } else { $_ } } @residencestringarray;
}
$s .= ':';
}

print Data::Dumper->new([\@residencestringarray])->Dump() if($opts{'v'});
Expand Down

0 comments on commit 58cdbce

Please sign in to comment.