diff options
Diffstat (limited to 'scripts/splash.sh')
-rw-r--r-- | scripts/splash.sh | 70 |
1 files changed, 68 insertions, 2 deletions
diff --git a/scripts/splash.sh b/scripts/splash.sh index a8a6f0f..b9f0dd2 100644 --- a/scripts/splash.sh +++ b/scripts/splash.sh @@ -26,9 +26,11 @@ else fi gprintf() { + # request translations to be always in UTF-8 + OUTPUT_CHARSET=UTF-8 if [ -x /bin/gettext -a -n "$1" ]; then if [ -n "$GP_LANG" ]; then - TEXT=`LC_MESSAGES=$GP_LANG gettext -e --domain=$TEXTDOMAIN "$1"` + TEXT=`LANGUAGE=$GP_LANG gettext -e --domain=$TEXTDOMAIN "$1"` else TEXT=`gettext -e --domain=$TEXTDOMAIN "$1"` fi @@ -92,6 +94,70 @@ num=$(( $nbservices + 2 )) # Initialize and print text string.. if [ "$progress" == 1 -o "$1" == "start" ]; then + # depending on the languages, we need to use a font different of + # the default one; in such case the font must be accessible, or + # the translation is disabled. + # bugs: + # - RTL languages need a fake *.po file, where bidi reordering and + # shaping is already done. + # - indic languages have not shaping + case "${GP_LANG}${LANGUAGE}" in + # languages written in latin that use letters not included in luxi + az*|cy*|gn*|vi*) + font=/usr/share/fonts/otf/mdk/mdk_teams.otf ;; + # basic cyrillic, covered by cp1251 + be*|bg*|mk*|ru*|sr*|uk*) + font=/usr/share/fonts/default/Type1/a010015l.pfb ;; + # extended cyrillic, not covered by cp1251 + mn*|tg*|uz*) + font=/usr/share/fonts/otf/mdk/mdk_teams.otf ;; + # other scripts + am*) font=/usr/share/fonts/ttf/ethiopic/gfzemenu.ttf ;; + ar*|fa*|ur*) font=/usr/share/fonts/ttf/arabic/Kacst-Qr.ttf ;; + as*|bn*) font=/usr/share/fonts/ttf/bengali/MuktiBold.ttf ;; + el*) font=/usr/share/fonts/type1/greek/kb.pfb ;; + he*|yi*) font=/usr/share/fonts/type1/hebrew/Nachlieli-Bold.pfa ;; + hi*|mr*) font=/usr/share/fonts/otf/mdk/raghu.ttf ;; + hy*) font=/usr/share/fonts/ttf/armenian/artsnk_b.ttf ;; + ja*) font=/usr/share/fonts/ttf/japanese/kochi-gothic.ttf ;; + kn*) font=/usr/share/fonts/ttf/kannada/Sampige.ttf ;; + ko*) font=/usr/share/fonts/ttf/korean/gulim.ttf ;; + ml*) font=/usr/share/fonts/otf/mdk/malayalam.ttf ;; + ta*) font=/usr/share/fonts/ttf/tamil/TSCu_Paranar.ttf ;; + th*) font=/usr/share/fonts/ttf/thai/norasi_b.ttf ;; + zh_CN*) font=/usr/share/fonts/ttf/gb2312/gkai00mp.ttf ;; + zh_TW*) font=/usr/share/fonts/ttf/big5/bkai00mp.ttf ;; + # languages supported by the default font; latin1 + af*|br*|ca*|da*|de*|es*|et*|eu*|fi*|fr*|ga*|gl*|id*|is*|it*|ms*|nb*) + font=default ;; + # languages supported by the default font; latin1, more + nb*|nl*|nn*|no*|pt*|sv*|wa*) + font=default ;; + # languages supported by the default font; latin2 + bs*|cs*|hr*|hu*|pl*|ro*|sk*|sl*|sq*) + font=default ;; + # languages supported by the default font; other latin coverages + eo*|lt*|lv*|mt*|tr*) + font=default ;; + # for others, we do a last chance possibility with + # arial unicode, if the user installed it... + *) font=/usr/X11R6/lib/X11/fonts/drakfont/ttf/arialuni.ttf ;; + esac + + if [ "$font" != "default" ]; then + if [ -r "$font" ] + custom_font="-f $font" + elif [ -r "/etc/locale/`basename $font`" ]; then + custom_font="/etc/locale/`basename $font`" + elif [ -r "/etc/locale/default.ttf" ]; then + custom_font="/etc/locale/default.ttf" + else + # no font available, translations are not done + GP_LANG=C ; + LANGUAGE=C ; + fi + fi + if test "$_shutdown" == "yes"; then gprintf "Shutting down the system..." [[ -f /etc/bootsplash/themes/$theme/config/bootsplash-$res.cfg ]] && /sbin/splash -s -u 0 /etc/bootsplash/themes/$theme/config/bootsplash-$res.cfg @@ -105,7 +171,7 @@ if [ "$progress" == 1 -o "$1" == "start" ]; then -a "$text_color" != "" -a "$text_size" != "" -a "$_silent" == "yes" ]; then gprintf "Press F2 for verbose mode." fbtruetype.static -x $text_x -y $text_y -t $text_color -s $text_size \ - "$_boot $TEXT" + $custom_font "$_boot $TEXT" fi fi |