Changeset View
Changeset View
Standalone View
Standalone View
head/tools/tools/locale/tools/cldr2def.pl
Show First 20 Lines • Show All 410 Lines • ▼ Show 20 Lines | if ($#a == 1) { | ||||
$filter[2] = $a[2]; | $filter[2] = $a[2]; | ||||
} | } | ||||
print Dumper(@filter); | print Dumper(@filter); | ||||
return; | return; | ||||
} | } | ||||
sub transform_ctypes { | sub transform_ctypes { | ||||
# Add the C.UTF-8 | |||||
$languages{"C"}{"x"}{data}{"x"}{$DEFENCODING} = undef; | |||||
foreach my $l (sort keys(%languages)) { | foreach my $l (sort keys(%languages)) { | ||||
foreach my $f (sort keys(%{$languages{$l}})) { | foreach my $f (sort keys(%{$languages{$l}})) { | ||||
foreach my $c (sort keys(%{$languages{$l}{$f}{data}})) { | foreach my $c (sort keys(%{$languages{$l}{$f}{data}})) { | ||||
next if ($#filter == 2 && ($filter[0] ne $l | next if ($#filter == 2 && ($filter[0] ne $l | ||||
|| $filter[1] ne $f || $filter[2] ne $c)); | || $filter[1] ne $f || $filter[2] ne $c)); | ||||
next if (defined $languages{$l}{$f}{definitions} | next if (defined $languages{$l}{$f}{definitions} | ||||
&& $languages{$l}{$f}{definitions} !~ /$TYPE/); | && $languages{$l}{$f}{definitions} !~ /$TYPE/); | ||||
$languages{$l}{$f}{data}{$c}{$DEFENCODING} = 0; # unread | $languages{$l}{$f}{data}{$c}{$DEFENCODING} = 0; # unread | ||||
my $file; | my $file = $l; | ||||
$file = $l . "_"; | $file .= "_" . $f if ($f ne "x"); | ||||
$file .= $f . "_" if ($f ne "x"); | $file .= "_" . $c if ($c ne "x"); | ||||
$file .= $c; | |||||
my $actfile = $file; | my $actfile = $file; | ||||
my $filename = "$CLDRDIR/posix/xx_Comm_US.UTF-8.src"; | my $filename = "$CLDRDIR/posix/xx_Comm_C.UTF-8.src"; | ||||
if (! -f $filename) { | if (! -f $filename) { | ||||
print STDERR "Cannot open $filename\n"; | print STDERR "Cannot open $filename\n"; | ||||
next; | next; | ||||
} | } | ||||
open(FIN, "$filename"); | open(FIN, "$filename"); | ||||
print "Reading from $filename for ${l}_${f}_${c}\n"; | print "Reading from $filename for ${l}_${f}_${c}\n"; | ||||
$languages{$l}{$f}{data}{$c}{$DEFENCODING} = 1; # read | $languages{$l}{$f}{data}{$c}{$DEFENCODING} = 1; # read | ||||
my @lines; | my @lines; | ||||
▲ Show 20 Lines • Show All 492 Lines • ▼ Show 20 Lines | if ($TYPE eq "colldef") { | ||||
$a eq 'ca_x_AD.UTF-8') { return -1; } | $a eq 'ca_x_AD.UTF-8') { return -1; } | ||||
elsif ($b eq 'en_x_US.UTF-8' || | elsif ($b eq 'en_x_US.UTF-8' || | ||||
$b eq 'ru_x_RU.UTF-8' || | $b eq 'ru_x_RU.UTF-8' || | ||||
$b eq 'ca_x_AD.UTF-8') { return 1; } | $b eq 'ca_x_AD.UTF-8') { return 1; } | ||||
else { return uc($b) cmp uc($a); } | else { return uc($b) cmp uc($a); } | ||||
} keys(%{$hashtable{$hash}}); | } keys(%{$hashtable{$hash}}); | ||||
} elsif ($TYPE eq "ctypedef") { | } elsif ($TYPE eq "ctypedef") { | ||||
@files = sort { | @files = sort { | ||||
if ($a eq 'en_x_US.UTF-8') { return -1; } | if ($a eq 'C_x_x.UTF-8') { return -1; } | ||||
elsif ($b eq 'en_x_US.UTF-8') { return 1; } | elsif ($b eq 'C_x_x.UTF-8') { return 1; } | ||||
if ($a =~ /^en_x_US/) { return -1; } | if ($a =~ /^en_x_US/) { return -1; } | ||||
elsif ($b =~ /^en_x_US/) { return 1; } | elsif ($b =~ /^en_x_US/) { return 1; } | ||||
if ($a =~ /^en_x_GB.ISO8859-15/ || | if ($a =~ /^en_x_GB.ISO8859-15/ || | ||||
$a =~ /^ru_x_RU/) { return -1; } | $a =~ /^ru_x_RU/) { return -1; } | ||||
elsif ($b =~ /^en_x_GB.ISO8859-15/ || | elsif ($b =~ /^en_x_GB.ISO8859-15/ || | ||||
$b =~ /ru_x_RU/) { return 1; } | $b =~ /ru_x_RU/) { return 1; } | ||||
else { return uc($b) cmp uc($a); } | else { return uc($b) cmp uc($a); } | ||||
} keys(%{$hashtable{$hash}}); | } keys(%{$hashtable{$hash}}); | ||||
} else { | } else { | ||||
@files = sort { | @files = sort { | ||||
if ($a =~ /_Comm_/ || | if ($a =~ /_Comm_/ || | ||||
$b eq 'en_x_US.UTF-8') { return 1; } | $b eq 'en_x_US.UTF-8') { return 1; } | ||||
elsif ($b =~ /_Comm_/ || | elsif ($b =~ /_Comm_/ || | ||||
$a eq 'en_x_US.UTF-8') { return -1; } | $a eq 'en_x_US.UTF-8') { return -1; } | ||||
else { return uc($b) cmp uc($a); } | else { return uc($b) cmp uc($a); } | ||||
} keys(%{$hashtable{$hash}}); | } keys(%{$hashtable{$hash}}); | ||||
} | } | ||||
if ($#files > 0) { | if ($#files > 0) { | ||||
my $link = shift(@files); | my $link = shift(@files); | ||||
$link =~ s/_x_x//; # special case for C | |||||
$link =~ s/_x_/_/; # strip family if none there | $link =~ s/_x_/_/; # strip family if none there | ||||
foreach my $file (@files) { | foreach my $file (@files) { | ||||
my @a = split(/_/, $file); | my @a = split(/_/, $file); | ||||
my @b = split(/\./, $a[-1]); | my @b = split(/\./, $a[-1]); | ||||
$file =~ s/_x_/_/; | $file =~ s/_x_/_/; | ||||
print FOUT "SAME+=\t\t$link $file\n"; | print FOUT "SAME+=\t\t$link $file\n"; | ||||
undef($languages{$a[0]}{$a[1]}{data}{$b[0]}{$b[1]}); | undef($languages{$a[0]}{$a[1]}{data}{$b[0]}{$b[1]}); | ||||
} | } | ||||
Show All 9 Lines | next if (defined $languages{$l}{$f}{definitions} | ||||
&& $languages{$l}{$f}{definitions} !~ /$TYPE/); | && $languages{$l}{$f}{definitions} !~ /$TYPE/); | ||||
if (defined $languages{$l}{$f}{data}{$c}{$DEFENCODING} | if (defined $languages{$l}{$f}{data}{$c}{$DEFENCODING} | ||||
&& $languages{$l}{$f}{data}{$c}{$DEFENCODING} eq "0") { | && $languages{$l}{$f}{data}{$c}{$DEFENCODING} eq "0") { | ||||
print "Skipping ${l}_" . ($f eq "x" ? "" : "${f}_") . | print "Skipping ${l}_" . ($f eq "x" ? "" : "${f}_") . | ||||
"${c} - not read\n"; | "${c} - not read\n"; | ||||
next; | next; | ||||
} | } | ||||
foreach my $e (sort keys(%{$languages{$l}{$f}{data}{$c}})) { | foreach my $e (sort keys(%{$languages{$l}{$f}{data}{$c}})) { | ||||
my $file = $l . "_"; | my $file = $l; | ||||
$file .= $f . "_" if ($f ne "x"); | $file .= "_" . $f if ($f ne "x"); | ||||
$file .= $c; | $file .= "_" . $c if ($c ne "x"); | ||||
next if (!defined $languages{$l}{$f}{data}{$c}{$e}); | next if (!defined $languages{$l}{$f}{data}{$c}{$e}); | ||||
print FOUT "LOCALES+=\t$file.$e\n"; | print FOUT "LOCALES+=\t$file.$e\n"; | ||||
} | } | ||||
if (defined $languages{$l}{$f}{nc_link}) { | if (defined $languages{$l}{$f}{nc_link}) { | ||||
foreach my $e (sort keys(%{$languages{$l}{$f}{data}{$c}})) { | foreach my $e (sort keys(%{$languages{$l}{$f}{data}{$c}})) { | ||||
my $file = $l . "_"; | my $file = $l . "_"; | ||||
$file .= $f . "_" if ($f ne "x"); | $file .= $f . "_" if ($f ne "x"); | ||||
Show All 38 Lines |