imagewriter: Use QCoreApplication::translate

tr() is not safe for strings that you move between contexts,
as it fails to provide a mechanism for specifying the context
of the string.

Regenerate the translation files, and use QCoreApplication to locate
the real translations.

Additionally, bodge a race condition between translator replacement
and OS list fetching, by marking the OS list as something to be
re-calculated on a translator change.

Fixes #799
This commit is contained in:
Tom Dewey 2024-02-06 12:17:33 +00:00 committed by Tom Dewey
parent 1c9c641924
commit 38ea837ba7
18 changed files with 2272 additions and 2198 deletions

View file

@ -608,15 +608,15 @@ QByteArray ImageWriter::getFilteredOSlist() {
}
reference_os_list_array.append(QJsonObject({
{"name", tr("Erase")},
{"description", tr("Format card as FAT32")},
{"name", QApplication::translate("main", "Erase")},
{"description", QApplication::translate("main", "Format card as FAT32")},
{"icon", "icons/erase.png"},
{"url", "internal://format"},
}));
reference_os_list_array.append(QJsonObject({
{"name", tr("Use custom")},
{"description", tr("Select a custom .img from your computer")},
{"name", QApplication::translate("main", "Use custom")},
{"description", QApplication::translate("main", "Select a custom .img from your computer")},
{"icon", "icons/use_custom.png"},
{"url", ""},
}));
@ -1377,6 +1377,9 @@ void ImageWriter::replaceTranslator(QTranslator *trans)
{
_engine->retranslate();
}
// Regenerate the OS list, because it has some localised items
emit osListPrepared();
}
QString ImageWriter::detectPiKeyboard()