diff --git a/kcm/Messages.sh b/kcm/Messages.sh new file mode 100755 index 000000000..150dda395 --- /dev/null +++ b/kcm/Messages.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +$EXTRACTRC `find -name '*.ui' -o -name '*.rc'` >> rc.cpp +$XGETTEXT rc.cpp -o $podir/kdeconnect-kcm.pot +rm -f rc.cpp + +#.cpp (-j passed to merge into existing file) +$XGETTEXT `find . -name '*.cpp'` -j -o $podir/kdeconnect-kcm.pot + diff --git a/kcm/kcm.cpp b/kcm/kcm.cpp index 3a65cbe32..6d10fd9d4 100644 --- a/kcm/kcm.cpp +++ b/kcm/kcm.cpp @@ -134,14 +134,14 @@ void KdeConnectKcm::deviceSelected(const QModelIndex& current) kcmUi->verticalLayout_2->addWidget(kcmUi->pluginSelector); kcmUi->name_label->setText(currentDevice->name()); - kcmUi->status_label->setText(currentDevice->isPaired()? "paired" : "unpaired"); + kcmUi->status_label->setText(currentDevice->isPaired()? i18n("(paired)") : i18n("(unpaired)")); KService::List offers = KServiceTypeTrader::self()->query("KdeConnect/Plugin"); QList scriptinfos = KPluginInfo::fromServices(offers); QString path = KStandardDirs().resourceDirs("config").first()+"kdeconnect/"; KSharedConfigPtr deviceConfig = KSharedConfig::openConfig(path + currentDevice->id()); - kcmUi->pluginSelector->addPlugins(scriptinfos, KPluginSelector::ReadConfigFile, "Plugins", QString(), deviceConfig); + kcmUi->pluginSelector->addPlugins(scriptinfos, KPluginSelector::ReadConfigFile, i18n("Plugins"), QString(), deviceConfig); connect(kcmUi->pluginSelector, SIGNAL(changed(bool)), this, SLOT(pluginsConfigChanged())); @@ -176,14 +176,14 @@ void KdeConnectKcm::unpair() currentDevice->unpair(); - kcmUi->status_label->setText("(unpaired)"); + kcmUi->status_label->setText(i18n("(unpaired)")); devicesModel->deviceStatusChanged(currentDevice->id()); } void KdeConnectKcm::pairingFailed(const QString& error) { - kcmUi->messages->setText("Error trying to pair: "+error); + kcmUi->messages->setText(i18n("Error trying to pair: %1",error)); kcmUi->messages->animatedShow(); kcmUi->progressBar->setVisible(false); kcmUi->pair_button->setVisible(true); @@ -196,7 +196,7 @@ void KdeConnectKcm::pairingSuccesful() kcmUi->pair_button->setVisible(false); kcmUi->ping_button->setVisible(true); - kcmUi->status_label->setText("(paired)"); + kcmUi->status_label->setText(i18n("(paired)")); devicesModel->deviceStatusChanged(currentDevice->id()); } diff --git a/kded/Messages.sh b/kded/Messages.sh new file mode 100755 index 000000000..c3167098b --- /dev/null +++ b/kded/Messages.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +$XGETTEXT `find . -name '*.cpp'` -o $podir/kdeconnect-kded.pot + +#.desktop and .notifyrc files doesn't need to be included here diff --git a/kded/device.cpp b/kded/device.cpp index e9e5df8c6..5b90dbda4 100644 --- a/kded/device.cpp +++ b/kded/device.cpp @@ -185,7 +185,7 @@ void Device::pairingTimeout() np.set("pair", false); sendPackage(np); m_pairStatus = Device::NotPaired; - Q_EMIT pairingFailed("Timed out"); + Q_EMIT pairingFailed(i18n("Timed out")); } static bool lessThan(DeviceLink* p1, DeviceLink* p2) diff --git a/kded/plugins/battery/batteryplugin.cpp b/kded/plugins/battery/batteryplugin.cpp index 203da257a..57bb2a64a 100644 --- a/kded/plugins/battery/batteryplugin.cpp +++ b/kded/plugins/battery/batteryplugin.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include "batterydbusinterface.h" @@ -72,8 +73,8 @@ bool BatteryPlugin::receivePackage(const NetworkPackage& np) KNotification* notification = new KNotification("batteryLow"); notification->setPixmap(KIcon("battery-040").pixmap(48, 48)); notification->setComponentData(KComponentData("kdeconnect", "kdeconnect")); - notification->setTitle(device()->name() + ": low battery"); - notification->setText("Battery at 14%"); + notification->setTitle(i18nc("device name: low battery", "%1: low battery",device()->name())); + notification->setText(i18n("Battery at 14%")); notification->sendEvent(); } diff --git a/kded/plugins/ping/pingplugin.cpp b/kded/plugins/ping/pingplugin.cpp index 8d9b856c1..6bc7d3f6b 100644 --- a/kded/plugins/ping/pingplugin.cpp +++ b/kded/plugins/ping/pingplugin.cpp @@ -20,9 +20,11 @@ #include "pingplugin.h" +#include + #include #include -#include +#include K_PLUGIN_FACTORY( KdeConnectPluginFactory, registerPlugin< PingPlugin >(); ) K_EXPORT_PLUGIN( KdeConnectPluginFactory("kdeconnect_ping", "kdeconnect_ping") ) @@ -47,7 +49,7 @@ bool PingPlugin::receivePackage(const NetworkPackage& np) notification->setPixmap(KIcon("dialog-ok").pixmap(48, 48)); notification->setComponentData(KComponentData("kdeconnect", "kdeconnect")); notification->setTitle(device()->name()); - notification->setText(np.get("message","Ping!")); + notification->setText(np.get("message",i18n("Ping!"))); notification->sendEvent(); return true; diff --git a/kded/plugins/telephony/telephonyplugin.cpp b/kded/plugins/telephony/telephonyplugin.cpp index 9be7f20e8..ecc2b7161 100644 --- a/kded/plugins/telephony/telephonyplugin.cpp +++ b/kded/plugins/telephony/telephonyplugin.cpp @@ -21,7 +21,9 @@ #include "telephonyplugin.h" #include -#include + +#include +#include K_PLUGIN_FACTORY( KdeConnectPluginFactory, registerPlugin< TelephonyPlugin >(); ) K_EXPORT_PLUGIN( KdeConnectPluginFactory("kdeconnect_telephony", "kdeconnect_telephony") ) @@ -36,6 +38,7 @@ KNotification* TelephonyPlugin::createNotification(const NetworkPackage& np) { QString event = np.get("event"); + QString phoneNumber = np.get("phoneNumber", i18n("unknown number")); QString title, content, type, icon; @@ -44,25 +47,23 @@ KNotification* TelephonyPlugin::createNotification(const NetworkPackage& np) if (event == "ringing") { type = "callReceived"; icon = "call-start"; - content = "Incoming call from " + np.get("phoneNumber","unknown number"); + content = i18n("Incoming call from %1", phoneNumber); } else if (event == "missedCall") { type = "missedCall"; icon = "call-start"; - content = "Missed call from " + np.get("phoneNumber","unknown number"); + content = i18n("Missed call from %1", phoneNumber); } else if (event == "sms") { type = "smsReceived"; icon = "mail-receive"; - content = "SMS from " - + np.get("phoneNumber","unknown number") - + ":\n" - + np.get("messageBody",""); + QString content = np.get("messageBody",""); + content = i18n("SMS from %1: %2", phoneNumber, content); } else if (event == "talking") { return NULL; } else { //TODO: return NULL if !debug type = "unknownEvent"; icon = "pda"; - content = "Unknown telephony event: " + event; + content = i18n("Unknown telephony event: %2", event); } qDebug() << "Creating notification with type:" << type; diff --git a/plasmoid/Messages.sh b/plasmoid/Messages.sh new file mode 100755 index 000000000..899d56aa8 --- /dev/null +++ b/plasmoid/Messages.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +#.qml +$XGETTEXT `find package -name '*.qml'` -L Java -o $podir/kdeconnect-plasmoid.pot + +#.ui (-j passed to merge into existing file) +$EXTRACTRC `find -name '*.ui' -o -name '*.rc'` >> rc.cpp +$XGETTEXT rc.cpp -o -j $podir/kdeconnect-plasmoid.pot +rm -f rc.cpp + +