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

locale-pack.functions: make valid relative symlink for icon for lxpanel keyboard applet
author Aleksej Bobylev <al.bobylev@gmail.com>
date Tue Jan 10 16:22:01 2017 +0200 (2017-01-10)
parents 98906245f829
children
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@18986 56 case $def in
al@18921 57 en_US|en_GB)
al@18921 58 # already in glibc-base
al@18921 59 ;;
al@18921 60 *)
al@18921 61 echo "* Copying $def locale files"
al@18921 62 mkdir -p $fs/$usil
al@18921 63 cp -a $WOK/glibc/install/$usil/$def $fs/$usil
al@18921 64 ;;
al@18921 65 esac
al@16433 66 done
al@16433 67
al@18168 68 if [ -n "$LOCALE_DEPENDS" ]; then
al@16591 69 for dep in $LOCALE_DEPENDS; do
al@16591 70 echo "* Copying additional $dep locale files"
al@16591 71 cp -a $WOK/glibc/install/usr/share/i18n/locales/$dep \
al@16591 72 $fs/usr/share/i18n/locales
al@16591 73 done
al@16591 74 fi
al@16591 75
al@18168 76 #grep -r 'include' $fs/usr/share/i18n/locales # test includes in locales
al@18168 77
al@16551 78 # Get timezones from tzdata
al@14908 79 countries=$(echo $locales | \
al@14908 80 sed 's|@[^ ]*||g; s|[^ _]*_||g' | tr ' ' '\n' | sort -u)
al@14908 81 echo "* Copy timezone info for countries: "$countries
al@14908 82 locations=''
al@14908 83 for country in $countries; do
al@14908 84 location=$(grep '^'$country \
al@16551 85 $WOK/tzdata/install/usr/share/zoneinfo/zone.tab | awk '{ print $3}')
al@14908 86 locations="$locations $location"
al@14908 87 done
al@14908 88 for location in $locations; do
al@16551 89 for tz in $location; do
al@16551 90 install -Dm644 $WOK/tzdata/install/usr/share/zoneinfo/$tz \
al@14908 91 $fs/usr/share/zoneinfo/$tz
al@14908 92 done
al@14908 93 done
al@16551 94
al@17402 95 case "$SLITAZ_ARCH" in
al@17402 96 arm*) exit 0 ;;
al@17402 97 esac
al@17402 98
al@16551 99 # Get country flags
al@16591 100 echo "* Copy flag icons for countries: "$countries
al@18168 101 usih='usr/share/icons/hicolor'
al@16591 102 for country in $countries; do
al@16551 103 for size in 16x16 48x48; do
al@16551 104 install -Dm644 \
al@16552 105 $WOK/flag-icons/taz/*/fs/$usih/$size/intl/$country.png \
al@16552 106 $fs/$usih/$size/intl/$country.png
al@16551 107 done
al@16551 108 done
al@16551 109 # above icons credits
al@18168 110 fusl="$fs/usr/share/licenses"
al@16551 111 mkdir -p $fusl
al@16551 112 cp -a $WOK/flag-icons/source/*/LICENSE.txt $fusl/gosquared.txt
al@16551 113
al@16591 114 # Gconv modules for encodings other than default
al@18168 115 if [ -n "$GCONV" ]; then
al@16591 116 mkdir -p $fs/usr/lib/gconv
al@16591 117 for enc in $GCONV; do
al@18986 118 case $enc in
al@18921 119 ISO8859-1|ISO8859-15)
al@18921 120 # already in glibc-base
al@18921 121 ;;
al@18921 122 *)
al@18921 123 echo "* Copying $enc gconv module"
al@18921 124 cp -a $WOK/glibc/install/usr/lib/gconv/$enc.so $fs/usr/lib/gconv
al@18921 125 ;;
al@18921 126 esac
al@16551 127 done
al@18168 128 #ldd $fs/usr/lib/gconv/* # test depends in gconv modules
al@18168 129 fi
al@18168 130
al@18168 131 # Console keyboard layouts
al@18168 132 if [ -n "$KBD" ]; then
al@18168 133 uskki='usr/share/kbd/keymaps/i386'
al@18168 134 cd $WOK/kbd/install
al@18168 135 for map in $KBD; do
al@18168 136 echo "* Copying $map kbd map"
al@18168 137 mapfiles=$(find . -type f -name $map.map.gz)
al@18168 138 for mapfile in $mapfiles; do
al@18168 139 mkdir -p "$fs/$(dirname "${mapfile#./}")"
al@18168 140 cp "$WOK/kbd/install/${mapfile#./}" "$fs/${mapfile#./}"
al@18168 141 done
al@18168 142 done
al@16551 143 fi
al@16551 144
al@16591 145 # Keyboard flags for default lxpanel keyboard applet
al@18168 146 if [ -n "$KB_FLAGS" ]; then
al@18168 147 uslix='usr/share/lxpanel/images/xkb-flags'
al@16591 148 mkdir -p $fs/$uslix
al@16591 149 for i in $KB_FLAGS; do
al@16591 150 install -Dm644 \
al@16591 151 $WOK/flag-icons/taz/*/fs/$usih/16x16/intl/${i%%:*}.png \
al@16591 152 $fs/$usih/16x16/intl/${i%%:*}.png
al@19619 153 ln -s ../../../icons/hicolor/16x16/intl/${i%%:*}.png $fs/$uslix/${i##*:}.png
al@16591 154 done
al@16591 155 fi
al@16591 156
al@16591 157 # exit code OK
al@16551 158 echo
pankso@3087 159 }