wok view slitaz-i18n/stuff/locale-pack.functions @ rev 14908
slitaz-i18n: rewrite locale-pack.functions; slitaz-configs: now generate openbox desktop menu using po files; locale-*: update using new locale-pack.functions (FIXME: post_remove)
author | Aleksej Bobylev <al.bobylev@gmail.com> |
---|---|
date | Sat Aug 03 17:37:48 2013 +0300 (2013-08-03) |
parents | 919b102812ab |
children | 1c56350ea155 |
line source
1 get_locale()
2 {
3 [ "x$CHARMAP" == x ] && CHARMAP=UTF-8
5 # Get translated Openbox menu from SliTaz sub project slitaz-configs
6 obmenu=$WOK/slitaz-configs/install/etc/xdg/openbox/menu.$LOCALE.xml
7 if [ -f $obmenu ]; then
8 mkdir -p $fs/etc/xdg/openbox
9 echo "* Found $LOCALE translations for: openbox menu"
10 cp $obmenu $fs/etc/xdg/openbox
11 fi
13 # Get the core packages messages.
14 mkdir -p $fs/usr/share/locale/$LOCALE
15 for app in $CORE_PKGS; do
16 app_locale=$WOK/$app/install/usr/share/locale/$LOCALE
17 if [ -d $app_locale ]; then
18 echo "* Found $LOCALE translations for: $app"
19 cp -a $app_locale $fs/usr/share/locale
20 fi
21 done
23 # List of available locales
24 cd $WOK/glibc/install/usr/share/i18n/locales
25 locales=$(ls -1 | sed -n '/^'$LOCALE'$/p; /^'$LOCALE'_.*/p' | sed '/translit/d')
26 [ "x$LOCALEDEF" != x ] && locales=$LOCALEDEF
28 # Get X11 locale
29 for def in $locales; do
30 x11_locale=$WOK/xorg-libX11/install/usr/share/X11/locale/$def.$CHARMAP
31 if [ -d $x11_locale ]; then
32 echo "* Found $def.$CHARMAP locale for: X11"
33 mkdir -p $fs/usr/share/X11/locale
34 cp -a $x11_locale $fs/usr/share/X11/locale
35 fi
36 done
38 # Pregenerate locale file so we dont need glibc-locale as dep.
39 for def in $locales; do
40 echo "* Generate $def locale definition"
41 mkdir -p $fs/usr/lib/locale
42 localedef -i $def -c -f $CHARMAP $fs/usr/lib/locale/$def
43 done
45 # Get timezones
46 countries=$(echo $locales | \
47 sed 's|@[^ ]*||g; s|[^ _]*_||g' | tr ' ' '\n' | sort -u)
48 echo "* Copy timezone info for countries: "$countries
49 locations=''
50 for country in $countries; do
51 location=$(grep '^'$country \
52 $WOK/glibc/install/usr/share/zoneinfo/zone.tab | awk '{ print $3}')
53 locations="$locations $location"
54 done
55 for location in $locations; do
56 for tz in $location posix/$location right/$location; do
57 install -Dm644 /usr/share/zoneinfo/$tz \
58 $fs/usr/share/zoneinfo/$tz
59 done
60 done
61 }