Merge branch 'translation-lookup-fixes' of https://github.com/vslavik/wxWidgets
Restore correct translation language lookup taking into account message IDs language correctly when it is present in the preferred UI languages but is not the first language in them and other similar corner cases. Also add unit tests verifying that this code logic, already changed many times in the past, does behave correctly now. See #24297.
This commit is contained in:
commit
01ffca369c
13 changed files with 235 additions and 83 deletions
|
|
@ -160,7 +160,7 @@ public:
|
|||
|
||||
// add catalog for the given domain returning true if it could be found by
|
||||
// wxTranslationsLoader
|
||||
bool AddAvailableCatalog(const wxString& domain);
|
||||
bool AddAvailableCatalog(const wxString& domain, wxLanguage msgIdLanguage = wxLANGUAGE_ENGLISH_US);
|
||||
|
||||
// add standard wxWidgets catalog ("wxstd")
|
||||
bool AddStdCatalog();
|
||||
|
|
@ -193,6 +193,15 @@ public:
|
|||
static const wxString& GetUntranslatedString(const wxString& str);
|
||||
|
||||
private:
|
||||
enum class Translations
|
||||
{
|
||||
NotNeeded = -1,
|
||||
NotFound = 0,
|
||||
Found = 1
|
||||
};
|
||||
|
||||
Translations DoAddCatalog(const wxString& domain, wxLanguage msgIdLanguage);
|
||||
|
||||
// perform loading of the catalog via m_loader
|
||||
bool LoadCatalog(const wxString& domain, const wxString& lang);
|
||||
|
||||
|
|
@ -203,6 +212,8 @@ private:
|
|||
static void SetNonOwned(wxTranslations *t);
|
||||
friend class wxLocale;
|
||||
|
||||
wxString DoGetBestAvailableTranslation(const wxString& domain, const wxString& additionalAvailableLanguage);
|
||||
|
||||
private:
|
||||
wxString m_lang;
|
||||
wxTranslationsLoader *m_loader;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue