freedombone-utils-international 1.7KB

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