X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/611bed35118d838abdec90a23a90e492a6cc75d1..66c2bf7b1d9326fb650acfaae22ec50528cfbf7c:/include/wx/translation.h diff --git a/include/wx/translation.h b/include/wx/translation.h index abd92a6d27..191f7ce124 100644 --- a/include/wx/translation.h +++ b/include/wx/translation.h @@ -4,7 +4,6 @@ // Author: Vadim Zeitlin, Vaclav Slavik, // Michael N. Filippov // Created: 2010-04-23 -// RCS-ID: $Id$ // Copyright: (c) 1998 Vadim Zeitlin // (c) 2010 Vaclav Slavik // Licence: wxWindows licence @@ -48,6 +47,7 @@ // forward decls // ---------------------------------------------------------------------------- +class WXDLLIMPEXP_FWD_BASE wxArrayString; class WXDLLIMPEXP_FWD_BASE wxTranslationsLoader; class WXDLLIMPEXP_FWD_BASE wxLocale; @@ -61,6 +61,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 +88,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 +128,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 +172,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 +196,8 @@ public: virtual wxMsgCatalog *LoadCatalog(const wxString& domain, const wxString& lang) = 0; + + virtual wxArrayString GetAvailableTranslations(const wxString& domain) const = 0; }; @@ -201,6 +210,8 @@ public: virtual wxMsgCatalog *LoadCatalog(const wxString& domain, const wxString& lang); + + virtual wxArrayString GetAvailableTranslations(const wxString& domain) const; }; @@ -213,6 +224,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"; }