Important: Please read the Qt Code of Conduct -

Language transulation

  • I am beginner to Qt5.1.0.mingw48_32 .I am writing in Qt5 creator c++ GUI programming. i dont know about QtQML. Can any one tell how to change input string(in English) which has taken from "Qline edit" and translate that into another language(to Hindi and tamil) and write that on "QLabel" .I studied all links by Qt but i could not get the solution .How to start that process of programming to convert input string from one language to another language? please help me .

  • Moderators

    Hi, welcome to devnet.

    Please refer to the "Developers": section of the "Qt Linguist": manual.
    There's a step by step introduction to the topic.

  • Google translate and Bing (possibly others) have APIs.

    Do a google search for "Google translate API" or "Bing translate API".

  • Thnks for reply...There all telling .ts files and send to Qt Linguist .When i am trying i cant get my language and that i have to enter my language and save.How can i get my text transulate with out entering my local text again? pleas help me i am new to Qt5.

  • please Can you provide any sample code with explination. thnks in regards .

  • Moderators

    Yeah, sorry, I misread your question. I thought you wanted to provide multi-lingual ui but what you seem to need is a basic translator app.

    Qt is not a translation library so there's no such functionality in it.
    As ScottR suggested you should use some other service for this.

    In pseudocode this would be something like this:
    QString textToTranslate = ui.yourLineEdit->text();
    QString translatedText = WhateverTranslationLibraryFunction(textToTranslate, "language A", "language B");

    But again, this has little to do with Qt.

  • Thnks for reply @chris kawa. i understood what u told.but while i am studying documentation diffrent people telling diffrent things for language changing.
    please can you please explain WhateverTranslationLibraryFunction(textToTranslate, "language A", "language B");
    this line. i am not geting this.please dont mind for my simple questions .i am now lerning Qt.

  • Moderators

    It doesn't matter that you're new to Qt because this is not a Qt question.
    The only Qt part is getting the text from ui and setting it back, which I showed.

    As for the translation itself you will need to employ some other library. The line with WhateverTranslationLibraryFunction is just a placeholder. It will be totally different depending on what library you actually use.

Log in to reply