PDA

View Full Version : language in library



BalaQT
5th March 2011, 19:36
hi,
im using qt in debian. im creating a custom widget for using inside qtcreator. i want to give some language settings in my custom widget.
i tried the following ,
in plugin class, i added


myTablePlugin::myTablePlugin( QObject* parent )
: QObject(parent) {
QTranslator *translator = new QTranslator(this);
QVariant v=translator->load(":/myLang.qm");
qApp->installTranslator(translator);
}

after this, i created the .so file and copied to qt/bin/designer folder.
when i drag n drop my widget , In the user application , I can able to see the caption in local language.

but after running the application i cant able to see the language. i can see only the english captin.

pls guide me, how to set the language in plugin

pls guide me,
Bala

wysota
6th March 2011, 08:28
The resouce is embedded in the plugin binary but the final application does not link with the plugin but rather with the widget code directly so the resource is not there. Forcing the translator like that is a bad idea. Instead deploy the message catalog as a separate file and let your users install the translator themselves should they wish to do it.

BalaQT
7th March 2011, 10:51
Thanks master for ur time and answer. will try as you said. Will get back to you soon.

Thanks
Bala