How to translate text on buttons of QDialogButtonBox
-
Hi
Is it possible to translate text of buttons of a QDialogButtonBox widget? How?
They don't appear in the Qt Linguist :-( -
you can load you language translation from: /usr/share/qt4/translations/qt_[your-language].qm
-
It seems that there is no translation for Persian yet. Can I add my own translation?
-
in the installation, you have the ts files and the qm files, so you can :-)
You could also put that back to qt on git by merge request. -
bq. in the installation, you have the ts files and the qm files, so you can :-)
You could also put that back to qt on git by merge request.Could you explain more please? There is no .ts file in my /usr/share/qt4/. I've been installed Qt SDK 1.1.1. there isn't .ts files too.
And where is git repository of that translations? I'll be happy to add Persian translation of Qt (if there is not any).
-
You will have to call lupdate, grab the .ts files, translate it using Qt Linguist and create the .qm files with lrelease. It's the same way as you would translate a regular app. Then load the new .qm file in your application.
-
bq. You will have to call lupdate, grab the .ts files, translate it using Qt Linguist and create the .qm files with lrelease. It’s the same way as you would translate a regular app. Then load the new .qm file in your application.
Translate what?
Sorry for my stupid questions but I'm really confused! As far as I know lupdate receives a .pro file, containing TRANSLATIONS += <lang>.ts to generate .ts files. So, what should I pass to lupdate to get translation files of Qt itself (probably containing titles of QDialogButtonBox) ? -
translate Qt - or the parts you need.
-
Ok, I found that there is no ts file in Qt distribution. they are just in source code. (you didn't tell me this!) Now I have a new problem :-x ! ts files are not editable. I guess thats because there is no <location> after each <message> in declaration. so lupdate translations.pro in the /translations directory, results
@Updating 'qt_<some language>.ts'...
Found 0 source text(s) (0 new and 0 already existing)@
for all existing translations. But it's possible to release them...Please tell me what I exactly should do to translate Qt to my language?
-
While I think that creating a Persian translation of Qt is a Good Thing(TM), if all you want is some translated buttons in your dialog, perhaps there is an easier way. You can just set the text for the buttons yourself (QDialogButtonBox::button() returns a pointer to the button), and use setText() on that button yourself.
-
[quote author="soroush" date="1307558155"]bq. in the installation, you have the ts files and the qm files, so you can :-)
You could also put that back to qt on git by merge request.Could you explain more please? There is no .ts file in my /usr/share/qt4/. I've been installed Qt SDK 1.1.1. there isn't .ts files too.
And where is git repository of that translations? I'll be happy to add Persian translation of Qt (if there is not any). [/quote]
You have to install the sources with the SDK maintanence tool (it's available on wiondows, I hope also on linux with the SDK). Then you find <SDK Dir>\QtSources\4.7.3\translations and there are the ts files
To see, how to add new translations to qt, have a look at the link for "contribute":http://developer.qt.nokia.com/contribute
-
bq. You have to install the sources with the SDK maintanence tool (it’s available on wiondows, I hope also on linux with the SDK). Then you find <SDK Dir>\QtSources\4.7.3\translations and there are the ts files
To see, how to add new translations to qt, have a look at the link for contribute [developer.qt.nokia.com]I'm unable to translate Qt ! ....
I followed "this instructions":http://developer.qt.nokia.com/wiki/Qt_Localization bun they don't work. make ts-<lang> does not worked for any language.
I have ts files in source directory when I open one of them with Qt Linguist, translations are not editable. calling `lupdate translations.pro' output is something like this for all of them:
@Updating 'qt_<some language>.ts'...
Found 0 source text(s) (0 new and 0 already existing)@
also lrelease generates .qm files.I guess it's because of there is no <location> tag in ts files. there should be somewhere to add real sources for translations. I looked at translations.pro there are some variables unset:
@TEMPLATE = app
TARGET = qm_phony_target
CONFIG -= qt separate_debug_info sis_targets
CONFIG += no_icon
QT =
LIBS =@Try to add paths of Qt objects and sources but not worked. ...
-
I've got the same problem.
@Updating 'qt_<some language>.ts'...
Found 0 source text(s) (0 new and 0 already existing @
what can be the reason that blank file is created without any data? -
i have also problem in language change i am not getting how to write code for language change in Qt5 c++, how to start this code process of language change..please help me.