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
This commit is contained in:
@@ -132,6 +132,11 @@ public:
|
||||
// get languages available for this app
|
||||
wxArrayString GetAvailableTranslations(const wxString& domain) const;
|
||||
|
||||
// find best translation language for given domain
|
||||
wxString GetBestTranslation(const wxString& domain, wxLanguage msgIdLanguage);
|
||||
wxString GetBestTranslation(const wxString& domain,
|
||||
const wxString& msgIdLanguage = "en");
|
||||
|
||||
// add standard wxWidgets catalog ("wxstd")
|
||||
bool AddStdCatalog();
|
||||
|
||||
@@ -168,10 +173,6 @@ private:
|
||||
// perform loading of the catalog via m_loader
|
||||
bool LoadCatalog(const wxString& domain, const wxString& lang);
|
||||
|
||||
// find best translation for given domain
|
||||
wxString ChooseLanguageForDomain(const wxString& domain,
|
||||
const wxString& msgIdLang);
|
||||
|
||||
// find catalog by name in a linked list, return NULL if !found
|
||||
wxMsgCatalog *FindCatalog(const wxString& domain) const;
|
||||
|
||||
|
Reference in New Issue
Block a user