translations: multi-line and special symbols support
This commit is contained in:
@@ -68,6 +68,11 @@ void help() {
|
||||
}
|
||||
|
||||
|
||||
PIString fromCode(const PIString & in) {
|
||||
return in.replacedAll("\\n", '\n').replaceAll("\\r", '\r').replaceAll("\\t", '\t');
|
||||
}
|
||||
|
||||
|
||||
void gatherStrings(TSFile::Content & content, const PIString & file, const PIString & file_loc) {
|
||||
PIString source, context;
|
||||
int pos = -1, ppos = 0, line = -1;
|
||||
@@ -129,14 +134,13 @@ void gatherStrings(TSFile::Content & content, const PIString & file, const PIStr
|
||||
}
|
||||
}
|
||||
|
||||
content[context].confirm(source, file_loc, line);
|
||||
content[context].confirm(fromCode(source), file_loc, line);
|
||||
pos = ppos;
|
||||
piCout << "Context = \"" << context << "\", message = \"" << source << "\"";
|
||||
}
|
||||
}
|
||||
|
||||
auto & ec(content[""]);
|
||||
content[context].confirm(source, file_loc, line);
|
||||
pos = -1;
|
||||
for (;;) {
|
||||
source.clear();
|
||||
@@ -156,7 +160,7 @@ void gatherStrings(TSFile::Content & content, const PIString & file, const PIStr
|
||||
continue;
|
||||
}
|
||||
}
|
||||
ec.confirm(source, file_loc, file.lineNumber(pos));
|
||||
ec.confirm(fromCode(source), file_loc, file.lineNumber(pos));
|
||||
piCout << "_tr = \"" << source << "\"";
|
||||
}
|
||||
}
|
||||
@@ -186,7 +190,7 @@ int main(int argc, char * argv[]) {
|
||||
PIString out_path = cli.argumentValue("output");
|
||||
|
||||
PIStringList files;
|
||||
const static PIStringList ext({"*.h", "*.hpp", "*.cpp", "*.cxx"});
|
||||
const static PIStringList ext({"h", "hpp", "cpp", "cxx"});
|
||||
for (const PIString & a: cli.optionalArguments()) {
|
||||
if (PIDir::isExists(a)) {
|
||||
auto dl = PIDir(a).allEntries();
|
||||
|
||||
Reference in New Issue
Block a user