Skip to content

[FEATURE]: use Qt linguist for translation  #5

@nepvibes

Description

@nepvibes

** Feature Description 【特性详细描述】**

The current default language is set to Chinese.
To make our application more accessible to a wider audience,
we should include a translation system and set English as the default language.
We can use Qt Linguist to create .ts files for translations using lupdate.

QTranslator translator; if (translator.load(QLocale(), "FlowD", "_", ":/translations")) { app.installTranslator(&translator); }

For making strings translatable, we can use the tr function. Here’s an example:

void DownloadItemWidget::onBtnSuspendClicked(bool checked) { if (checked) { ui->btnSuspend->setText(tr("Continue")); /* When the button is checked, change the text to "Continue" TODO: Add logic to resume the download */ } else { ui->btnSuspend->setText(tr("Pause")); /* When the button is unchecked, change the text to "Pause" TODO: Add logic to pause the download */ } }

This setup will ensure that our application supports multiple languages,
with English as the default. The lupdate tool will help generate the .ts files needed for translation.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions