Skip to content

Commit

Permalink
v1.9983
Browse files Browse the repository at this point in the history
  • Loading branch information
freyfogle committed Oct 28, 2024
1 parent dd3d307 commit d7938d5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion CHANGES
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
Revision history for Perl module Geo::Address::Formatter.

1.9983
1.9983 2024-10-28
- more tests for abbreviations (one yaml file per language)
- change regex used in abbreviations

1.9982 2023-06-08
- no longer use File::Find::Rule to find config files (still used in tests)
Expand Down
6 changes: 3 additions & 3 deletions lib/Geo/Address/Formatter.pm
Original file line number Diff line number Diff line change
Expand Up @@ -839,21 +839,21 @@ sub _abbreviate {
foreach my $lang (@langs) {
# do we have abbrv for this lang?
if (defined($self->{abbreviations}->{$lang})) {

# we have abbreviations
my $rh_abbr = $self->{abbreviations}->{$lang};

foreach my $comp_name (keys %$rh_abbr) {
next if (!defined($rh_comp->{$comp_name}));
foreach my $long (keys %{$rh_abbr->{$comp_name}}) {
my $short = $rh_abbr->{$comp_name}->{$long};
$rh_comp->{$comp_name} =~ s/\b$long\b/$short/;
$rh_comp->{$comp_name} =~ s/(^|\s)$long\b/$1$short/;
}
}
} else {
#warn "no abbreviations defined for lang $lang";
}
}
}

return $rh_comp;
}

Expand Down

0 comments on commit d7938d5

Please sign in to comment.