Fix getting current system locale

Ultimately this fixes the invariant locale being set as System.Globalization.CultureInfo.CurrentCulture on systems with LANG=xx_YY and in wine-mono. See commit messages for more details.