fix(locale): Throw an exception when requesting an unsupported locale (refs #5028)

Improper locale validation could lead to arbitrary value being passed in
a LANG env var which in turn could be used to trigger GNU bash's
CVE-2014-6271 exploit on unpatched systems.
Merge pull request #1347 from eguaj/3.2-A5028

fix(locale): Throw an exception when requesting an unsupported locale (closes #5028)