diff options
author | Yuri Pankov <yuripv@FreeBSD.org> | 2018-11-04 22:13:22 +0000 |
---|---|---|
committer | Yuri Pankov <yuripv@FreeBSD.org> | 2018-11-04 22:13:22 +0000 |
commit | dd7c41a378442920283db34d7804a77641252fbf (patch) | |
tree | c833deba8823fb24ea4774f4cd41aeefeefb98aa /tools | |
parent | d68e2c047b8d17f5342e8787e3c41964f4111e2c (diff) | |
download | src-dd7c41a378442920283db34d7804a77641252fbf.tar.gz src-dd7c41a378442920283db34d7804a77641252fbf.zip |
Add hybrid C.UTF-8 locale being identical to default C locale except
that it uses the same ctype maps and functions as other UTF-8 locales.
Reviewed by: bapt, cem, eadler
Approved by: kib (mentor, implicit)
Differential Revision: https://reviews.freebsd.org/D17833
Notes
Notes:
svn path=/head/; revision=340144
Diffstat (limited to 'tools')
-rw-r--r-- | tools/tools/locale/Makefile | 4 | ||||
-rwxr-xr-x | tools/tools/locale/tools/cldr2def.pl | 23 |
2 files changed, 15 insertions, 12 deletions
diff --git a/tools/tools/locale/Makefile b/tools/tools/locale/Makefile index 9e8483dc445c..79b447492336 100644 --- a/tools/tools/locale/Makefile +++ b/tools/tools/locale/Makefile @@ -54,7 +54,7 @@ LC:= --lc=${LC} .endif all: - cp ${ETCDIR}/common.UTF-8.src ${CLDRDIR}/posix/xx_Comm_US.UTF-8.src + cp ${ETCDIR}/common.UTF-8.src ${CLDRDIR}/posix/xx_Comm_C.UTF-8.src .for t in ${TYPES} . if ${KNOWN:M${t}} test -d ${t} || mkdir ${t} @@ -105,7 +105,7 @@ static-colldef: .endfor transfer-rollup: - cp ${ETCDIR}/common.UTF-8.src ${CLDRDIR}/posix/xx_Comm_US.UTF-8.src + cp ${ETCDIR}/common.UTF-8.src ${CLDRDIR}/posix/xx_Comm_C.UTF-8.src rollup: perl -I tools tools/utf8-rollup.pl \ diff --git a/tools/tools/locale/tools/cldr2def.pl b/tools/tools/locale/tools/cldr2def.pl index a34c5477670b..b52899fa4f3c 100755 --- a/tools/tools/locale/tools/cldr2def.pl +++ b/tools/tools/locale/tools/cldr2def.pl @@ -416,6 +416,9 @@ sub get_languages { } sub transform_ctypes { + # Add the C.UTF-8 + $languages{"C"}{"x"}{data}{"x"}{$DEFENCODING} = undef; + foreach my $l (sort keys(%languages)) { foreach my $f (sort keys(%{$languages{$l}})) { foreach my $c (sort keys(%{$languages{$l}{$f}{data}})) { @@ -424,13 +427,12 @@ sub transform_ctypes { next if (defined $languages{$l}{$f}{definitions} && $languages{$l}{$f}{definitions} !~ /$TYPE/); $languages{$l}{$f}{data}{$c}{$DEFENCODING} = 0; # unread - my $file; - $file = $l . "_"; - $file .= $f . "_" if ($f ne "x"); - $file .= $c; + my $file = $l; + $file .= "_" . $f if ($f ne "x"); + $file .= "_" . $c if ($c ne "x"); 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) { print STDERR "Cannot open $filename\n"; next; @@ -939,8 +941,8 @@ EOF } keys(%{$hashtable{$hash}}); } elsif ($TYPE eq "ctypedef") { @files = sort { - if ($a eq 'en_x_US.UTF-8') { return -1; } - elsif ($b eq 'en_x_US.UTF-8') { return 1; } + if ($a eq 'C_x_x.UTF-8') { return -1; } + elsif ($b eq 'C_x_x.UTF-8') { return 1; } if ($a =~ /^en_x_US/) { return -1; } elsif ($b =~ /^en_x_US/) { return 1; } @@ -962,6 +964,7 @@ EOF } if ($#files > 0) { my $link = shift(@files); + $link =~ s/_x_x//; # special case for C $link =~ s/_x_/_/; # strip family if none there foreach my $file (@files) { my @a = split(/_/, $file); @@ -987,9 +990,9 @@ EOF next; } foreach my $e (sort keys(%{$languages{$l}{$f}{data}{$c}})) { - my $file = $l . "_"; - $file .= $f . "_" if ($f ne "x"); - $file .= $c; + my $file = $l; + $file .= "_" . $f if ($f ne "x"); + $file .= "_" . $c if ($c ne "x"); next if (!defined $languages{$l}{$f}{data}{$c}{$e}); print FOUT "LOCALES+=\t$file.$e\n"; } |