freedombone-utils-international 1.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #!/bin/bash
  2. #
  3. # .---. . .
  4. # | | |
  5. # |--- .--. .-. .-. .-.| .-. .--.--. |.-. .-. .--. .-.
  6. # | | (.-' (.-' ( | ( )| | | | )( )| | (.-'
  7. # ' ' --' --' -' - -' ' ' -' -' -' ' - --'
  8. #
  9. # Freedom in the Cloud
  10. #
  11. # International/language functions
  12. #
  13. # License
  14. # =======
  15. #
  16. # Copyright (C) 2014-2016 Bob Mottram <bob@freedombone.net>
  17. #
  18. # This program is free software: you can redistribute it and/or modify
  19. # it under the terms of the GNU Affero General Public License as published by
  20. # the Free Software Foundation, either version 3 of the License, or
  21. # (at your option) any later version.
  22. #
  23. # This program is distributed in the hope that it will be useful,
  24. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  25. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  26. # GNU Affero General Public License for more details.
  27. #
  28. # You should have received a copy of the GNU Affero General Public License
  29. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  30. function locale_setup {
  31. if [[ $(is_completed $FUNCNAME) == "1" ]]; then
  32. return
  33. fi
  34. apt-get -yq install locales locales-all debconf
  35. if [ ! "$DEFAULT_LANGUAGE" ]; then
  36. DEFAULT_LANGUAGE='en_GB.UTF-8'
  37. fi
  38. if [ ${#DEFAULT_LANGUAGE} -lt 2 ]; then
  39. DEFAULT_LANGUAGE='en_GB.UTF-8'
  40. fi
  41. locale-gen "${DEFAULT_LANGUAGE}"
  42. update-locale LANG=${DEFAULT_LANGUAGE}
  43. update-locale LANGUAGE=${DEFAULT_LANGUAGE}
  44. update-locale LC_MESSAGES=${DEFAULT_LANGUAGE}
  45. update-locale LC_ALL=${DEFAULT_LANGUAGE}
  46. update-locale LC_CTYPE=${DEFAULT_LANGUAGE}
  47. mark_completed $FUNCNAME
  48. }
  49. # NOTE: deliberately no exit 0