From 1cb1d5f47b8569fa77ce065e4aa9441932b24a70 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Arto=20Hyv=C3=A4ttinen?= Date: Fri, 13 Aug 2010 12:57:09 +0300 Subject: [PATCH] Language settings from LANG enviroment variable (bug #6136) --- src/main.cpp | 8 ++++++-- src/urpomainwindow.cpp | 16 ++++++++++++++-- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index b3d18c3..7dc70d5 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,7 +1,8 @@ #include #include #include "urpomainwindow.h" -#include +#include +#include /*! @mainpage Urpo - Unix Remote Printing Operation @@ -23,7 +24,10 @@ int main(int argc, char *argv[]) QApplication a(argc, argv); QTranslator appTranslator; - appTranslator.load("urpo_" + QLocale::system().name(),":/"); + // using LANG enviroment variable instead of QLocale because of Qt on Maemo problem + // bug #6136 + QString language = std::getenv("LANG"); + appTranslator.load("urpo_" + language.toLower() ,":/"); a.installTranslator(&appTranslator); UrpoMainWindow w; diff --git a/src/urpomainwindow.cpp b/src/urpomainwindow.cpp index b251b8a..40d23fb 100644 --- a/src/urpomainwindow.cpp +++ b/src/urpomainwindow.cpp @@ -36,6 +36,9 @@ #include #include #include + +#include + #include "settingsdialog.h" #define VERSION "0.9" /*! Program version */ @@ -44,6 +47,7 @@ UrpoMainWindow::UrpoMainWindow(QWidget *parent) : QMainWindow(parent) { setWindowTitle(QString("URPO ") + VERSION ); + setWindowIcon( QIcon(":/urpo.png")); // Load connection settings settings_ = new UrpoConnectionSettings("Urpo","Urpo"); @@ -134,14 +138,22 @@ void UrpoMainWindow::initMenu() void UrpoMainWindow::initHelp() { + + // Init help helpBrowser_ = new QTextBrowser(); helpBrowser_->setWindowTitle(tr("Urpo Help")); // Load help file // Try to load locale version index_fi etc. - QString language=QLocale::system().name().left(2); - QString helpfilename = QString(":/help/index_") + language + QString(".html"); + + // using LANG enviroment variable instead of QLocale because of Qt on Maemo problem + // bug #6136 + QString language = std::getenv("LANG"); + + QString helpfilename = QString(":/help/index_") + language.left(2).toLower() + QString(".html"); + + monitor_->debugMessage(helpfilename); QFile helpfile( helpfilename ); if( helpfile.exists() ) -- 1.7.9.5