Skip to content
Permalink
Browse files
Added translation support to help viewer
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@7107 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
timlinux committed Jul 27, 2007
1 parent b72201a commit 579e8dbb8f91b5c90de34ce59613877e90a3525b
Showing with 45 additions and 2 deletions.
  1. +4 −0 src/helpviewer/CMakeLists.txt
  2. +41 −2 src/helpviewer/main.cpp
@@ -6,6 +6,8 @@ SET (HELP_SRCS
main.cpp
qgshelpserver.cpp
qgshelpviewer.cpp
../core/qgsapplication.cpp
../core/qgslogger.cpp
)

SET (HELP_UIS qgshelpviewerbase.ui)
@@ -30,13 +32,15 @@ QT4_WRAP_CPP (HELP_MOC_SRCS ${HELP_MOC_HDRS})
ADD_EXECUTABLE (qgis_help MACOSX_BUNDLE ${HELP_SRCS} ${HELP_MOC_SRCS} ${HELP_UIS_H})

INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/../core
${CMAKE_CURRENT_BINARY_DIR}
${SQLITE3_INCLUDE_DIR}
)

TARGET_LINK_LIBRARIES(qgis_help
${QT_LIBRARIES}
${SQLITE3_LIBRARY}
qgis_core
)


@@ -1,17 +1,56 @@
#include <iostream>
#include <qapplication.h>
#include <qgsapplication.h>
#include <qstring.h>
#include <QTextCodec>
#include <QTranslator>
#include "qgshelpserver.h"
#include "qgshelpviewer.h"
#include "qgsapplication.h"

int main( int argc, char ** argv )
{
QApplication a( argc, argv );
QgsApplication a( argc, argv, true );
QString context = QString::null;
QString myTranslationCode="";

if(argc == 2)
{
context = argv[1];
}
#ifdef Q_OS_MACX
// If we're on Mac, we have the resource library way above us...
a.setPkgDataPath(QgsApplication::prefixPath()+"/../../../../share/qgis");
#endif

QString i18nPath = QgsApplication::i18nPath();
if (myTranslationCode.isEmpty())
{
myTranslationCode = QTextCodec::locale();
}
#ifdef QGISDEBUG
std::cout << "Setting translation to "
<< i18nPath.toLocal8Bit().data() << "/qgis_" << myTranslationCode.toLocal8Bit().data() << std::endl;
#endif

/* Translation file for Qt.
* The strings from the QMenuBar context section are used by Qt/Mac to shift
* the About, Preferences and Quit items to the Mac Application menu.
* These items must be translated identically in both qt_ and qgis_ files.
*/
QTranslator qttor(0);
if (qttor.load(QString("qt_") + myTranslationCode, i18nPath))
{
a.installTranslator(&qttor);
}

/* Translation file for QGIS.
*/
QTranslator qgistor(0);
if (qgistor.load(QString("qgis_") + myTranslationCode, i18nPath))
{
a.installTranslator(&qgistor);
}

QgsHelpViewer w(context);
w.show();

0 comments on commit 579e8db

Please sign in to comment.