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

Transfer application with different languages



  • Hello,
    i have build an application with different languages.
    Everything is running well on the PC where I have build that.
    The application is running in an extra directory!
    When i pack this directory and unrar it on an other Pc, i can not switch between the languages any more.
    Which file could be missing? Ihave these dll in my directory:
    ![alt text](list.JPG image url)



  • @Leopold said in Transfer application with different languages:

    with different languages.

    Do you mean translated to different languages, i.e. English, Spanish, German, etc?

    If so, you should have some .qm files created, and you need to copy those files over as well.

    One approach to avoid having separate .qm files around, is to add them to the Qt resource system.



  • Hi Pablo,
    thank you for your answer.
    I had them in an extra directory inside the working directory .Now I have copied them to all the dll`s but no success



  • @Leopold said in Transfer application with different languages:

    I had them in an extra directory inside the working directory

    It's hard to visualize if you don't show the folder structure...

    Anyway, if it's working on your dev machine, please replicate the same folder structure in the other PC. I mean have that "extra directory" in the same relative path to your executable



  • Hi Pablo,
    this is my directory now![alt text](dir.JPG image url)
    and this is my res file![alt text](res.JPG image url)
    no success!



  • @Leopold please stick to one approach at a time, either separate .qm files in the folder or using the resource system.

    this is my directory now!

    Is that the development structure, or the target PC? Please be more specific on your posts, to avoid question after question...

    Let's try the resource system approach once you solved the separate files first (since that's what you have already working on your dev machine)



  • I realised that i Had written language incorrect to the qrc,i have corrected that but no success.
    I will compile new.



  • I have tried a lot of things up to now.
    Last try was the qrc file again.I´m not shure about the prefix.
    Here is what my editor shows:![alt text](Transfile.JPG image url)



  • @Leopold ok, so instead of trying to fix the separate .qm files issue (as you have that working on your dev machine) you moved into the resource system...

    Anyway, so now please show how you're installing the translation given the user selected a new language



  • Hi Pablo,
    this is part of my mainwindow.cpp where I load the qm files. mems-rosco2.2.4 are my sources.Do I have to include a spezial file for use of resources?

    if(translatorFr.load("e:/QT-examples/mems-rosco2.2.4/Transfile_fr.qm"))
          qDebug()<<"successfully load translation_fr file.";
    
      if(translatorGe.load("e:/QT-examples/mems-rosco2.2.4/Transfile_ge.qm"))
          qDebug()<<"successfully load translation_ge file.";
       if(translatorEsp.load("e:/QT-examples/mems-rosco2.2.4/Transfile_esp.qm"))
          qDebug()<<"successfully load translation_esp file.";
    and these are my sources
    ```da----       21.07.2018     14:55                analogwidgets
    d-----       21.07.2018     14:55                bin
    d-----       21.07.2018     14:55                CMakeFiles
    d-----       13.04.2020     16:47                language
    da----       21.07.2018     14:55                qledindicator
    -a----       12.04.2020     10:42           3587 aboutbox.cpp
    -a----       12.04.2020     10:42           1098 aboutbox.h
    -a----       13.04.2020     16:57           9979 CMakeLists.txt
    -a----       13.04.2020     19:25          27069 CMakeLists.txt.user
    -a----       01.07.2018     18:29           2319 cmake_install.cmake
    -a----       20.04.2016     07:47            222 commonunits.h
    -a----       30.06.2018     15:35           3753 CPackConfig.cmake
    -a----       30.06.2018     15:35           4265 CPackSourceConfig.cmake
    -a----       15.05.2016     18:00            456 dialog.h
    -a----       26.02.2018     15:29           3923 dirview.cpp
    -a----       20.03.2018     15:31             87 global.cpp
    -a----       20.03.2018     15:40            158 global.h
    -a----       13.04.2020     16:57           3644 help.html
    -a----       13.04.2020     08:35           3656 help.html.in
    -a----       03.07.2018     07:54             78 help.ts
    -a----       20.04.2016     07:47           1051 helpviewer.cpp
    -a----       20.04.2016     07:47            528 helpviewer.h
    -a----       20.04.2016     07:47           9539 key.png
    -a----       29.12.2015     01:29         120334 libgcc_s_dw2-1.dll
    -a----       13.04.2020     11:17          62592 librosco.dll
    -a----       28.12.2015     23:25        1540622 libstdc++-6.dll
    -a----       29.12.2015     01:29          79360 libwinpthread-1.dll
    -a----       20.04.2016     07:47          33095 LICENSE
    -a----       03.07.2018     07:53             78 license.ts
    -a----       30.06.2018     15:35          33095 LICENSE.TXT
    -a----       01.05.2016     18:55              0 listview.cpp
    -a----       01.05.2016     18:53              0 listview.h
    -a----       02.07.2018     19:48           5734 Lizens.txt
    -a----       22.08.2019     09:15           6526 logger.cpp
    -a----       04.04.2019     19:40            719 logger.h
    -a----       20.05.2018     20:14            200 main.cpp
    -a----       13.04.2020     17:10         474475 mainwindow.cpp
    -a----       13.04.2020     11:38           8045 mainwindow.h
    -a----       13.04.2020     11:45         140849 mainwindow.ui
    -a----       01.07.2018     18:31          24318 Makefile
    -a----       15.08.2017     10:30           2093 manometer.h
    -a----       01.12.2016     13:40         496476 Martin1.txt
    -a----       01.07.2018     18:31          28998 mems-rosco.cbp
    -a----       27.04.2016     17:59             29 memsgauge.includes
    -a----       13.04.2020     11:38          10924 memsinterface.cpp
    -a----       13.04.2020     11:38           3197 memsinterface.h
    -a----       26.02.2018     15:07           2122 mytreewidget.cpp
    -a----       30.03.2018     20:15           1238 mytreewidget.h
    -a----       02.09.2018     18:45           3812 optionsdialog.cpp
    -a----       20.04.2016     07:47           1436 optionsdialog.h
    -a----       15.08.2017     14:12           5093 plotwindow.cpp
    -a----       15.08.2017     13:24           2420 plotwindow.h
    -a----       07.08.1983     02:00           3822 qabstractprintdialog.h
    -a----       01.07.2018     09:20        1118742 qcustomplot.cpp
    -a----       04.09.2017     02:02         266925 qcustomplot.h
    -a----       20.04.2016     07:47           3445 qledindicator.cpp
    -a----       20.04.2016     07:47           2888 qledindicator.h
    -a----       07.08.1983     02:00           3390 qprintdialog.h
    -a----       07.08.1983     02:00          11012 qprinter.h
    -a----       31.03.2018     12:27        5421056 Qt5Core.dll
    -a----       18.01.2017     21:50        5307392 Qt5Gui.dll
    -a----       18.01.2017     21:56        6350848 Qt5Widgets.dll
    -a----       02.07.2018     12:28        1097680 qwindows.dll
    -a----       13.04.2020     08:35           4152 README
    -a----       03.07.2018     07:55             78 readme.ts
    -a----       13.04.2020     08:18           4297 README.TXT
    -a----       13.04.2020     19:24            386 resources.qrc
    -a----       01.09.2017     14:14            178 resources.qrc.depends
    -a----       13.04.2020     10:38          10063 rosco.h
    -a----       20.04.2016     07:47           2991 serialdevenumerator.cpp
    -a----       20.04.2016     07:47            255 serialdevenumerator.h
    -a----       01.07.2018     11:01          58025 Transfile_de.qm
    -a----       01.07.2018     11:01          65063 Transfile_de.ts
    -a----       01.07.2018     10:00          68953 transfile_en.ts
    -a----       01.07.2018     09:56          13793 transfile_encpp.ts
    -a----       01.07.2018     09:56          55272 transfile_enui.ts
    -a----       02.07.2018     19:31          65143 Transfile_esp.qm
    -a----       02.07.2018     19:31          85796 transfile_esp.ts
    -a----       05.07.2018     17:43          63003 Transfile_fr.qm
    -a----       05.07.2018     17:43          85570 transfile_fr.ts
    -a----       03.07.2018     11:02          60281 Transfile_ge.qm
    -a----       03.07.2018     11:01          83643 Transfile_ge.ts
    -a----       10.02.2018     08:52           8537 window.cpp
    -a----       10.02.2018     08:53            899 window.h
    -a----       26.08.2013     02:02         131598 zlib1.dll


  • Hi Pablo,
    i fotgott,
    this is in my cmakelists.txt: qt5_add_resources (RG_RESOURCE resources.qrc)



  • Hi to all,
    i could solve it,
    i included the QTranslator and changed the path to```
    if(translatorFr.load("Transfile_fr.qm"))
    qDebug()<<"successfully load translation_ge file.";
    rest accordingly.
    Thank you for your help.
    Leopold



  • Hi Pablo,
    i forgot to answer.Thank you and yes it is working.I copied the qm files directly to where the source code is.


Log in to reply