View Single Post
marxian's Avatar
Posts: 2,448 | Thanked: 9,523 times | Joined on Aug 2010 @ Wigan, UK
#411
Originally Posted by NightShift79 View Post
seems like I got the translation working somehow.
What I did was:

adding
Code:
#include <QTranslator>

//#ifdef Q_WS_MAEMO_5
//#include <QtOpenGL/QGLWidget>
//#endif

int main(int argc, char *argv[])
{
    QApplication app(argc, argv);
    app.setApplicationName("FMRadio");

    //Added translation:
    QTranslator translator;

    translator.load("/opt/usr/share/qmltube/qml/qmltube/i18n/qml_de");
    app.installTranslator(&translator);
    
    QmlApplicationViewer viewer;
That seems to make qmltube use the german translation file.
But it seems not all parts are correctly translated.
I'll check the linguist files again.

Learning is fun
I did add a few translations of my own using my trusty German dictionary. Also, there were some strings that were not marked for translation in the earlier release.

I haven't used Qt translations before, so I was unaware (until late last night, when I found a Meego Wiki entry) of having to load the translation in the main.cpp file. According to the documentation on QML internationalisation, the QML runtime should find the .qm files automatically, so it seems that they missed out some vital info. :/

Introduction
The QML runtime automatically loads a translation from the i18n subdirectory of the root QML file, based on the system language. The translations are held in QM files that must be generated from TS files.


It should be fairly easy to make translation optional, but it may require a restart of the application for any changes to take effect.
__________________
'Men of high position are allowed, by a special act of grace, to accomodate their reasoning to the answer they need. Logic is only required in those of lesser rank.' - J K Galbraith

My website

GitHub

Last edited by marxian; 2011-04-16 at 11:43.