pe-bear icon indicating copy to clipboard operation
pe-bear copied to clipboard

Interface multilingual support function.

Open fairycn opened this issue 3 years ago • 3 comments

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.

fairycn avatar Oct 13 '21 03:10 fairycn

Hi! This is a great idea! I will soon add the support, and appreciate your contribution in this!

hasherezade avatar Oct 13 '21 06:10 hasherezade

@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>

image Citing Language Documents

	QApplication a(argc, argv);
	QTranslator translator; 
	if (translator.load("My.qm")) 
	{
		a.installTranslator(&translator); 
	}

image

  • MainWindow.cpp Add header file image

Translation String Test image

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

image

Problem, the test code has other tr function strings, I'm avoiding errors here without translating the test image

Load Language File Effect

image

image

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.

fairycn avatar Sep 18 '23 07:09 fairycn

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. image

fairycn avatar Sep 22 '23 04:09 fairycn