X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/611bed35118d838abdec90a23a90e492a6cc75d1..0555b2a0a3c509687e7fc5aeb160f5171b7e6311:/include/wx/translation.h diff --git a/include/wx/translation.h b/include/wx/translation.h index abd92a6d27..c12ae52046 100644 --- a/include/wx/translation.h +++ b/include/wx/translation.h @@ -48,6 +48,7 @@ // forward decls // ---------------------------------------------------------------------------- +class WXDLLIMPEXP_FWD_BASE wxArrayString; class WXDLLIMPEXP_FWD_BASE wxTranslationsLoader; class WXDLLIMPEXP_FWD_BASE wxLocale; @@ -61,6 +62,12 @@ wxDECLARE_SCOPED_PTR(wxPluralFormsCalculator, wxPluralFormsCalculatorPtr) class WXDLLIMPEXP_BASE wxMsgCatalog { public: + // Ctor is protected, because CreateFromXXX functions must be used, + // but destruction should be unrestricted +#if !wxUSE_UNICODE + ~wxMsgCatalog(); +#endif + // load the catalog from disk or from data; caller is responsible for // deleting them if not NULL static wxMsgCatalog *CreateFromFile(const wxString& filename, @@ -82,9 +89,6 @@ protected: , m_conv(NULL) #endif {} -#if !wxUSE_UNICODE - ~wxMsgCatalog(); -#endif private: // variable pointing to the next element in a linked list (or NULL) @@ -125,6 +129,14 @@ public: void SetLanguage(wxLanguage lang); void SetLanguage(const wxString& lang); + // 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(); @@ -161,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; @@ -189,6 +197,8 @@ public: virtual wxMsgCatalog *LoadCatalog(const wxString& domain, const wxString& lang) = 0; + + virtual wxArrayString GetAvailableTranslations(const wxString& domain) const = 0; }; @@ -201,6 +211,8 @@ public: virtual wxMsgCatalog *LoadCatalog(const wxString& domain, const wxString& lang); + + virtual wxArrayString GetAvailableTranslations(const wxString& domain) const; }; @@ -213,6 +225,8 @@ public: virtual wxMsgCatalog *LoadCatalog(const wxString& domain, const wxString& lang); + virtual wxArrayString GetAvailableTranslations(const wxString& domain) const; + protected: // returns resource type to use for translations virtual wxString GetResourceType() const { return "MOFILE"; }