Commit 78bbb87a authored by whitlocb's avatar whitlocb

Initial support for internationalization of the VisIt GUI. See...

Initial support for internationalization of the VisIt GUI. See http://visitusers.org/index.php?title=Internationalization for more information.


git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@3798 18c085ea-50e0-402c-830e-de6fd14e8384
parent d4e93988
......@@ -305,6 +305,9 @@ $0 = shift @ARGV;
# Gunther H. Weber, Tue Apr 8 17:32:24 PDT 2008
# Added franklin.nersc.gov specific code
#
# Brad Whitlock, Wed Apr 9 14:17:18 PDT 2008
# Added -locale option.
#
###############################################################################
use POSIX qw(ceil);
......@@ -382,6 +385,10 @@ $usage = "
-window_anchor <x,y> The x,y position on the screen where VisIt's GUI
will show its windows (Main window excluded).
-style <style> One of: windows,cde,motif,sgi.
-locale <locale> The locale that you want VisIt to use when displaying
translated menus and controls. VisIt will use the
default locale if the -locale option is not
provided.
-background <color> Background color for GUI.
-foreground <color> Foreground color for GUI.
-nowin Run with viewer windows off-screen (i.e. OSMesa).
......
This diff is collapsed.
......@@ -49,6 +49,7 @@
#include <SimpleObserver.h>
#include <qobject.h>
#include <qapplication.h>
#include <qcursor.h>
......@@ -562,6 +563,7 @@ bool
GUIBase::SetOpenDataFile(const QualifiedFilename &qf, int timeState,
SimpleObserver *sob, bool reOpen)
{
const char *mName = "GUIBase::SetOpenDataFile";
bool retval = true;
//
......@@ -588,13 +590,13 @@ GUIBase::SetOpenDataFile(const QualifiedFilename &qf, int timeState,
QString msg;
if(reOpen)
{
msg.sprintf("Reopening %s on %s", qf.filename.c_str(),
qf.host.c_str());
msg = QObject::tr("Reopening ",mName) + QString(qf.filename.c_str())
+ QObject::tr(" on ", mName) + QString(qf.host.c_str());
}
else
{
msg.sprintf("Opening %s on %s", qf.filename.c_str(),
qf.host.c_str());
msg = QObject::tr("Opening ", mName) + QString(qf.filename.c_str())
+ QObject::tr(" on ", mName) + QString(qf.host.c_str());
}
Status(msg);
......@@ -617,11 +619,11 @@ GUIBase::SetOpenDataFile(const QualifiedFilename &qf, int timeState,
ClearStatus();
// Tell the user about the error.
QString msg;
msg.sprintf("VisIt could not open the file %s.\n\nThe metadata "
"server returned the following message:\n\n%s",
qf.FullName().c_str(), gmde.Message().c_str());
debug1 << msg << endl;
QString msg(QObject::tr("VisIt could not open the file %1.\n\n"
"The metadata server returned the following message:\n\n%2", mName));
msg.replace("%1", QString(qf.FullName().c_str()));
msg.replace("%2",QString(gmde.Message().c_str()));
debug1 << msg.ascii() << endl;
debug1 << "Not issuing an error message because the viewer will "
<< "cover that." << endl;
//Error(msg);
......
......@@ -56,10 +56,12 @@
// Creation: Tue Nov 14 10:57:35 PDT 2006
//
// Modifications:
//
// Brad Whitlock, Tue Apr 8 08:53:15 PDT 2008
// Added QObject inheritance.
//
// ****************************************************************************
MovieSequence::MovieSequence() : uiFile()
MovieSequence::MovieSequence() : QObject(), uiFile()
{
}
......
......@@ -37,6 +37,7 @@
* DAMAGE.
*
*****************************************************************************/
#include <qobject.h>
#include <string>
#include <qpixmap.h>
......@@ -65,10 +66,12 @@ class QWidget;
// Creation: Thu Oct 5 14:52:36 PST 2006
//
// Modifications:
//
// Brad Whitlock, Tue Apr 8 08:50:52 PDT 2008
// I made SequenceMenuName return a QString so we can tr() it.
//
// ****************************************************************************
class MovieSequence
class MovieSequence : public QObject
{
public:
MovieSequence();
......@@ -85,7 +88,7 @@ public:
virtual std::string SequenceName() const = 0;
// Returns the name of the sequence as it will appear in menus.
virtual std::string SequenceMenuName() const = 0;
virtual QString SequenceMenuName() const = 0;
virtual bool ProvidesMenu() const;
virtual int SubMenuIndex() const;
......
......@@ -98,14 +98,16 @@ MovieSequenceCompositeTransition::~MovieSequenceCompositeTransition()
// Creation: Tue Nov 14 10:45:01 PDT 2006
//
// Modifications:
//
// Brad Whitlock, Tue Apr 8 10:33:54 PDT 2008
// SequenceMenuName now returns QString.
//
// ****************************************************************************
QWidget *
MovieSequenceCompositeTransition::CreateUI()
{
QvisCompositeTransition *ui = new QvisCompositeTransition(Pixmap(), 0, GetName().c_str());
ui->setTitle(SequenceMenuName().c_str());
ui->setTitle(SequenceMenuName());
return ui;
}
......@@ -194,7 +196,7 @@ MovieSequenceCompositeTransition::WriteUIValues(QWidget *ui, DataNode *node)
}
//
// Pixmap methods for the derived classes.
// Pixmap and menu name methods for the derived classes.
//
QPixmap
......@@ -203,33 +205,79 @@ MovieSequenceCompositeFadeIn::Pixmap()
return QPixmap(ms_comp_fadein_xpm);
}
QString
MovieSequenceCompositeFadeIn::SequenceMenuName() const
{
return tr("Fade in viewport");
}
////////////////////////////////////////////////////////////////////////////////
QPixmap
MovieSequenceCompositeFadeOut::Pixmap()
{
return QPixmap(ms_comp_fadeout_xpm);
}
QString
MovieSequenceCompositeFadeOut::SequenceMenuName() const
{
return tr("Fade out viewport");
}
////////////////////////////////////////////////////////////////////////////////
QPixmap
MovieSequenceCompositeLRSlide::Pixmap()
{
return QPixmap(ms_comp_lr_slide_xpm);
}
QString
MovieSequenceCompositeLRSlide::SequenceMenuName() const
{
return tr("Slide in viewport left to right");
}
////////////////////////////////////////////////////////////////////////////////
QPixmap
MovieSequenceCompositeRLSlide::Pixmap()
{
return QPixmap(ms_comp_rl_slide_xpm);
}
QString
MovieSequenceCompositeRLSlide::SequenceMenuName() const
{
return tr("Slide in viewport right to left");
}
////////////////////////////////////////////////////////////////////////////////
QPixmap
MovieSequenceCompositeTBSlide::Pixmap()
{
return QPixmap(ms_comp_tb_slide_xpm);
}
QString
MovieSequenceCompositeTBSlide::SequenceMenuName() const
{
return tr("Slide in viewport top to bottom");
}
////////////////////////////////////////////////////////////////////////////////
QPixmap
MovieSequenceCompositeBTSlide::Pixmap()
{
return QPixmap(ms_comp_bt_slide_xpm);
}
QString
MovieSequenceCompositeBTSlide::SequenceMenuName() const
{
return tr("Slide in viewport bottom to top");
}
......@@ -51,6 +51,9 @@
// Creation: Mon Oct 16 10:40:43 PDT 2006
//
// Modifications:
// Brad Whitlock, Tue Apr 8 09:03:10 PDT 2008
// Made SequenceMenuName return QString and moved the implementation to the
// .C file so we can more easily internationalize.
//
// ****************************************************************************
......@@ -80,7 +83,7 @@ public:
virtual MovieSequence *NewInstance() const { return new MovieSequenceCompositeFadeIn; }
virtual int SequenceId() const { return 200; }
virtual std::string SequenceName() const { return "CompositeFadeIn"; }
virtual std::string SequenceMenuName() const { return "Fade in viewport"; }
virtual QString SequenceMenuName() const;
virtual QPixmap Pixmap();
};
......@@ -93,7 +96,7 @@ public:
virtual MovieSequence *NewInstance() const { return new MovieSequenceCompositeFadeOut; }
virtual int SequenceId() const { return 201; }
virtual std::string SequenceName() const { return "CompositeFadeOut"; }
virtual std::string SequenceMenuName() const { return "Fade out viewport"; }
virtual QString SequenceMenuName() const;
virtual QPixmap Pixmap();
};
......@@ -111,7 +114,7 @@ public:
virtual MovieSequence *NewInstance() const { return new MovieSequenceCompositeLRSlide; }
virtual int SequenceId() const { return 202; }
virtual std::string SequenceName() const { return "CompositeLRSlide"; }
virtual std::string SequenceMenuName() const { return "Slide in viewport left to right"; }
virtual QString SequenceMenuName() const;
virtual QPixmap Pixmap();
};
......@@ -124,7 +127,7 @@ public:
virtual MovieSequence *NewInstance() const { return new MovieSequenceCompositeRLSlide; }
virtual int SequenceId() const { return 203; }
virtual std::string SequenceName() const { return "CompositeRLSlide"; }
virtual std::string SequenceMenuName() const { return "Slide in viewport right to left"; }
virtual QString SequenceMenuName() const;
virtual QPixmap Pixmap();
};
......@@ -137,7 +140,7 @@ public:
virtual MovieSequence *NewInstance() const { return new MovieSequenceCompositeTBSlide; }
virtual int SequenceId() const { return 204; }
virtual std::string SequenceName() const { return "CompositeTBSlide"; }
virtual std::string SequenceMenuName() const { return "Slide in viewport top to bottom"; }
virtual QString SequenceMenuName() const;
virtual QPixmap Pixmap();
};
......@@ -150,7 +153,7 @@ public:
virtual MovieSequence *NewInstance() const { return new MovieSequenceCompositeBTSlide; }
virtual int SequenceId() const { return 205; }
virtual std::string SequenceName() const { return "CompositeBTSlide"; }
virtual std::string SequenceMenuName() const { return "Slide in viewport bottom to top"; }
virtual QString SequenceMenuName() const;
virtual QPixmap Pixmap();
};
......
......@@ -109,10 +109,10 @@ MovieSequenceCurrentPlots::SequenceName() const
return "CurrentPlots";
}
std::string
QString
MovieSequenceCurrentPlots::SequenceMenuName() const
{
return "Current plots";
return tr("Current plots");
}
bool
......
......@@ -50,7 +50,9 @@
// Creation: Fri Oct 6 14:56:28 PST 2006
//
// Modifications:
//
// Brad Whitlock, Tue Apr 8 09:07:31 PDT 2008
// Changed SequenceMenuName so it returns QString.
//
// ****************************************************************************
class MovieSequenceCurrentPlots : public MovieSequence
......@@ -70,7 +72,7 @@ public:
virtual std::string SequenceName() const;
// Returns the name of the sequence as it will appear in menus.
virtual std::string SequenceMenuName() const;
virtual QString SequenceMenuName() const;
virtual bool ProvidesMenu() const;
virtual bool ReadOnly() const;
......
......@@ -296,11 +296,13 @@ MovieSequenceFactory::SequenceName(int id, std::string &name) const
// Creation: Tue Nov 14 10:33:38 PDT 2006
//
// Modifications:
//
// Brad Whitlock, Tue Apr 8 09:08:56 PDT 2008
// Changed std::string to QString.
//
// ****************************************************************************
bool
MovieSequenceFactory::SequenceMenuName(int id, std::string &name) const
MovieSequenceFactory::SequenceMenuName(int id, QString &name) const
{
std::map<int, MovieSequence *>::const_iterator it = sequenceTypes.find(id);
if(it != sequenceTypes.end())
......
......@@ -39,6 +39,7 @@
*****************************************************************************/
#include <map>
#include <string>
#include <qstring.h>
class MovieSequence;
class QPixmap;
......@@ -56,7 +57,9 @@ class QPixmap;
// Creation: Thu Oct 5 14:28:40 PST 2006
//
// Modifications:
//
// Brad Whitlock, Tue Apr 8 09:09:34 PDT 2008
// Changed SequenceMenuName so it returns QString.
//
// ****************************************************************************
class MovieSequenceFactory
......@@ -69,7 +72,7 @@ public:
bool SequenceNameToId(const std::string &name, int &id) const;
bool SequenceName(int id, std::string &name) const;
bool SequenceMenuName(int id, std::string &name) const;
bool SequenceMenuName(int id, QString &name) const;
bool SequenceSubMenuIndex(int id, int &index) const;
bool SequenceProvidesMenu(int id) const;
bool SequencePixmap(int id, QPixmap &pix) const;
......
......@@ -98,14 +98,16 @@ MovieSequenceRotate::~MovieSequenceRotate()
// Creation: Tue Nov 14 10:40:11 PDT 2006
//
// Modifications:
//
// Brad Whitlock, Tue Apr 8 10:34:24 PDT 2008
// SequenceMenuName now returns QString.
//
// ****************************************************************************
QWidget *
MovieSequenceRotate::CreateUI()
{
QvisRotationTransition *ui = new QvisRotationTransition(Pixmap(), 0, GetName().c_str());
ui->setTitle(SequenceMenuName().c_str());
ui->setTitle(SequenceMenuName());
return ui;
}
......@@ -219,18 +221,41 @@ MovieSequenceScreenRotationX::Pixmap()
return QPixmap(ms_srotx_xpm);
}
QString
MovieSequenceScreenRotationX::SequenceMenuName() const
{
return tr("Screen rotate X");
}
////////////////////////////////////////////////////////////////////////////////
QPixmap
MovieSequenceScreenRotationY::Pixmap()
{
return QPixmap(ms_sroty_xpm);
}
QString
MovieSequenceScreenRotationY::SequenceMenuName() const
{
return tr("Screen rotate Y");
}
////////////////////////////////////////////////////////////////////////////////
QPixmap
MovieSequenceScreenRotationZ::Pixmap()
{
return QPixmap(ms_srotz_xpm);
}
QString
MovieSequenceScreenRotationZ::SequenceMenuName() const
{
return tr("Screen rotate Z");
}
////////////////////////////////////////////////////////////////////////////////
QPixmap
MovieSequenceRotationX::Pixmap()
......@@ -238,16 +263,38 @@ MovieSequenceRotationX::Pixmap()
return QPixmap(ms_rotx_xpm);
}
QString
MovieSequenceRotationX::SequenceMenuName() const
{
return tr("Rotate X");
}
////////////////////////////////////////////////////////////////////////////////
QPixmap
MovieSequenceRotationY::Pixmap()
{
return QPixmap(ms_roty_xpm);
}
QString
MovieSequenceRotationY::SequenceMenuName() const
{
return tr("Rotate Y");
}
////////////////////////////////////////////////////////////////////////////////
QPixmap
MovieSequenceRotationZ::Pixmap()
{
return QPixmap(ms_rotz_xpm);
}
QString
MovieSequenceRotationZ::SequenceMenuName() const
{
return tr("Rotate Z");
}
......@@ -51,7 +51,9 @@
// Creation: Tue Nov 7 17:24:26 PST 2006
//
// Modifications:
//
// Brad Whitlock, Tue Apr 8 09:14:04 PDT 2008
// Moved SequenceMenuName methods to the .C file.
//
// ****************************************************************************
class MovieSequenceRotate : public MovieSequence
......@@ -80,7 +82,7 @@ public:
virtual MovieSequence *NewInstance() const { return new MovieSequenceScreenRotationX; }
virtual int SequenceId() const { return 300; }
virtual std::string SequenceName() const { return "ScreenRotationX"; }
virtual std::string SequenceMenuName() const { return "Screen rotate X"; }
virtual QString SequenceMenuName() const;
virtual QPixmap Pixmap();
};
......@@ -93,7 +95,7 @@ public:
virtual MovieSequence *NewInstance() const { return new MovieSequenceScreenRotationY; }
virtual int SequenceId() const { return 301; }
virtual std::string SequenceName() const { return "ScreenRotationY"; }
virtual std::string SequenceMenuName() const { return "Screen rotate Y"; }
virtual QString SequenceMenuName() const;
virtual QPixmap Pixmap();
};
......@@ -105,8 +107,8 @@ public:
virtual MovieSequence *NewInstance() const { return new MovieSequenceScreenRotationZ; }
virtual int SequenceId() const { return 302; }
virtual std::string SequenceName() const { return "RotationZ"; }
virtual std::string SequenceMenuName() const { return "Screen rotate Z"; }
virtual std::string SequenceName() const { return "ScreenRotationZ"; }
virtual QString SequenceMenuName() const;
virtual QPixmap Pixmap();
};
......@@ -120,7 +122,7 @@ public:
virtual MovieSequence *NewInstance() const { return new MovieSequenceRotationX; }
virtual int SequenceId() const { return 303; }
virtual std::string SequenceName() const { return "RotationX"; }
virtual std::string SequenceMenuName() const { return "Rotate X"; }
virtual QString SequenceMenuName() const;
virtual QPixmap Pixmap();
};
......@@ -133,7 +135,7 @@ public:
virtual MovieSequence *NewInstance() const { return new MovieSequenceRotationY; }
virtual int SequenceId() const { return 304; }
virtual std::string SequenceName() const { return "RotationY"; }
virtual std::string SequenceMenuName() const { return "Rotate Y"; }
virtual QString SequenceMenuName() const;
virtual QPixmap Pixmap();
};
......@@ -146,7 +148,7 @@ public:
virtual MovieSequence *NewInstance() const { return new MovieSequenceRotationZ; }
virtual int SequenceId() const { return 305; }
virtual std::string SequenceName() const { return "RotationZ"; }
virtual std::string SequenceMenuName() const { return "Rotate Z"; }
virtual QString SequenceMenuName() const;
virtual QPixmap Pixmap();
};
......
......@@ -141,13 +141,15 @@ MovieSequenceScripting::SequenceName() const
// Creation: Tue Nov 14 10:18:48 PDT 2006
//
// Modifications:
//
// Brad Whitlock, Tue Apr 8 09:15:37 PDT 2008
// Use tr() and return QString.
//
// ****************************************************************************
std::string
QString
MovieSequenceScripting::SequenceMenuName() const
{
return "Scripting";
return tr("Scripting");
}
//
......
......@@ -51,7 +51,9 @@
// Creation: Tue Nov 14 10:21:10 PDT 2006
//
// Modifications:
//
// Brad Whitlock, Tue Apr 8 09:15:10 PDT 2008
// Made SequenceMenuName return QString.
//
// ****************************************************************************
class MovieSequenceScripting : public MovieSequence
......@@ -71,7 +73,7 @@ public:
virtual std::string SequenceName() const;
// Returns the name of the sequence as it will appear in menus.
virtual std::string SequenceMenuName() const;
virtual QString SequenceMenuName() const;
virtual bool ProvidesMenu() const;
......
......@@ -104,14 +104,16 @@ MovieSequenceTransition::~MovieSequenceTransition()
// Creation: Tue Nov 14 10:40:11 PDT 2006
//
// Modifications:
//
// Brad Whitlock, Tue Apr 8 10:34:53 PDT 2008
// SequenceMenuName now returns QString.
//
// ****************************************************************************
QWidget *
MovieSequenceTransition::CreateUI()
{
QvisSequenceTransition *ui = new QvisSequenceTransition(Pixmap(), 0, GetName().c_str());
ui->setTitle(SequenceMenuName().c_str());
ui->setTitle(SequenceMenuName());
return ui;
}
......@@ -265,69 +267,164 @@ MovieSequenceFade::Pixmap()
return QPixmap(ms_fade_xpm);
}
QString
MovieSequenceFade::SequenceMenuName() const
{
return tr("Fade");
}
////////////////////////////////////////////////////////////////////////////////
QPixmap
MovieSequenceLRWipe::Pixmap()
{
return QPixmap(ms_lr_wipe_xpm);
}
QString
MovieSequenceLRWipe::SequenceMenuName() const
{
return tr("Wipe left to right");
}
////////////////////////////////////////////////////////////////////////////////
QPixmap
MovieSequenceRLWipe::Pixmap()
{
return QPixmap(ms_rl_wipe_xpm);
}
QString
MovieSequenceRLWipe::SequenceMenuName() const
{
return tr("Wipe left to right");
}
////////////////////////////////////////////////////////////////////////////////
QPixmap
MovieSequenceTBWipe::Pixmap()
{
return QPixmap(ms_tb_wipe_xpm);
}
QString
MovieSequenceTBWipe::SequenceMenuName() const
{
return tr("Wipe top to bottom");
}
////////////////////////////////////////////////////////////////////////////////
QPixmap
MovieSequenceBTWipe::Pixmap()
{
return QPixmap(ms_bt_wipe_xpm);
}
QString
MovieSequenceBTWipe::SequenceMenuName() const
{
return tr("Wipe bottom to top");
}
////////////////////////////////////////////////////////////////////////////////
QPixmap
MovieSequenceLRSlide::Pixmap()
{
return QPixmap(ms_lr_slide_xpm);
}
QString
MovieSequenceLRSlide::SequenceMenuName() const
{
return tr("Slide left to right");
}
////////////////////////////////////////////////////////////////////////////////
QPixmap
MovieSequenceRLSlide::Pixmap()
{