wok view slitaz-i18n/stuff/locale-pack.functions @ rev 18310
Add ponyprog
author | Xander Ziiryanoff <psychomaniak@xakep.ru> |
---|---|
date | Tue Aug 25 19:37:30 2015 +0200 (2015-08-25) |
parents | cea5a9fa7152 |
children | 0b07c031c9db |
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 echo "* Copying $def locale files"
57 mkdir -p $fs/$usil
58 cp -a $WOK/glibc/install/$usil/$def $fs/$usil
59 done
61 if [ -n "$LOCALE_DEPENDS" ]; then
62 for dep in $LOCALE_DEPENDS; do
63 echo "* Copying additional $dep locale files"
64 cp -a $WOK/glibc/install/usr/share/i18n/locales/$dep \
65 $fs/usr/share/i18n/locales
66 done
67 fi
69 #grep -r 'include' $fs/usr/share/i18n/locales # test includes in locales
71 # Get timezones from tzdata
72 countries=$(echo $locales | \
73 sed 's|@[^ ]*||g; s|[^ _]*_||g' | tr ' ' '\n' | sort -u)
74 echo "* Copy timezone info for countries: "$countries
75 locations=''
76 for country in $countries; do
77 location=$(grep '^'$country \
78 $WOK/tzdata/install/usr/share/zoneinfo/zone.tab | awk '{ print $3}')
79 locations="$locations $location"
80 done
81 for location in $locations; do
82 for tz in $location; do
83 install -Dm644 $WOK/tzdata/install/usr/share/zoneinfo/$tz \
84 $fs/usr/share/zoneinfo/$tz
85 done
86 done
88 case "$SLITAZ_ARCH" in
89 arm*) exit 0 ;;
90 esac
92 # Get country flags
93 echo "* Copy flag icons for countries: "$countries
94 usih='usr/share/icons/hicolor'
95 for country in $countries; do
96 for size in 16x16 48x48; do
97 install -Dm644 \
98 $WOK/flag-icons/taz/*/fs/$usih/$size/intl/$country.png \
99 $fs/$usih/$size/intl/$country.png
100 done
101 done
102 # above icons credits
103 fusl="$fs/usr/share/licenses"
104 mkdir -p $fusl
105 cp -a $WOK/flag-icons/source/*/LICENSE.txt $fusl/gosquared.txt
107 # Gconv modules for encodings other than default
108 if [ -n "$GCONV" ]; then
109 mkdir -p $fs/usr/lib/gconv
110 for enc in $GCONV; do
111 echo "* Copying $enc gconv module"
112 cp -a $WOK/glibc/install/usr/lib/gconv/$enc.so $fs/usr/lib/gconv
113 done
114 #ldd $fs/usr/lib/gconv/* # test depends in gconv modules
115 fi
117 # Console keyboard layouts
118 if [ -n "$KBD" ]; then
119 uskki='usr/share/kbd/keymaps/i386'
120 cd $WOK/kbd/install
121 for map in $KBD; do
122 echo "* Copying $map kbd map"
123 mapfiles=$(find . -type f -name $map.map.gz)
124 for mapfile in $mapfiles; do
125 mkdir -p "$fs/$(dirname "${mapfile#./}")"
126 cp "$WOK/kbd/install/${mapfile#./}" "$fs/${mapfile#./}"
127 done
128 done
129 fi
131 # Keyboard flags for default lxpanel keyboard applet
132 if [ -n "$KB_FLAGS" ]; then
133 uslix='usr/share/lxpanel/images/xkb-flags'
134 mkdir -p $fs/$uslix
135 for i in $KB_FLAGS; do
136 install -Dm644 \
137 $WOK/flag-icons/taz/*/fs/$usih/16x16/intl/${i%%:*}.png \
138 $fs/$usih/16x16/intl/${i%%:*}.png
139 ln -s /$usih/16x16/intl/${i%%:*}.png $fs/$uslix/${i##*:}.png
140 done
141 fi
143 # exit code OK
144 echo
145 }