wok annotate slitaz-i18n/stuff/locale-pack.functions @ rev 18168

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