Listing 3. ljedit.cpp (Internationalized Version)

 1 #include <qapplication.h>
 2 #include <qtranslator.h>
 3 #include <qtextcodec.h>
 4
 5 #include "editor.h"
 6
 7 int main( int argc, char ** argv){
 8     QApplication * app =
 9         new QApplication( argc, argv );
10
11     QTranslator * translator =
12         new QTranslator( 0 );
13     translator->load( QString( "ljedit_" ) +
14         QTextCodec::locale(), "/local/lib" );
15     app->installTranslator( translator );
16
17     Editor * editor = new Editor;
18     editor->show();
19
20     QApplication::connect( app,
21         SIGNAL( lastWindowClosed() ),
22         app, SLOT( quit() ) );
23
24     return app->exec();
25 }