l10n.sh 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. # default eval_gettext() to ensure that we do not fail
  2. # if gettext-base is not installed
  3. eval_gettext() {
  4. echo "$1"
  5. }
  6. # Deal with systems where /usr isn't mounted
  7. if [ ! -d /usr/share/locale ]; then
  8. return
  9. fi
  10. # blacklist some languages that we don't have a good console fonts for
  11. # see bug #573502
  12. in_lang_blacklist() {
  13. LANG_BLACKLIST="ar_ he_IL ja_JP ko_KR ru_RU sl_SI vi_VN zh_"
  14. LANG=$1
  15. for b in $LANG_BLACKLIST; do
  16. # equal to lang.startswith(b)
  17. if expr match "$LANG" ^"$b" >/dev/null ; then
  18. export LANG=C.UTF-8
  19. export LANGUAGE=en
  20. return 0
  21. fi
  22. done
  23. return 1
  24. }
  25. # There is no environment set, as these steps are skipped,
  26. # so we need to source the variables needed for localization ourselves
  27. if [ -r /etc/default/locale ]; then
  28. . /etc/default/locale
  29. if ! in_lang_blacklist "$LANG"; then
  30. export LANG LANGUAGE
  31. fi
  32. elif [ -r /etc/environment ]; then
  33. . /etc/environment
  34. if ! in_lang_blacklist "$LANG"; then
  35. export LANG LANGUAGE
  36. fi
  37. fi
  38. . gettext.sh
  39. export TEXTDOMAIN=friendly-recovery
  40. export TEXTDOMAINDIR=/usr/share/locale