[SOLVED] Ok and Cancel buttons localization
-
I use russian and ukranian tr files to change language in my program, it all works fine but standard buttons such as Ok and Cancel or Apply don't change it's displayname. Is there any solution to translate standard buttons too ?
-
You will have to provide translations for "Qt itself":http://doc.qt.nokia.com/4.7-snapshot/internationalization.html#produce-translations as well.
[quote]Qt itself contains over 400 strings that will also need to be translated into the languages that you are targeting. You will find translation files for French, German and Simplified Chinese in $QTDIR/translations, as well as a template for translating to other languages. (This directory also contains some additional unsupported translations which may be useful.)[/quote] -
Note that these translations come with Qt. You need to add the shipped translation files to your program's translator. Look at the chapter "Produce Translations" in the Internationalization with Qt document.
-
I tried to do like here: "":http://qt-project.org/faq/answer/how_can_i_translate_the_ok_and_cancel_buttons_when_using_the_static_qmessag
I add qt_ru.ts file to my project in Visual Studio ad than go to main.cpp and write following:
@QTranslator trans(0);
trans.load("sxConfigAssc_ru", ".");
QTranslator trans2(0);
trans2.load("qt_ru", ".");
a.installTranslator(&trans);
a.installTranslator(&trans2);@But I don't know where I need to put:
TEMPLATE = app
SOURCES += main.cpp
TRANSLATIONS = t1_fr.ts qt_fr.ts
CONFIG += consoleBecause I can't find any *.pro file in my Visual Studio solution. (I'm using qt 4.8.1 and vs-addin)
-
I forgot to add *.qm file to my solution now after added it all work OK.
-
As far as I can tell, standard buttons are translated in the context QPlatformTheme, which is missing in many of the qt_xx.ts files, with the exception of ru, ja, de, and a few others.