tr() not working only for three strings
-
I am adding localization support to my application (QtWidgets). Everything is working out of the box, except for these three lines. This snippet is from my dialog constructor and all the other lines in the dialog are being translated correctly.
// WORKING ui->minimizeAction->addItem(tr("Minimize to system tray"), QVariant::fromValue(Settings::Action::MinimizeToSystemTray)); ui->minimizeAction->addItem(tr("Minimize to taskbar"), QVariant::fromValue(Settings::Action::MinimizeToTaskbar)); // NOT WORKING ui->downloadLocation->addItem(tr("Default (%1)").arg(QWebEngineProfile::defaultProfile()->downloadPath())); ui->downloadLocation->addItem(tr("Ask everytime")); ui->downloadLocation->addItem(tr("Custom"));
There are also another
tr("Custom (%1)")
that isn't getting translated. It's like every string that goes inside thedownloadLocation
combobox isn't getting translated, despite it being no different than the other comboboxes in the app. I've tried cleaning, rebuilding, verifying the .ts file manually, but with no results. Could someone please help me? -
Are you sure you don't fill the combobox somewhere else again or calling a retranslateUi somewhere? Strip down your code until they get translated.
-
@Christian-Ehrlicher The combobox is updated by some signal handlers, but not without user interaction, and even there the strings should be localized.
However, I've noticed that the issue happens on Manjaro Linux with Qt6.4.0 installed from the repos. Tried building on macOS with manually downloaded Qt6.4.1 and the strings are being translated correctly. Will try on Windows as soon as I can. Could it be some oscure bug of 6.4.0 or Linux platform? There don't seem to be differences between the compiled .qm files on both platforms