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:
2024-11-05 13:49:00 +03:00
parent 73ed51e3d4
commit 57f8c1313e
52 changed files with 1571 additions and 480 deletions

View File

@@ -18,6 +18,8 @@
*/
#include "picompress.h"
#include "pitranslator.h"
#ifdef PIP_COMPRESS
# ifdef ESP_PLATFORM
# include "esp32/rom/miniz.h"
@@ -39,7 +41,7 @@ PIByteArray piCompress(const PIByteArray & ba, int level) {
ret = compress2(zba.data(), &sz, ba.data(), ba.size(), level);
if (ret != Z_OK) {
piCout << "[PICompress]"
<< "Error: invalid input or not enought memory";
<< "Error: invalid input or not enought memory"_tr("PICompress");
return ba;
}
zba.resize(sz);
@@ -47,7 +49,7 @@ PIByteArray piCompress(const PIByteArray & ba, int level) {
return zba;
#else
piCout << "[PICompress]"
<< "Warning: PICompress is disabled, to enable install zlib library and build pip_compress library";
<< "Warning: PICompress is disabled, to enable install zlib library and build pip_compress library"_tr("PICompress");
#endif
return ba;
}
@@ -58,7 +60,7 @@ PIByteArray piDecompress(const PIByteArray & zba) {
ullong sz = 0;
if (zba.size() < sizeof(ullong)) {
piCout << "[PICompress]"
<< "Error: invalid input";
<< "Error: invalid input"_tr("PICompress");
return zba;
}
PIByteArray ba(zba.data(zba.size() - sizeof(ullong)), sizeof(ullong));
@@ -69,13 +71,13 @@ PIByteArray piDecompress(const PIByteArray & zba) {
ret = uncompress(ba.data(), &s, zba.data(), zba.size());
if (ret != Z_OK) {
piCout << "[PICompress]"
<< "Error: invalid input or not enought memory";
<< "Error: invalid input or not enought memory"_tr("PICompress");
return zba;
}
return ba;
#else
piCout << "[PICompress]"
<< "Warning: PICompress is disabled, to enable install zlib library and build pip_compress library";
<< "Warning: PICompress is disabled, to enable install zlib library and build pip_compress library"_tr("PICompress");
#endif
return zba;
}