Failed to set locale, defaulting to C

If you just install a fresh Centos 7 and you get that strange message every time when you are do something with yum.
But with rpm there is even more problems.
Failed to set locale, defaulting to C

This is a quick way to change the locale settings in CentOS 7.
You just need to create a new configuration file like:

vi /etc/profile.d/locale.sh

In this new file, enter the needed parameters like mine in this case:

export LANG=en_US.UTF-8
export LANGUAGE=en_US.UTF-8

Save the file, and load its parameters using:

source /etc/profile.d/locale.sh

After you can log off and log on and test again yum update.