wok-current annotate 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 |
rev | line source |
---|---|
al@14908 | 1 get_locale() |
al@14908 | 2 { |
al@14908 | 3 [ "x$CHARMAP" == x ] && CHARMAP=UTF-8 |
pankso@3087 | 4 |
al@14908 | 5 # Get translated Openbox menu from SliTaz sub project slitaz-configs |
al@14908 | 6 obmenu=$WOK/slitaz-configs/install/etc/xdg/openbox/menu.$LOCALE.xml |
al@14908 | 7 if [ -f $obmenu ]; then |
al@14908 | 8 mkdir -p $fs/etc/xdg/openbox |
al@14908 | 9 echo "* Found $LOCALE translations for: openbox menu" |
al@14908 | 10 cp $obmenu $fs/etc/xdg/openbox |
gokhlayeh@11389 | 11 fi |
gokhlayeh@11389 | 12 |
al@14908 | 13 # Get the core packages messages. |
al@14908 | 14 mkdir -p $fs/usr/share/locale/$LOCALE |
al@14908 | 15 for app in $CORE_PKGS; do |
al@14908 | 16 app_locale=$WOK/$app/install/usr/share/locale/$LOCALE |
al@14908 | 17 if [ -d $app_locale ]; then |
al@14908 | 18 echo "* Found $LOCALE translations for: $app" |
al@14908 | 19 cp -a $app_locale $fs/usr/share/locale |
pankso@3087 | 20 fi |
pankso@3087 | 21 done |
al@14908 | 22 |
al@14908 | 23 # List of available locales |
al@14908 | 24 cd $WOK/glibc/install/usr/share/i18n/locales |
al@14908 | 25 locales=$(ls -1 | sed -n '/^'$LOCALE'$/p; /^'$LOCALE'_.*/p' | sed '/translit/d') |
al@14908 | 26 [ "x$LOCALEDEF" != x ] && locales=$LOCALEDEF |
al@14908 | 27 |
al@14908 | 28 # Get X11 locale |
al@14908 | 29 for def in $locales; do |
al@14908 | 30 x11_locale=$WOK/xorg-libX11/install/usr/share/X11/locale/$def.$CHARMAP |
al@14908 | 31 if [ -d $x11_locale ]; then |
al@14908 | 32 echo "* Found $def.$CHARMAP locale for: X11" |
al@14908 | 33 mkdir -p $fs/usr/share/X11/locale |
al@14908 | 34 cp -a $x11_locale $fs/usr/share/X11/locale |
al@14908 | 35 fi |
al@14908 | 36 done |
al@14908 | 37 |
al@14908 | 38 # Pregenerate locale file so we dont need glibc-locale as dep. |
al@14908 | 39 for def in $locales; do |
al@14908 | 40 echo "* Generate $def locale definition" |
al@14908 | 41 mkdir -p $fs/usr/lib/locale |
al@14908 | 42 localedef -i $def -c -f $CHARMAP $fs/usr/lib/locale/$def |
al@14908 | 43 done |
al@14908 | 44 |
al@14908 | 45 # Get timezones |
al@14908 | 46 countries=$(echo $locales | \ |
al@14908 | 47 sed 's|@[^ ]*||g; s|[^ _]*_||g' | tr ' ' '\n' | sort -u) |
al@14908 | 48 echo "* Copy timezone info for countries: "$countries |
al@14908 | 49 locations='' |
al@14908 | 50 for country in $countries; do |
al@14908 | 51 location=$(grep '^'$country \ |
al@14908 | 52 $WOK/glibc/install/usr/share/zoneinfo/zone.tab | awk '{ print $3}') |
al@14908 | 53 locations="$locations $location" |
al@14908 | 54 done |
al@14908 | 55 for location in $locations; do |
al@14908 | 56 for tz in $location posix/$location right/$location; do |
al@14908 | 57 install -Dm644 /usr/share/zoneinfo/$tz \ |
al@14908 | 58 $fs/usr/share/zoneinfo/$tz |
al@14908 | 59 done |
al@14908 | 60 done |
pankso@3087 | 61 } |