#!/bin/bash # this script is to be called when a locale is installed for first time; # it gets the locale name(s) as parameter, and does the needed steps # so that the new locale can be used by the system # the list of languages that rpm installs their translations if [ -r /etc/rpm/macros ]; then RPM_INSTALL_LANG="`grep '^%_install_langs' /etc/rpm/macros | cut -d' ' -f2-`" fi [ -z "$RPM_INSTALL_LANG" ] && RPM_INSTALL_LANG=C OLD_RPM_INSTALL_LANG="$RPM_INSTALL_LANG" eval "`sed /usr/share/i18n/SUPPORTED -e 's/^SUPPORTED-LOCALES=\s*\\\\/SUPPORTED_LOCALES=\"\\\\/' -e '$a''"'`" for i in "$@"; do for l in $SUPPORTED_LOCALES; do case $l in $i | $i.* | $i@* | $i/* ) # Generate locale definition and add it to the locale-archive file charset=`echo $l | sed -e 's,.*/,,'`; locale=`echo $l | sed -e 's,/[^/]*,,'`; input=`echo $locale | sed 's/\([^.]*\)[^@]*\(.*\)/\1\2/'`; localedef -i $input -c -f $charset $locale; ;; *) ;; esac done # make the installed locale known to rpm (so translations in that # language are installed), and the menu system if [ "$RPM_INSTALL_LANG" != "all" ]; then RPM_INSTALL_LANG=`echo $i:$RPM_INSTALL_LANG |tr ':' '\n' |sort |tr '\n' ':' |sed -e 's,:$,,'` fi done if [ "$OLD_RPM_INSTALL_LANG" != "$RPM_INSTALL_LANG" ]; then # update /etc/rpm/macros file if [ -w /etc/rpm/macros ]; then sed -i -e "s/^%_install_langs .*/%_install_langs $RPM_INSTALL_LANGS/" /etc/rpm/macros fi fi