| 262 | } |
| 263 | |
| 264 | wxString LocalizedLanguageName(wxString const& lang) { |
| 265 | icu::Locale iculoc(lang.c_str()); |
| 266 | if (!iculoc.isBogus()) { |
| 267 | icu::UnicodeString ustr; |
| 268 | iculoc.getDisplayName(iculoc, ustr); |
| 269 | #ifdef _MSC_VER |
| 270 | return wxString((const wchar_t*)ustr.getBuffer()); |
| 271 | #else |
| 272 | std::string utf8; |
| 273 | ustr.toUTF8String(utf8); |
| 274 | return to_wx(utf8); |
| 275 | #endif |
| 276 | } |
| 277 | |
| 278 | if (auto info = wxLocale::FindLanguageInfo(lang)) |
| 279 | return info->Description; |
| 280 | return lang; |
| 281 | } |
no test coverage detected