Index: ../src/helpviewer/main.cpp =================================================================== --- ../src/helpviewer/main.cpp (revision 6700) +++ ../src/helpviewer/main.cpp (arbetskopia) @@ -1,17 +1,56 @@ #include #include #include +#include +#include #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... + QgsApplication::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(); Index: ../src/helpviewer/CMakeLists.txt =================================================================== --- ../src/helpviewer/CMakeLists.txt (revision 6700) +++ ../src/helpviewer/CMakeLists.txt (arbetskopia) @@ -6,6 +6,8 @@ main.cpp qgshelpserver.cpp qgshelpviewer.cpp + ../core/qgsapplication.cpp + ../core/qgslogger.cpp ) SET (HELP_UIS qgshelpviewerbase.ui) @@ -30,6 +32,7 @@ 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} )