Results 1 to 1 of 1

Thread: Translation problem

  1. #1
    Join Date
    Apr 2012
    Posts
    43
    Thanks
    4
    Thanked 1 Time in 1 Post

    Default Re: Translation problem

    Hi, I have this problem. I need to add translations to my application, but I never worked with it and so I really dont know what im doing wrong. Can some kind soul help me? I have main.cpp:

    #include <QtGui/QApplication>
    #include "mainwindow.h"

    int main(int argc, char *argv[])
    {
    QApplication a(argc, argv);

    QTranslator qtTranslator;
    qtTranslator.load("project_eng");
    a.installTranslator(&qtTranslator);

    MainWindow w;
    w.show();

    return a.exec();
    }





    mainwindow.cpp:
    <code>
    #include "mainwindow.h"

    MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    {
    QLabel *label = new QLabel(this);
    label->setText(tr("Hello world"));
    this->setCentralWidget(label);
    }

    MainWindow::~MainWindow()
    {

    }




    and project.pro:
    QT += core gui

    TARGET = project
    TEMPLATE = app


    SOURCES += main.cpp\
    mainwindow.cpp

    HEADERS += mainwindow.h

    TRANSLATIONS += project_eng.ts


    I have created ts file with lupdate project.pro, translated text with linguist, called lrelease project.pro which said "Generated 1 translation(s) (1 finished and 0 unfinished)" but when I run my app i still get "Hello world" and not my translation. What Im doing wrong?


    Added after 32 minutes:


    Ok, problem solved, I was doing shadow build into different folder which didnt contain translation file.
    Last edited by Raadush; 9th May 2012 at 11:43.

Similar Threads

  1. Again a problem with Translation
    By franco.amato in forum Newbie
    Replies: 11
    Last Post: 25th October 2010, 20:26
  2. Translation problem while scaling an object
    By qlands in forum Qt Programming
    Replies: 0
    Last Post: 4th October 2010, 13:04
  3. QFileDialog/ QMessageBox's Button Translation problem
    By santosh.kumar in forum Qt Programming
    Replies: 6
    Last Post: 10th August 2009, 08:07
  4. problem with Translation
    By #andi# in forum Newbie
    Replies: 1
    Last Post: 9th August 2009, 16:14
  5. Problem with dynamic translation
    By keo in forum Qt Programming
    Replies: 2
    Last Post: 29th July 2009, 11:36

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.