first release of translation facility
* runtime - loading and translating * design-time - works with *.ts file (pip_tr utility) * compile-time - CMake macro for compile *.ts
This commit is contained in:
@@ -23,6 +23,7 @@
|
||||
#include "piiostream.h"
|
||||
#include "piliterals_time.h"
|
||||
#include "pitime.h"
|
||||
#include "pitranslator.h"
|
||||
|
||||
/** \class PIConnection
|
||||
* \brief Complex Input/Output point
|
||||
@@ -142,7 +143,7 @@ bool PIConnection::configure(PIConfig & conf, const PIString & name_) {
|
||||
// piCout << name_list << flt_list << chk_set;
|
||||
chk_set.remove("");
|
||||
if (!chk_set.isEmpty()) {
|
||||
piCoutObj << "Error," << chk_set.toVector() << "names assigned to both devices and filters!";
|
||||
piCoutObj << "Error,"_tr("PIConnection") << chk_set.toVector() << "names assigned to both devices and filters!"_tr("PIConnection");
|
||||
return false;
|
||||
}
|
||||
PIMap<PIString, PIString> dev_aliases;
|
||||
@@ -238,7 +239,7 @@ bool PIConnection::configure(PIConfig & conf, const PIString & name_) {
|
||||
}
|
||||
setDebug(pdebug);
|
||||
for (const PIString & f: filter_fails) {
|
||||
piCoutObj << "\"addFilter\" error: no such device \"" << f << "\"!";
|
||||
piCoutObj << "\"addFilter\" error: no such device \"%1\"!"_tr("PIConnection").arg(f);
|
||||
}
|
||||
for (const PIConfig::Entry * e: cb) {
|
||||
PIString f(e->getValue("from").value()), t(e->getValue("to").value());
|
||||
@@ -469,7 +470,7 @@ PIPacketExtractor * PIConnection::addFilter(const PIString & name_, const PIStri
|
||||
if (extractors.value(full_path, nullptr)) pe = extractors.value(full_path, nullptr)->extractor;
|
||||
if (pe) dev = pe;
|
||||
if (!dev) {
|
||||
piCoutObj << "\"addFilter\" error: no such device or filter \"" << full_path << "\"!";
|
||||
piCoutObj << "\"addFilter\" error: no such device or filter \"%1\"!"_tr("PIConnection").arg(full_path);
|
||||
return nullptr;
|
||||
}
|
||||
if (!e) {
|
||||
@@ -508,7 +509,7 @@ PIPacketExtractor * PIConnection::addFilter(PIPacketExtractor * filter, const PI
|
||||
if (pe) {
|
||||
dev = pe;
|
||||
} else {
|
||||
piCoutObj << "\"addFilter\" error: no such device or filter \"" << full_path << "\"!";
|
||||
piCoutObj << "\"addFilter\" error: no such device or filter \"%1\"!"_tr("PIConnection").arg(full_path);
|
||||
return nullptr;
|
||||
}
|
||||
if (!e) {
|
||||
@@ -739,7 +740,7 @@ void PIConnection::addSender(const PIString & name_, const PIString & full_path_
|
||||
}
|
||||
PIIODevice * dev = devByString(full_path_name);
|
||||
if (!dev) {
|
||||
piCoutObj << "\"addSender\" error: no such device \"" << full_path_name << "\"!";
|
||||
piCoutObj << "\"addSender\" error: no such device \"%1\"!"_tr("PIConnection").arg(full_path_name);
|
||||
return;
|
||||
}
|
||||
if (!s->isRunning() && start_) {
|
||||
@@ -899,7 +900,7 @@ int PIConnection::writeByFullPath(const PIString & full_path, const PIByteArray
|
||||
PIIODevice * dev = __device_pool__->device(fp);
|
||||
// piCout << "SEND" << full_path << fp;
|
||||
if (!dev) {
|
||||
piCoutObj << "No such full path \"" << full_path << "\"!";
|
||||
piCoutObj << "No such full path \"%1\"!"_tr("PIConnection").arg(full_path);
|
||||
return -1;
|
||||
}
|
||||
return write(dev, data);
|
||||
@@ -909,7 +910,7 @@ int PIConnection::writeByFullPath(const PIString & full_path, const PIByteArray
|
||||
int PIConnection::writeByName(const PIString & name_, const PIByteArray & data) {
|
||||
PIIODevice * dev = deviceByName(name_);
|
||||
if (!dev) {
|
||||
piCoutObj << "No such device \"" << name_ << "\"!";
|
||||
piCoutObj << "No such device \"%1\"!"_tr("PIConnection").arg(name_);
|
||||
return -1;
|
||||
}
|
||||
return write(dev, data);
|
||||
@@ -918,12 +919,12 @@ int PIConnection::writeByName(const PIString & name_, const PIByteArray & data)
|
||||
|
||||
int PIConnection::write(PIIODevice * dev, const PIByteArray & data) {
|
||||
if (!dev) {
|
||||
piCoutObj << "Null Device!";
|
||||
piCoutObj << "Null Device!"_tr("PIConnection");
|
||||
return -1;
|
||||
}
|
||||
if (!dev->isOpened()) return -1;
|
||||
if (!dev->canWrite()) {
|
||||
piCoutObj << "Device \"" << dev->constructFullPath() << "\" can`t write!";
|
||||
piCoutObj << "Device \"%1\" can`t write!"_tr("PIConnection").arg(dev->constructFullPath());
|
||||
return -1;
|
||||
}
|
||||
int ret = dev->write(data);
|
||||
@@ -982,7 +983,7 @@ PIIODevice * PIConnection::DevicePool::addDevice(PIConnection * parent, const PI
|
||||
// piCout << "new device" << fp;
|
||||
dd->dev = PIIODevice::createFromFullPath(fp);
|
||||
if (!dd->dev) {
|
||||
piCoutObj << "Error: can`t create device \"" << fp << "\"!"; //:" << errorString();
|
||||
piCoutObj << "Error: can`t create device \"%1\"!"_tr("PIConnection").arg(fp);
|
||||
return nullptr;
|
||||
}
|
||||
dd->dev->setProperty("__fullPath__", fp);
|
||||
@@ -1258,7 +1259,7 @@ void PIConnection::unboundExtractor(PIPacketExtractor * pe) {
|
||||
void PIConnection::packetExtractorReceived(const uchar * data, int size) {
|
||||
PIString from(emitter() ? emitter()->name() : PIString());
|
||||
PIIODevice * cd = (PIIODevice *)emitter();
|
||||
// piCout << "packetExtractorReceived" << from << cd;
|
||||
// piCout << "packetExtractorReceived" << from << cd;
|
||||
if (cd) {
|
||||
PIVector<PIPacketExtractor *> be(bounded_extractors.value(cd));
|
||||
// piCout << be << (void*)data << size;
|
||||
|
||||
Reference in New Issue
Block a user