Use i18n properly using arguments rather than replaces
i18n accepts extra arguments to properly perform the replacements of %1 by the proper value, we have to use that instead of calling .arg in the resulting QString so i18n can do some magic for us.
This commit is contained in:
parent
0686374bb5
commit
34bee764e8
2 changed files with 5 additions and 5 deletions
|
@ -165,8 +165,8 @@ void SftpPlugin::onMounted()
|
||||||
KNotification* notification = new KNotification("mounted", KNotification::CloseOnTimeout, this);
|
KNotification* notification = new KNotification("mounted", KNotification::CloseOnTimeout, this);
|
||||||
notification->setPixmap(KIconLoader::global()->loadIcon("drive-removable-media", KIconLoader::Desktop));
|
notification->setPixmap(KIconLoader::global()->loadIcon("drive-removable-media", KIconLoader::Desktop));
|
||||||
notification->setComponentData(KComponentData("kdeconnect", "kdeconnect"));
|
notification->setComponentData(KComponentData("kdeconnect", "kdeconnect"));
|
||||||
notification->setTitle(i18n("Device %1").arg(device()->name()));
|
notification->setTitle(i18n("Device %1", device()->name()));
|
||||||
notification->setText(i18n("Filesystem mounted at %1").arg(mountPoint()));
|
notification->setText(i18n("Filesystem mounted at %1", mountPoint()));
|
||||||
notification->sendEvent();
|
notification->sendEvent();
|
||||||
|
|
||||||
Q_EMIT mounted();
|
Q_EMIT mounted();
|
||||||
|
@ -186,7 +186,7 @@ void SftpPlugin::onUnmounted(bool idleTimeout)
|
||||||
KNotification* notification = new KNotification("unmounted", KNotification::CloseOnTimeout, this);
|
KNotification* notification = new KNotification("unmounted", KNotification::CloseOnTimeout, this);
|
||||||
notification->setPixmap(KIconLoader::global()->loadIcon("dialog-ok", KIconLoader::Desktop));
|
notification->setPixmap(KIconLoader::global()->loadIcon("dialog-ok", KIconLoader::Desktop));
|
||||||
notification->setComponentData(KComponentData("kdeconnect", "kdeconnect"));
|
notification->setComponentData(KComponentData("kdeconnect", "kdeconnect"));
|
||||||
notification->setTitle(i18n("Device %1").arg(device()->name()));
|
notification->setTitle(i18n("Device %1", device()->name()));
|
||||||
notification->setText(i18n("Filesystem unmounted"));
|
notification->setText(i18n("Filesystem unmounted"));
|
||||||
notification->sendEvent();
|
notification->sendEvent();
|
||||||
|
|
||||||
|
@ -211,7 +211,7 @@ void SftpPlugin::onFailed(const QString& message)
|
||||||
void SftpPlugin::knotify(int type, const QString& text, const QPixmap& icon) const
|
void SftpPlugin::knotify(int type, const QString& text, const QPixmap& icon) const
|
||||||
{
|
{
|
||||||
KNotification::event(KNotification::StandardEvent(type)
|
KNotification::event(KNotification::StandardEvent(type)
|
||||||
, i18n("Device %1").arg(device()->name()), text, icon, 0
|
, i18n("Device %1", device()->name()), text, icon, 0
|
||||||
, KNotification::CloseOnTimeout);
|
, KNotification::CloseOnTimeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ QtObject {
|
||||||
|
|
||||||
property bool charging: false
|
property bool charging: false
|
||||||
property int charge: -1
|
property int charge: -1
|
||||||
property string displayString: (available && charge > -1) ? ((charging) ? (i18n("Charging, %1").arg(charge)) : (i18n("Discharging, %1").arg(charge))) : i18n("No info")
|
property string displayString: (available && charge > -1) ? ((charging) ? (i18n("Charging: %1%", charge)) : (i18n("Discharging: %1%", charge))) : i18n("No info")
|
||||||
property variant battery: null
|
property variant battery: null
|
||||||
|
|
||||||
property variant nested1: DBusAsyncResponse {
|
property variant nested1: DBusAsyncResponse {
|
||||||
|
|
Loading…
Reference in a new issue