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

@@ -8,25 +8,45 @@
#include "pilog.h"
#include "pimathbase.h"
#include "pip.h"
#include "pitranslator_p.h"
#include "pivaluetree_conversions.h"
using namespace PICoutManipulators;
template<typename Type>
void foo() {
static_assert(std::is_arithmetic<Type>::value || is_complex<Type>::value, "Type must be arithmetic");
}
int main(int argc, char * argv[]) {
// piCout << PIString::readableSize(50_KiB);
// piCout << PIString::readableSize(1_GB);
PITranslator::loadLang("ru");
PITranslator::loadConfig("[]\ntest \\\nstring=привет\n"_u8);
PISerial f("COM123");
f.open();
/*auto test = [](PIString s, PIString v) {
piCout << " in:" << s;
piCout << "arg:" << minArgPlaceholder(s);
piCout << "out:" << arg(s, v);
piCout << "";
};
test(" %", "asd");
test("%", "asd");
test("1", "asd");
test(" %11", "asd");
test("%1%2 %0f%0g", "asd");
test("%01 ", "asd");*/
/*piCout << PIString::readableSize(50_KiB);
piCout << PIString::readableSize(1_GB);
PITranslator::loadLang("ru");
piCout << PIString::readableSize(50_KiB);
piCout << PIString::readableSize(1_GB);
piCout << "test\nstring"_tr;
PITranslator::clear();
piCout << PIString::readableSize(50_KiB);
piCout << PIString::readableSize(1_GB);
piCout << "test\nstring"_tr;
piCout << "hello!"_tr;
PITranslator::loadConfig("[]\nhello!=привет!\n[Co]\nhello!=привет CO!\n"_u8);
piCout << "hello!"_tr("Co") << "hello!"_tr;*/
// piCout << "hello!"_trNoOp;
// PICodeParser parser;
// parser.parseFile("cmg_test.h");
/*for (auto m: parser.macros) {