Use U+202F NARROW NO-BREAK SPACE as thousands separators in pl_PL locale [BZ #16777]
[glibc.git] / localedata / gen-locale.sh
blobb4ec68c36efa0b02c4704a9ccb105bff45da130e
1 #!/bin/sh
2 # Generate test locale files.
3 # Copyright (C) 2000-2017 Free Software Foundation, Inc.
4 # This file is part of the GNU C Library.
6 # The GNU C Library is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU Lesser General Public
8 # License as published by the Free Software Foundation; either
9 # version 2.1 of the License, or (at your option) any later version.
11 # The GNU C Library is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 # Lesser General Public License for more details.
16 # You should have received a copy of the GNU Lesser General Public
17 # License along with the GNU C Library; if not, see
18 # <http://www.gnu.org/licenses/>.
20 set -e
22 common_objpfx="$1"; shift
23 localedef_before_env="$1"; shift
24 run_program_env="$1"; shift
25 localedef_after_env="$1"; shift
26 locfile="$1"; shift
28 generate_locale ()
30 charmap=$1
31 input=$2
32 out=$3
33 ret=0
34 ${localedef_before_env} ${run_program_env} I18NPATH=../localedata \
35 ${localedef_after_env} --quiet -c -f $charmap -i $input \
36 ${common_objpfx}localedata/$out || ret=$?
37 # All locales compile fine, except those with SHIFT_JIS charmap
38 # and those fail with exit code 1 because SHIFT_JIS issues a
39 # warning (it is not ASCII compatible).
40 if [ $ret -eq 0 ] \
41 || ( [ $ret -eq 1 ] \
42 && [ "$charmap" = "SHIFT_JIS" ] ); then
43 # The makefile checks the timestamp of the LC_CTYPE file,
44 # but localedef won't have touched it if it was able to
45 # hard-link it to an existing file.
46 touch ${common_objpfx}localedata/$out/LC_CTYPE
47 else
48 echo "Charmap: \"${charmap}\" Inputfile: \"${input}\"" \
49 "Outputdir: \"${out}\" failed"
50 exit 1
54 locfile=`echo $locfile|sed 's|.*/\([^/]*/LC_CTYPE\)|\1|'`
55 locale=`echo $locfile|sed 's|\([^.]*\)[.].*/LC_CTYPE|\1|'`
56 charmap=`echo $locfile|sed 's|[^.]*[.]\(.*\)/LC_CTYPE|\1|'`
58 echo "Generating locale $locale.$charmap: this might take a while..."
60 # For SJIS the charmap is SHIFT_JIS. We just want the locale to have
61 # a slightly nicer name instead of using "*.SHIFT_SJIS", but that
62 # means we need a mapping here.
63 charmap_real="$charmap"
64 if [ "$charmap" = "SJIS" ]; then
65 charmap_real="SHIFT_JIS"
68 generate_locale $charmap_real $locale $locale.$charmap