Since people can generate their own image with debootstrap, and
this wouldn't create a file /var/lib/locales/supported.d/local,
better check if it exist and work if it doesn't.
Fix#656
The function normalizes checks for UTF-8, but the same issue exists for
other locales as well. This fix adds normalization for EUC-JP, a Japanese
locale.
The previous version of this code was supporting only locales using the
format "<language>_<territory>.<charset>". But all the locales that
doesn't have this format were not installable (such as "fr_FR" or
"fr_FR@euro").
Also, if an invalid locales was provided, the module kept sending a
"changed" status.
Now :
* if the user provides an invalid locales, the module failed. Locales
are verified using /etc/locale.gen or /usr/share/i18n/SUPPORTED if
Ubuntu
* Every types of valid locales are now supported.
* The locale module was not working on Archlinux, as there's no space
between the "#" and the locale. This is now supported. Credits goes
to danderson189, this is his code.
This module was tested on debian jessie, ubuntu 14 LTS and last
Archlinux.