X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/978af864269a739e77d9431c8465435e3f8f7407..01f512d7fc2af9ce64adc85937766722b8fc38c5:/src/common/intl.cpp diff --git a/src/common/intl.cpp b/src/common/intl.cpp index ccc1418e29..4915e52efe 100644 --- a/src/common/intl.cpp +++ b/src/common/intl.cpp @@ -2711,6 +2711,31 @@ wxMsgCatalog *wxLocale::FindCatalog(const wxChar *szDomain) const return NULL; } +// check if the given locale is provided by OS and C run time +/* static */ +bool wxLocale::IsAvailable(int lang) +{ + const wxLanguageInfo *info = wxLocale::GetLanguageInfo(lang); + wxCHECK_MSG( info, false, _T("invalid language") ); + +#ifdef __WIN32__ + if ( !info->WinLang ) + return false; + + if ( !::IsValidLocale + ( + MAKELCID(MAKELANGID(info->WinLang, info->WinSublang), + SORT_DEFAULT), + LCID_INSTALLED + ) ) + return false; +#else // !__WIN32__ + // TODO: test if setlocale(info->CanonicalName) works under other OS? +#endif // __WIN32__/!__WIN32__ + + return true; +} + // check if the given catalog is loaded bool wxLocale::IsLoaded(const wxChar *szDomain) const {