Make VESC ™ tool in different languages!

you could probably find more help and resources on the VESCtool forums themselves

Navigating that forum is harder than the hedge maze in the shining…

3 Likes

I got QT to spit out a .TS file containing the strings, after translation it’s going to output a .qm file. Not sure how to plug it back in. There are 1300+ strings lol

after spending the whole afternoon translating stuff. here’s the file containing translated strings. i have no clue how to compile the vesc tool…project_cn.qm (105.6 KB)

2 Likes

After finishing the translation and exporting a .em file, I’m facing a big problem.

I got a prompt set up that will let you select language on start-up, buttttttttt I’m unfimiliar with C++ let along Qt.

I can just edit the stings and call it a day but that’ll be a hard fork and I don’t want to start over again with every update.

Now the problem I’m facing is that in the tutorials I’m following it has a.InstallTranslator(&t) where t refers to the translated strings. And in vedder’s main function “a” is not declared where as in the tutorial a is referred to as return “a.exe” or something like that.

So, I’m very stuck and I hope someone on the forum that’s familiar with C++ or Qt can give me some help with it.

2 Likes

Nice work on translating all of that!

Good news and bad news.

The good news is that Vedder wrapped all of the GUI text in Qt with tr() so it could be translated in the future, and the .qm file you provided did exactly that.

The bad news is that all of the settings are firmware version specific, so they are located in the XML files I posted above. They are separate from Qt. The only way to translate that at the moment is to change the text directly in the XML, and that would prevent you from switching between languages, but we could compile a separate English and Chinese version for example.

I’m thinking if we submit these minor code changes and the .qm translation file, that may motivate Vedder to find a way to incorporate the firmware settings into the translation files.

“a” is used in examples to refer to the application itself. In the VESC tool it’s already initialized as an object as qApp so you can just use that instead.

Place this in main.cpp on line 263ish after the fonts

        QStringList languages;
        languages << "English" << "Chinese";

        QString lang = QInputDialog::getItem(NULL,"Select Language",
                                                  "Language",languages);

        QTranslator translator;

        if(lang=="Chinese"){
            translator.load(":/res/translation/language_cn.qm");
        }

        if (lang!="English") {
            qApp->installTranslator(&translator);

        }

in Qt Creator (with Qt version 5, not 6) a new Qt Resource File with the .qm files linked will need to be created for the code above to work.

  • Resources → right click → Add New → Qt → Qt Resource File → “res_translation.qrc”
  • Place .qm file named as “language_cn.qm” in vesc_tool\res\translation
  • Right click res_translations.qrc → add existing files → locate .qm files

Then just set the compiler for release and then hit the green play button and it will compile & run.
You may have to run windeployqt.exe on the compiled exe from the qt/bin directory if you get .dll errors.

vesc_tool_3.00.exe (30.4 MB)

1 Like

I got it running on my Ubuntu VM, getting the same results! Glad the language select function is working properly.

Yeah I gotta go edit the xml files.

I’m wondering if it’ll work in android, most of us here use the android app with a Bluetooth module and I haven’t yet figured out how to compile and test for Android.

Thank you for your help!!

1 Like

I don’t know much about the programming stuff, but I could help with a French translation. I have quite a bit of experience with VESCTool.

2 Likes

That’s great! I’ll send you the files and document on how to do the translation once I get the Chinese sorted out!

1 Like

Hi, I saw that jaykup already add translation option. In case you will need some help I am also C++, Qt developer for Embedded systems.

3 Likes

Addressing the language transcription is a good thing! It has been on the table already.
At them moment the focus is on a release of the new VESC-Tool and once that is done,
finding a good way tot address the languages would be a topic of high interest. I guess that Vedder would like to do this in a way that is sustainable, so that language files can be created and loaded.
I think the the best way to deal with all this stuff is via the VESC-Project forum and GitHub.
@Deodand probably also has an interest and ideas how to add different languages.
But he and Vedder also know that it is not a side job…

Integrating into the official release is the goal, we will submit it to Benjamin once we got it figured out.

currently it just contains a .qm file and about 10 lines of code in main.cpp

Next step is to figure out translation for xml files and how to properly load each language.

And finally how to incorporate it into the current UI.

Once we got a working prototype of sorts, it’ll be easier for vedder to merge it into his main branch.

Thank you! This has really turned into a group effort :rofl:

1 Like

I finally got android setup after a whole lotta trouble. I tried to use some of the code.

QTranslator translator;
translator.load(":/res/translation/language_cn.qm");

But it still just compiled into English version, I thought if I just skip the language selection process it’ll work but guess I’m too naive…

That code will work but you have to execute it at some point.

qApp->installTranslator(&translator);

I noticed that there is a different QApplication object for mobile, which is “a” so you could try that

a->installTranslator(&translator);

It worked! I also found out that inorder to translate the android app I have to edit the .qml files under mobile/resources/qml.qrc/mobile/~

3 Likes

can you help me compile and export an apk file so I can test on my phone?

This thing is using soo old Qt that it is super hard to setup environment to compile it for Android. I will try again today’s evening.

I’ve been trying to set up the environment for 3days now, different qt versions, SDK, NDK, even different Ubuntu versions…

It’s a nightmare