Add wxTranslations::GetBestTranslation().
authorVáclav Slavík <vslavik@fastmail.fm>
Sat, 8 Sep 2012 08:58:38 +0000 (08:58 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Sat, 8 Sep 2012 08:58:38 +0000 (08:58 +0000)
commit01f953efb211daf5275cbb10aa3dd000eeed6d48
tree70081a9c3197eb4ed98368eea005494bf9e5a977
parent8566fe6edfd6a009e951733905db53f94d0919f3
Add wxTranslations::GetBestTranslation().

Implement preferred language selection on modern systems (OS X, Windows
Vista+). User settings for locale (aka "regional settings") and UI
language are independent there and the UI language shouldn't be
determined from the locale.

Moreover, the OS provides a list of preferred languages, not a single
value (as with locale), so we should use the best language given user's
preferences and available translations. A Czech user may prefer Slovak
UI over English, for example, and we should use Slovak translation in
absence of Czech one in that case instead of falling back to English.

On Unix, locale is language and so things remain as before.

Notice that calling wxLocale::Init(wxLANGUAGE_DEFAULT) does the right
thing now: it sets the locale to whatever the user has configured in
regional settings and loads translations corresponding to default
wxTranslations language, which is determined as described above.
Previously, UI would be translated using a language corresponding to the
regional settings.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72430 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
include/wx/translation.h
interface/wx/intl.h
interface/wx/translation.h
src/common/translation.cpp