There is no way to add your own transaltor to Wq, as
Wt::WMessageResourceBundle is hardcoded into WApplication.

I have tried successfully tried the following approach:

     1. Add an abstract base class WTranslator (below).

     2. Make WMessageResourceBundle inherit WTranslator;

     3. Change WApplication::messageResourceBundle_ from
        "WMessageResourceBundle" to "WTranslator *" and
        use WMessageResourceBundle as the default.

     4. Add void setMessageResourceBundle(WTranslator *).
        Trivial, so source code not included here.

And here is the source for WTranslator:

-----------------------------------------------------------------------------
class WT_API WTranslator {
   public:
     virtual void refresh() = 0;

   protected:
     virtual ~WTranslator() { }

   private:
     virtual void hibernate() = 0;
     virtual bool resolveKey(const std::string& key, std::string& result) = 0;
     friend class WApplication;
     friend class WebSession;
     friend class WString;
};
-----------------------------------------------------------------------------

There is no .C file, as all regular functions are abstract, and the destructor
is inline.

Perhaps this could be integrated into Wt.

/Lars Hamrén


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to