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:
Àlex Fiestas 2014-02-28 17:35:51 +01:00
parent 0686374bb5
commit 34bee764e8
2 changed files with 5 additions and 5 deletions

View file

@ -165,8 +165,8 @@ void SftpPlugin::onMounted()
KNotification* notification = new KNotification("mounted", KNotification::CloseOnTimeout, this);
notification->setPixmap(KIconLoader::global()->loadIcon("drive-removable-media", KIconLoader::Desktop));
notification->setComponentData(KComponentData("kdeconnect", "kdeconnect"));
notification->setTitle(i18n("Device %1").arg(device()->name()));
notification->setText(i18n("Filesystem mounted at %1").arg(mountPoint()));
notification->setTitle(i18n("Device %1", device()->name()));
notification->setText(i18n("Filesystem mounted at %1", mountPoint()));
notification->sendEvent();
Q_EMIT mounted();
@ -186,7 +186,7 @@ void SftpPlugin::onUnmounted(bool idleTimeout)
KNotification* notification = new KNotification("unmounted", KNotification::CloseOnTimeout, this);
notification->setPixmap(KIconLoader::global()->loadIcon("dialog-ok", KIconLoader::Desktop));
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->sendEvent();
@ -211,7 +211,7 @@ void SftpPlugin::onFailed(const QString& message)
void SftpPlugin::knotify(int type, const QString& text, const QPixmap& icon) const
{
KNotification::event(KNotification::StandardEvent(type)
, i18n("Device %1").arg(device()->name()), text, icon, 0
, i18n("Device %1", device()->name()), text, icon, 0
, KNotification::CloseOnTimeout);
}

View file

@ -33,7 +33,7 @@ QtObject {
property bool charging: false
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 nested1: DBusAsyncResponse {