Problem when I try to change the gui language

I have solved the problem making this:

1º) Uncomment on /etc/locale.gen these lines:
es_ES ISO-8859-1
es_ES.UTF-8 UTF-8
es_ES@euro ISO-8859-15

2º) Add these lines on en /etc/default/locale
LANG=es_ES.UTF-8
LANGUAGE=es_ES.UTF-8
LC_ALL=es_ES.UTF-8

3º) Execute these commands:

locale-gen

dpkg-reconfigure locales

4º) Reboot the system.
# reboot
5º) Once we have rebooted, execute these commands to check if the changes have been saved:

locale -a

C
C.UTF-8
en_US.utf8
es_ES
es_ES@euro
es_ES.iso88591
es_ES.iso885915@euro
es_ES.utf8
POSIX
Spanish

locale

LANG=es_ES.UTF-8
LANGUAGE=es_ES.UTF-8
LC_CTYPE="es_ES.UTF-8"
LC_NUMERIC="es_ES.UTF-8"
LC_TIME="es_ES.UTF-8"
LC_COLLATE="es_ES.UTF-8"
LC_MONETARY="es_ES.UTF-8"
LC_MESSAGES="es_ES.UTF-8"
LC_PAPER="es_ES.UTF-8"
LC_NAME="es_ES.UTF-8"
LC_ADDRESS="es_ES.UTF-8"
LC_TELEPHONE="es_ES.UTF-8"
LC_MEASUREMENT="es_ES.UTF-8"
LC_IDENTIFICATION="es_ES.UTF-8"
LC_ALL=es_ES.UTF-8

6º) Execute these commands on FreePBX

amportal a reload

amportal a ma refreshsignatures

amportal chown