Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interface multilingual support function. #7

Open
fairycn opened this issue Oct 13, 2021 · 3 comments
Open

Interface multilingual support function. #7

fairycn opened this issue Oct 13, 2021 · 3 comments
Labels
enhancement New feature or request

Comments

@fairycn
Copy link
Contributor

fairycn commented Oct 13, 2021

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.

@hasherezade
Copy link
Owner

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

@hasherezade hasherezade added the enhancement New feature or request label Oct 13, 2021
@hasherezade hasherezade transferred this issue from hasherezade/pe-bear-releases Oct 13, 2022
@fairycn
Copy link
Contributor Author

fairycn commented Sep 18, 2023

@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
Copy link
Contributor Author

fairycn commented Sep 22, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants