- const char *oldLocale = wxSetlocaleTryUTF8(LC_ALL, info->CanonicalName);
- if ( !oldLocale )
- {
- // Some C libraries don't like xx_YY form and require xx only
- oldLocale = wxSetlocaleTryUTF8(LC_ALL, ExtractLang(info->CanonicalName));
- if ( !oldLocale )
- return false;
- }
+ char * const oldLocale = wxStrdupA(setlocale(LC_ALL, NULL));
+
+ // Some platforms don't like xx_YY form and require xx only so test for
+ // it too.
+ const bool
+ available = wxSetlocaleTryUTF8(LC_ALL, info->CanonicalName) ||
+ wxSetlocaleTryUTF8(LC_ALL, ExtractLang(info->CanonicalName));
+