wok view slitaz-i18n/stuff/locale-pack.functions @ rev 20599

nss: remove USE_64
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sun Dec 16 20:01:00 2018 +0100 (2018-12-16)
parents 98906245f829
children
line source
1 get_locale()
2 {
3 [ -z "$CHARMAP" ] && CHARMAP='UTF-8'
5 case "$SLITAZ_ARCH" in
6 arm*) ;;
7 i?86)
8 # Get translated Openbox menu from SliTaz sub project slitaz-configs
9 obmenu="$WOK/slitaz-configs/install/etc/xdg/openbox/menu.$LOCALE.xml"
10 if [ -f "$obmenu" ]; then
11 mkdir -p $fs/etc/xdg/openbox
12 echo "* Found $LOCALE translations for: openbox menu"
13 cp $obmenu $fs/etc/xdg/openbox
14 fi
15 ;;
16 esac
18 # Get the core packages messages.
19 case "$SLITAZ_ARCH" in
20 arm*) CORE_PKGS="$CORE_PKGS_ARM" ;;
21 esac
22 mkdir -p $fs/usr/share/locale/$LOCALE
23 for app in $CORE_PKGS; do
24 app_locale="$WOK/$app/install/usr/share/locale/$LOCALE"
25 if [ -d "$app_locale" ]; then
26 echo "* Found $LOCALE translations for: $app"
27 cp -a $app_locale $fs/usr/share/locale
28 fi
29 done
31 # List of available locales
32 cd $WOK/glibc/install/usr/share/i18n/locales
33 locales=$(ls -1 | sed -n '/^'$LOCALE'$/p; /^'$LOCALE'_.*/p' | sed '/translit/d')
34 [ -n "$LOCALEDEF" ] && locales="$LOCALEDEF"
36 # Get X11 locale
37 for def in $locales; do
38 x11_locale="$WOK/xorg-libX11/install/usr/share/X11/locale/$def.$CHARMAP"
39 case "$def.$CHARMAP" in
40 en_US.UTF-8)
41 # belongs to "xorg-libX11" package, skip it
42 ;;
43 *)
44 if [ -d "$x11_locale" ]; then
45 echo "* Found $def.$CHARMAP locale for: X11"
46 mkdir -p $fs/usr/share/X11/locale
47 cp -a $x11_locale $fs/usr/share/X11/locale
48 fi
49 ;;
50 esac
51 done
53 # Get locale definition files
54 usil='usr/share/i18n/locales'
55 for def in $locales; do
56 case $def in
57 en_US|en_GB)
58 # already in glibc-base
59 ;;
60 *)
61 echo "* Copying $def locale files"
62 mkdir -p $fs/$usil
63 cp -a $WOK/glibc/install/$usil/$def $fs/$usil
64 ;;
65 esac
66 done
68 if [ -n "$LOCALE_DEPENDS" ]; then
69 for dep in $LOCALE_DEPENDS; do
70 echo "* Copying additional $dep locale files"
71 cp -a $WOK/glibc/install/usr/share/i18n/locales/$dep \
72 $fs/usr/share/i18n/locales
73 done
74 fi
76 #grep -r 'include' $fs/usr/share/i18n/locales # test includes in locales
78 # Get timezones from tzdata
79 countries=$(echo $locales | \
80 sed 's|@[^ ]*||g; s|[^ _]*_||g' | tr ' ' '\n' | sort -u)
81 echo "* Copy timezone info for countries: "$countries
82 locations=''
83 for country in $countries; do
84 location=$(grep '^'$country \
85 $WOK/tzdata/install/usr/share/zoneinfo/zone.tab | awk '{ print $3}')
86 locations="$locations $location"
87 done
88 for location in $locations; do
89 for tz in $location; do
90 install -Dm644 $WOK/tzdata/install/usr/share/zoneinfo/$tz \
91 $fs/usr/share/zoneinfo/$tz
92 done
93 done
95 case "$SLITAZ_ARCH" in
96 arm*) exit 0 ;;
97 esac
99 # Get country flags
100 echo "* Copy flag icons for countries: "$countries
101 usih='usr/share/icons/hicolor'
102 for country in $countries; do
103 for size in 16x16 48x48; do
104 install -Dm644 \
105 $WOK/flag-icons/taz/*/fs/$usih/$size/intl/$country.png \
106 $fs/$usih/$size/intl/$country.png
107 done
108 done
109 # above icons credits
110 fusl="$fs/usr/share/licenses"
111 mkdir -p $fusl
112 cp -a $WOK/flag-icons/source/*/LICENSE.txt $fusl/gosquared.txt
114 # Gconv modules for encodings other than default
115 if [ -n "$GCONV" ]; then
116 mkdir -p $fs/usr/lib/gconv
117 for enc in $GCONV; do
118 case $enc in
119 ISO8859-1|ISO8859-15)
120 # already in glibc-base
121 ;;
122 *)
123 echo "* Copying $enc gconv module"
124 cp -a $WOK/glibc/install/usr/lib/gconv/$enc.so $fs/usr/lib/gconv
125 ;;
126 esac
127 done
128 #ldd $fs/usr/lib/gconv/* # test depends in gconv modules
129 fi
131 # Console keyboard layouts
132 if [ -n "$KBD" ]; then
133 uskki='usr/share/kbd/keymaps/i386'
134 cd $WOK/kbd/install
135 for map in $KBD; do
136 echo "* Copying $map kbd map"
137 mapfiles=$(find . -type f -name $map.map.gz)
138 for mapfile in $mapfiles; do
139 mkdir -p "$fs/$(dirname "${mapfile#./}")"
140 cp "$WOK/kbd/install/${mapfile#./}" "$fs/${mapfile#./}"
141 done
142 done
143 fi
145 # Keyboard flags for default lxpanel keyboard applet
146 if [ -n "$KB_FLAGS" ]; then
147 uslix='usr/share/lxpanel/images/xkb-flags'
148 mkdir -p $fs/$uslix
149 for i in $KB_FLAGS; do
150 install -Dm644 \
151 $WOK/flag-icons/taz/*/fs/$usih/16x16/intl/${i%%:*}.png \
152 $fs/$usih/16x16/intl/${i%%:*}.png
153 ln -s ../../../icons/hicolor/16x16/intl/${i%%:*}.png $fs/$uslix/${i##*:}.png
154 done
155 fi
157 # exit code OK
158 echo
159 }