Merge "call uselocale() before freelocale() to make sure that g_local_key has a valid locale."