Fix GetBestAvailableTranslation to return no match
GetBestTranslation() and GetBestAvailableTranslation() are documented to return an empty string if they find no match, but actually didn't do that due to the way GetPreferredUILanguage() was implemented to always fall back to the locale and return it without additional checks.
This commit is contained in:
parent
d8c5a87fe3
commit
34a90ba3af
1 changed files with 1 additions and 9 deletions
|
|
@ -116,14 +116,6 @@ void LogTraceLargeArray(const wxString& prefix, const wxArrayString& arr)
|
|||
|
||||
#endif // wxUSE_LOG_TRACE/!wxUSE_LOG_TRACE
|
||||
|
||||
// Use locale-based detection as a fallback
|
||||
wxString GetPreferredUILanguageFallback(const wxArrayString& WXUNUSED(available))
|
||||
{
|
||||
const wxString lang = wxUILocale::GetLanguageCanonicalName(wxUILocale::GetSystemLocale());
|
||||
wxLogTrace(TRACE_I18N, " - obtained best language from locale: %s", lang);
|
||||
return lang;
|
||||
}
|
||||
|
||||
wxString GetPreferredUILanguage(const wxArrayString& available)
|
||||
{
|
||||
wxVector<wxString> preferred = wxUILocale::GetPreferredUILanguages();
|
||||
|
|
@ -168,7 +160,7 @@ wxString GetPreferredUILanguage(const wxArrayString& available)
|
|||
if (!langNoMatchRegion.empty())
|
||||
return langNoMatchRegion;
|
||||
|
||||
return GetPreferredUILanguageFallback(available);
|
||||
return wxString();
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue