summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorbapt <bapt@FreeBSD.org>2016-06-20 06:45:42 +0000
committerbapt <bapt@FreeBSD.org>2016-06-20 06:45:42 +0000
commit6d8d86e4625a04be931b3fa4102f3c40e2539e47 (patch)
tree174e642f4529ffec6d4f7019db978bb65fbc3106 /tools
parentc6f6894768f297ac39bb24bdaf19167ba7def897 (diff)
downloadFreeBSD-src-6d8d86e4625a04be931b3fa4102f3c40e2539e47.zip
FreeBSD-src-6d8d86e4625a04be931b3fa4102f3c40e2539e47.tar.gz
Fix generation of locales with multiple variants
Serbian locales have triple components to represent the 2 variations of the locale: Latin and Cyrillic. Previously the tools generatic the locale were appending both definitions instead of differentiating them. Reported by: ache Approved by: re (gjb)
Diffstat (limited to 'tools')
-rwxr-xr-xtools/tools/locale/tools/cldr2def.pl37
1 files changed, 19 insertions, 18 deletions
diff --git a/tools/tools/locale/tools/cldr2def.pl b/tools/tools/locale/tools/cldr2def.pl
index 11a1092..b48220e 100755
--- a/tools/tools/locale/tools/cldr2def.pl
+++ b/tools/tools/locale/tools/cldr2def.pl
@@ -595,8 +595,8 @@ sub get_fields {
$line =~ s/^$k\s+//;
}
- $values{$l}{$c}{$k} = ""
- if (!defined $values{$l}{$c}{$k});
+ $values{$l}{$f}{$c}{$k} = ""
+ if (!defined $values{$l}{$f}{$c}{$k});
$continue = ($line =~ /\/$/);
$line =~ s/\/$// if ($continue);
@@ -606,7 +606,7 @@ sub get_fields {
s/\<([^>_]+)_([^>]+)\>/<$1 $2>/;
}
die "_ in data - $line" if ($line =~ /_/);
- $values{$l}{$c}{$k} .= $line;
+ $values{$l}{$f}{$c}{$k} .= $line;
last if (!$continue);
}
@@ -723,7 +723,7 @@ sub print_fields {
# -----------------------------------------------------------------------------
EOF
foreach my $k (keys(%keys)) {
- my $f = $keys{$k};
+ my $g = $keys{$k};
die("Unknown $k in \%DESC")
if (!defined $DESC{$k});
@@ -731,37 +731,38 @@ EOF
$output .= "#\n# $DESC{$k}\n";
# Replace one row with another
- if ($f =~ /^>/) {
- $k = substr($f, 1);
- $f = $keys{$k};
+ if ($g =~ /^>/) {
+ $k = substr($g, 1);
+ $g = $keys{$k};
}
# Callback function
- if ($f =~ /^\</) {
+ if ($g =~ /^\</) {
$callback{data}{c} = $c;
$callback{data}{k} = $k;
+ $callback{data}{f} = $f;
$callback{data}{l} = $l;
$callback{data}{e} = $enc;
- my @a = split(/\</, substr($f, 1));
+ my @a = split(/\</, substr($g, 1));
my $rv =
- &{$callback{$a[0]}}($values{$l}{$c}{$a[1]});
- $values{$l}{$c}{$k} = $rv;
- $f = $a[2];
+ &{$callback{$a[0]}}($values{$l}{$f}{$c}{$a[1]});
+ $values{$l}{$f}{$c}{$k} = $rv;
+ $g = $a[2];
$callback{data} = ();
}
- my $v = $values{$l}{$c}{$k};
+ my $v = $values{$l}{$f}{$c}{$k};
$v = "undef" if (!defined $v);
- if ($f eq "i") {
+ if ($g eq "i") {
$output .= "$v\n";
next;
}
- if ($f eq "ai") {
+ if ($g eq "ai") {
$output .= "$v\n";
next;
}
- if ($f eq "s") {
+ if ($g eq "s") {
$v =~ s/^"//;
$v =~ s/"$//;
my $cm = "";
@@ -785,7 +786,7 @@ EOF
$output .= "$v\n";
next;
}
- if ($f eq "as") {
+ if ($g eq "as") {
foreach my $v (split(/;/, $v)) {
$v =~ s/^"//;
$v =~ s/"$//;
@@ -815,7 +816,7 @@ EOF
next;
}
- die("$k is '$f'");
+ die("$k is '$g'");
}
OpenPOWER on IntegriCloud