Fix locale when using country codes.

Now when selecting i.e. pt_BR it is converted correctly in Locale:
language_code: pt
country_code: BR

fixes #1077, #471