Use setlocale() to get the current locale instead of getenv("LC_MESSAGES")