localization and resource bundle info is now read from the config file

This commit is contained in:
maroy 2004-12-01 20:15:33 +00:00
parent 585a096fdb
commit 978f9e0998
4 changed files with 38 additions and 17 deletions

View File

@ -1,7 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE gLiveSupport [
<!ELEMENT gLiveSupport (authenticationClientFactory) >
<!ELEMENT gLiveSupport (resourceBundle,
authenticationClientFactory) >
<!ELEMENT resourceBundle EMPTY >
<!ATTLIST resourceBundle path CDATA #REQUIRED >
<!ATTLIST resourceBundle locale CDATA #REQUIRED >
<!ELEMENT authenticationClientFactory (testAuthentication|
webAuthentication)>
@ -14,6 +19,9 @@
]>
<gLiveSupport>
<resourceBundle path = "./tmp/gLiveSupport"
locale = "en"
/>
<authenticationClientFactory>
<testAuthentication>
<user login="root" password="q" />

View File

@ -22,7 +22,7 @@
Author : $Author: maroy $
Version : $Revision: 1.1 $
Version : $Revision: 1.2 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/GLiveSupport.cxx,v $
------------------------------------------------------------------------------*/
@ -82,6 +82,14 @@ GLiveSupport :: configure(const xmlpp::Element & element)
xmlpp::Node::NodeList nodes;
// configure the resource bundle
nodes = element.get_children(LocalizedObject::getConfigElementName());
if (nodes.size() < 1) {
throw std::invalid_argument("no resourceBundle element");
}
resourceBundle = LocalizedObject::getBundle(
*((const xmlpp::Element*) *(nodes.begin())) );
// configure the AuthenticationClientFactory
nodes = element.get_children(
AuthenticationClientFactory::getConfigElementName());
@ -93,16 +101,6 @@ GLiveSupport :: configure(const xmlpp::Element & element)
acf->configure( *((const xmlpp::Element*) *(nodes.begin())) );
authentication = acf->getAuthenticationClient();
// load the resource bundle
// TODO: get resource bundle path from config file
UErrorCode status = U_ZERO_ERROR;
resourceBundle.reset(new ResourceBundle("./tmp/" PACKAGE_NAME,
"en",
status));
if (!U_SUCCESS(status)) {
throw std::invalid_argument("opening resource bundle a failure");
}
}

View File

@ -22,7 +22,7 @@
Author : $Author: maroy $
Version : $Revision: 1.1 $
Version : $Revision: 1.2 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/GLiveSupport.h,v $
------------------------------------------------------------------------------*/
@ -64,8 +64,23 @@ using namespace LiveSupport::Core;
/**
* The main application object for the gLiveSupport GUI.
*
* The configuration file for this object is based on configuration
* elements used by the object. The DTD for the root element of the
* configuration file is:
*
* <pre><code>
* <!ELEMENT gLiveSupport (resourceBundle,
* authenticationClientFactory) >
* </code></pre>
*
* For a description of the <code>resourceBundle</code> and
* <code>authenticationClientFactory</code> elements see their
* respective documentation.
*
* @author $Author: maroy $
* @version $Revision: 1.1 $
* @version $Revision: 1.2 $
* @see LocalizedObject#getBundle(const xmlpp::Element &)
* @see AuthenticationClientFactory
*/
class GLiveSupport : public Configurable,
public boost::enable_shared_from_this<GLiveSupport>

View File

@ -22,7 +22,7 @@
Author : $Author: maroy $
Version : $Revision: 1.4 $
Version : $Revision: 1.5 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/Attic/UiTestMainWindow.h,v $
------------------------------------------------------------------------------*/
@ -66,7 +66,7 @@ using namespace LiveSupport::Core;
* A window, enabling interactive testing of UI components.
*
* @author $Author: maroy $
* @version $Revision: 1.4 $
* @version $Revision: 1.5 $
*/
class UiTestMainWindow : public Gtk::Window, public GtkLocalizedObject
{
@ -134,7 +134,7 @@ class UiTestMainWindow : public Gtk::Window, public GtkLocalizedObject
* Function that updates timeLabel with the current time.
* This is called by GTK at regular intervals.
*
* @param param a dummy, unused parameter
* @param dummy a dummy, unused parameter
* @return true if the timer should call this function again,
* false if the timer should be canceled
*/