Important: Please read the Qt Code of Conduct -

How do i set context menu language?

  • I have a small application with few text fields (QLineEdit) and want to set context menu for them. I have already set default context menu (undo, copy, paste etc.) but i want it in my language (Slovak). Is there some way how to set language for it, change whats in menu or at least overwrite original file where it is set? I have Qt 4.8.0, Qt Creator 2.4.1 and Ubuntu 12.04 if it affect something.

  • As always, install the translator using QApplication::installTranslator();

    Of course, when you create your context menu, you'll have to use tr(), like myMenu->addAction(tr("Copy")) instead of just myMenu->addAction("Copy"), in order to make them translatable. And then you will also have to translate the new strings in your TS/QM file. And: Don't forget to re-translate after installing a new translator!

Log in to reply