- return false;
-#else // !__WIN32__
- // TODO: test if setlocale(info->CanonicalName) works under other OS?
-#endif // __WIN32__/!__WIN32__
+ return false;
+
+#elif defined(__UNIX__)
+
+ // Test if setting the locale works, then set it back.
+ const char *oldLocale = wxSetlocale(LC_ALL, "");
+ const char *tmp = wxSetlocaleTryUTF8(LC_ALL, info->CanonicalName);
+ if ( !tmp )
+ {
+ // Some C libraries don't like xx_YY form and require xx only
+ tmp = wxSetlocaleTryUTF8(LC_ALL, info->CanonicalName.Left(2));
+ if ( !tmp )
+ return false;
+ }
+ // restore the original locale
+ wxSetlocale(LC_ALL, oldLocale);
+#endif