Add support for storing translations in win32 resources.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64155 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2010-04-26 20:51:22 +00:00
parent 076c0a8ee8
commit bc71c3cdd5
4 changed files with 208 additions and 35 deletions

View File

@@ -18,6 +18,7 @@
#if wxUSE_INTL
#include "wx/buffer.h"
#include "wx/language.h"
#if !wxUSE_UNICODE
@@ -90,9 +91,11 @@ public:
// check if the given catalog is loaded
bool IsLoaded(const wxString& domain) const;
// load catalog data directly from file
// load catalog data directly from file or memory
bool LoadCatalogFile(const wxString& filename,
const wxString& domain = wxEmptyString);
bool LoadCatalogData(const wxScopedCharTypeBuffer<char>& data,
const wxString& domain = wxEmptyString);
// access to translations
const wxString& GetString(const wxString& origString,
@@ -148,6 +151,7 @@ public:
const wxString& domain, const wxString& lang) = 0;
};
// standard wxTranslationsLoader implementation, using filesystem
class WXDLLIMPEXP_BASE wxFileTranslationsLoader
: public wxTranslationsLoader
@@ -160,6 +164,25 @@ public:
};
#ifdef __WINDOWS__
// loads translations from win32 resources
class WXDLLIMPEXP_BASE wxResourceTranslationsLoader
: public wxTranslationsLoader
{
public:
virtual bool LoadCatalog(wxTranslations *translations,
const wxString& domain, const wxString& lang);
protected:
// returns resource type to use for translations
virtual wxString GetResourceType() const { return "MOFILE"; }
// returns module to load resources from
virtual WXHINSTANCE GetModule() const { return 0; }
};
#endif // __WINDOWS__
// ----------------------------------------------------------------------------
// global functions
// ----------------------------------------------------------------------------