Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Localization



  • Hi All,
    As I am new to localization part of Qt, can anyone please help me to understand how we can pass QSettings values that stored in .ini file to .java file (android.app.Activity) of Qt Android application.

    Thanks in Advance


  • Lifetime Qt Champion

    Hi,

    Can you explain exactly what you are trying to achieve ?



  • I don't know, what dsba wanted to achieve, but I have barely the same question.

    I want to create an app with several screens.
    I thought it would be cool to give the user the possibility to switch between 2-3 languages at certain spots (when it makes sense).
    It's not a very word-heavy application, but I think it's a neat benefit.

    So I thought of a button, which opens a popup where the user can select... let's say "German, Dutch, English".
    I've got a couple of questions (because there's almost no video about this topic)... I think one should provide a JSON File (?) with keys.. in the respective language.
    ... right so far?

    And then I need to specify these localizations in the text properties of the text areas etc.

    Now I need a kind of "language switcher" that determine which part of the JSON file is used... easy so far?

    Are there any tutorials out there regarding this topic?


  • Lifetime Qt Champion

    And why you don't use the normal Qt translation system?



  • @Christian-Ehrlicher Holy moly :D
    This is a pretty huge topic.
    To be honest... this is more a nice-to-have thing. I'm currently learning QtQuick / QML and consider myself a "not-so-beginner-yet-far-from-intermediate" guy... at least what I saw so far in those "intermediate" Tutorials out there ;) I'm doing this mostly for "portfolio reason".
    But thanks for the link and the suggestion anyway. I'll see if I find the time to wrap my head around this.



  • @Meistermosher If you want to enable translation down the line, at the very minimum use tr() every time you define a string in c++ and qsTr() every time you define a string in QML.

    https://doc.qt.io/qt-5/i18n-source-translation.html

    The bottom line is that you will run the qt translation tool, it will know the strings defined in those calls and allow you to swap out the text for them in your desired translation (you need to give it the translated text manually). Its actually not that complicated. I would suggest while you are learning to code and use the framework, just use tr() and qsTr(), and worry about translation after the fact (thats what the translation system is made for).


  • Banned

    This post is deleted!

Log in to reply