Closed jmlich closed 3 months ago
I believe the daemon doesn't translate strings because it needs own instance of QTranslator, the UI interacts with daemon only via DBUS, hence QTranslator from UI cannot reach those strings at all.
Simply, the ./daemon/src/harbour-amazfish-daemon.cpp needs to use QTranslator same as https://github.com/piggz/harbour-amazfish/blob/1462454cbc9489fead578ccad2ce030c35e0b329/ui/src/harbour-amazfish-ui.cpp#L54-L64 otherwise the translation is not loaded, nor used.
QTranslator
The strings aren't included in ./ui/translations/*.ts and therefore not translated at all.
./ui/translations/*.ts
Namely it is:
jmlich@ubuntu-virt:~/workspace/harbour-amazfish/daemon (master *$=)$ git grep 'tr(' src/codec.h: return what_.c_str(); src/deviceinterface.cpp: message(tr("Device is not valid, it may not be supported")); src/deviceinterface.cpp: sendAlert(tr("Amazfish"), tr("Connected"), tr("Phone and watch are connected"), true); src/deviceinterface.cpp: sendAlert("Amazfish", tr("Low Battery"), tr("Battery level now ") + QString::number(m_lastBatteryLevel) + "%"); src/devices/abstractdevice.cpp: emit message(tr("Device does not support settings")); src/devices/bipdevice.cpp: msg = tr("Navigation Started"); src/devices/bipdevice.cpp: msg = tr("Navigation Stopped"); src/devices/bipdevice.cpp: sendAlert("navigation", tr("Progress") + ":" + QString::number(progress), narrative + "\n" + manDist); src/devices/huamidevice.cpp: msg = tr("Navigation Started"); src/devices/huamidevice.cpp: msg = tr("Navigation Stopped"); src/devices/huamidevice.cpp: sendAlert("navigation", tr("Progress") + ":" + QString::number(progress), narrative + "\n" + manDist); src/operations/abstractfetchoperation.cpp: m_service->message(QObject::tr("About to transfer data from ") + startDate.toString()); src/operations/abstractfetchoperation.cpp: m_service->message(QObject::tr("Finished transferring activity data")); src/operations/abstractfetchoperation.cpp: m_service->message(QObject::tr("No data to transfer")); src/operations/dfuoperation.cpp: m_service->message(QObject::tr("Update operation failed")); src/operations/dfuoperation.cpp: m_service->message(QObject::tr("Update operation failed")); src/operations/dfuoperation.cpp: m_service->message(QObject::tr("Update operation failed, unexpected metadata")); src/operations/huamiupdatefirmwareoperation2020.cpp: m_service->message(QObject::tr("Update operation complete")); src/operations/huamiupdatefirmwareoperation2020.cpp: m_service->message(QObject::tr("Update operation complete")); src/operations/huamiupdatefirmwareoperation2020.cpp: m_service->message(QObject::tr("Update operation failed")); src/operations/huamiupdatefirmwareoperation2020.cpp: m_service->message(QObject::tr("Update operation failed, filetype not supported")); src/operations/huamiupdatefirmwareoperation2020.cpp: m_service->message(QObject::tr("Update operation failed, unexpected metadata")); src/operations/huamiupdatefirmwareoperation2020.cpp: m_service->message(QObject::tr("File does not seem to be supported")); src/operations/updatefirmwareoperation.cpp: m_service->message(QObject::tr("File does not seem to be supported")); src/operations/updatefirmwareoperation.cpp: m_service->message(QObject::tr("Update operation complete")); src/operations/updatefirmwareoperation.cpp: m_service->message(QObject::tr("Update operation failed")); src/operations/updatefirmwareoperation.cpp: m_service->message(QObject::tr("Update operation failed, unexpected metadata")); src/services/bipfirmwareservice.cpp: emit message(tr("An operation is currently running, please try later")); src/services/bipfirmwareservice.cpp: emit message(tr("Sending %1...").arg(m_updateFirmware->version())); src/services/bipfirmwareservice.cpp: emit message(tr("No file selected")); src/services/dfuservice.cpp: emit message(tr("An operation is currently running, please try later")); src/services/dfuservice.cpp: emit message(tr("No file selected")); src/services/mibandservice.cpp: emit message(tr("Firmware is too old to set display items, V0.1.1.14 is required")); src/services/mibandservice.cpp: emit message(tr("Firmware is too old to set display items, V0.1.1.14 is required")); src/services/mibandservice.cpp: emit message(tr("An operation is currently running, please try later")); src/services/mibandservice.cpp: emit message(tr("An operation is currently running, please try later")); src/services/mibandservice.cpp: emit message(tr("An operation is currently running, please try later"));
From history I can see that those strings was included into *.ts files, but there were set as vanished by my commit and removed later.
I believe the daemon doesn't translate strings because it needs own instance of QTranslator, the UI interacts with daemon only via DBUS, hence QTranslator from UI cannot reach those strings at all.
Simply, the ./daemon/src/harbour-amazfish-daemon.cpp needs to use
QTranslator
same as https://github.com/piggz/harbour-amazfish/blob/1462454cbc9489fead578ccad2ce030c35e0b329/ui/src/harbour-amazfish-ui.cpp#L54-L64 otherwise the translation is not loaded, nor used.The strings aren't included in
./ui/translations/*.ts
and therefore not translated at all.Namely it is:
From history I can see that those strings was included into *.ts files, but there were set as vanished by my commit and removed later.