ADDED basic Qt translation framework
This commit is contained in:
parent
92faefe922
commit
4a61da3136
|
@ -0,0 +1,11 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!DOCTYPE TS><TS version="1.1" language="de_DE">
|
||||||
|
<context>
|
||||||
|
<name>QPushButton</name>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/qt/main.cpp" line="16"/>
|
||||||
|
<source>Hello World!</source>
|
||||||
|
<translation>Hallo Welt!</translation>
|
||||||
|
</message>
|
||||||
|
</context>
|
||||||
|
</TS>
|
|
@ -3,3 +3,4 @@ CONFIG += qt
|
||||||
TARGET = VisualBoyAdvance
|
TARGET = VisualBoyAdvance
|
||||||
HEADERS += ../../src/qt/main.h
|
HEADERS += ../../src/qt/main.h
|
||||||
SOURCES += ../../src/qt/main.cpp
|
SOURCES += ../../src/qt/main.cpp
|
||||||
|
TRANSLATIONS += ../../lang/german.ts
|
||||||
|
|
|
@ -2,13 +2,18 @@
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
#include <QTranslator>
|
||||||
|
|
||||||
|
|
||||||
int main( int argc, char *argv[] )
|
int main( int argc, char *argv[] )
|
||||||
{
|
{
|
||||||
QApplication theApp( argc, argv );
|
QApplication theApp( argc, argv );
|
||||||
|
|
||||||
QPushButton hello( TEST_STRING );
|
QTranslator translator;
|
||||||
|
translator.load( "lang/german" );
|
||||||
|
theApp.installTranslator( &translator );
|
||||||
|
|
||||||
|
QPushButton hello( QPushButton::tr( "Hello World!" ) );
|
||||||
hello.resize( 192, 48 );
|
hello.resize( 192, 48 );
|
||||||
hello.show();
|
hello.show();
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#ifndef MAIN_H
|
#ifndef MAIN_H
|
||||||
#define MAIN_H
|
#define MAIN_H
|
||||||
|
|
||||||
#define TEST_STRING "Hello World!"
|
|
||||||
|
|
||||||
#endif // #ifndef MAIN_H
|
#endif // #ifndef MAIN_H
|
||||||
|
|
Loading…
Reference in New Issue