pe-bear
pe-bear copied to clipboard
Interface multilingual support function.
Hello! At present, the software only supports English interface. Can you use the language pack to customize the interface language of the program? If this is considered, I can provide help in simplified Chinese translation.
Hi! This is a great idea! I will soon add the support, and appreciate your contribution in this!
@hasherezade As I don't know how to develop, I searched some articles and changed them to achieve multi-language function, do you see any modification needed?
- main.cpp Add header file
#include <QApplication>
#include <QTranslator>
Citing Language Documents
QApplication a(argc, argv);
QTranslator translator;
if (translator.load("My.qm"))
{
a.installTranslator(&translator);
}
- MainWindow.cpp
Add header file
Translation String Test
Generate translation files
There is no solution for PE-bear to QT to make the QT VS plugin work, use the lupdate command to generate the translation file.
lupdate MainWindow.cpp -ts My.ts
Problem, the test code has other tr function strings, I'm avoiding errors here without translating the test
Load Language File Effect
At present, you can only load the language file by copying it to the program directory, and there is no language switching function written to load the specified language file, but it can be used that you need to download the required language file and change the specified name to load it.
Multilingual functional test version
https://github.com/fairycn/pe-bear/tree/main
- Add the function of loading language files
- In the pe-bear code part, translatable tags are added, and tr () is used.