Is it possible to install additional languages/locales and to change the default locale through a script in Bookworm?
I've been trying this script but it doesn't work:
I've been trying this script but it doesn't work:
Code:
#!/bin/bash# Script to add locales de_DE and en_US to Raspberry Pi OS (Bookworm)# Ensure script is run without sudo to avoid permission issuesif [ "$(id -u)" = "0" ]; then echo "Please do not run this script with sudo. Exiting." exit 1fi# Update package list and install locales package if neededecho "Updating package list..."sudo apt updateecho "Installing locales package if not already installed..."sudo apt install -y locales# Add German and US English localesecho "Generating de_DE.UTF-8 and en_US.UTF-8 locales..."sudo locale-gen de_DE.UTF-8 en_US.UTF-8# Write desired locales directly to /etc/default/localeecho "Setting default locale in /etc/default/locale..."sudo bash -c 'cat > /etc/default/locale <<EOFLANG=en_US.UTF-8LANGUAGE=en_US:enLC_ALL=en_US.UTF-8EOF'# Reload the locale configurationecho "Reloading locale configuration..."source /etc/default/localeecho "Locales added successfully. The system will now reboot to apply changes."# Reboot the system to apply changessudo reboot
Statistics: Posted by sapnho — Sat Nov 09, 2024 3:49 pm