summaryrefslogtreecommitdiff
path: root/configs/mate-openrc/root-image/root/.language.sh
blob: d12cb610165b417c61d7594eafb26d7acc5ebd3e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/bash

finish=0 #If change locale the system need restart session to see the changes

#Comprobe if language was selected
code=$(cat ~/.codecheck | grep LANG= | tail --bytes 2)
if [ $code = "0" ]; then
	lang=$(zenity --list --title="Select your locale" --column="Locale" --column="Language" \
		"en_US.UTF-8" "English" \
		"gl_ES.UTF-8" "Galego" \
		"es_ES.UTF-8" "Spanish" \
		"pt_BR.UTF-8" "Brazilian Portuguese")
	
	#Copy locale in locale.conf
	echo "LANG=$lang" > /etc/locale.conf

	#Put a new line confirm that language was selected
	sed -i '/LANG=./d' ~/.codecheck
	echo "LANG=1" >> ~/.codecheck

	#Copy icewm menu in that language and scripts to install
	cp -a ~/.icewm/menuLanguages/menu_${lang/_*/} ~/.icewm/menu
	cp -a ~/.scriptsInstallation/language/${lang/_*/}/* ~/.scriptsInstallation/

	finish=1
fi

# Save keymap as "us" so it starts next login
sed -i '/XKBMAP=./d' ~/.codecheck
echo "XKBMAP=us" >> ~/.codecheck
	
if [ $finish -eq 1 ]; then
	#Restart session
	pkill -KILL -u root
fi