change: force gcc use english to output if not in zh locale

enhancement: support gcc zh_CN locale
This commit is contained in:
Roy Qu 2024-03-07 20:33:16 +08:00
parent 1283609c41
commit cb323850f0
5 changed files with 505 additions and 381 deletions

View File

@ -179,28 +179,42 @@ CompileIssueType Compiler::getIssueTypeFromOutputLine(QString &line)
{
CompileIssueType result = CompileIssueType::Other;
line = line.trimmed();
int pos = line.indexOf(':');
if (pos>=0) {
QString s=line.mid(0,pos);
if (s == "error" || s == "fatal error"
|| s == "syntax error") {
mErrorCount += 1;
line = tr("[Error] ")+line.mid(pos+1);
result = CompileIssueType::Error;
} else if (s.startsWith("warning")) {
mWarningCount += 1;
line = tr("[Warning] ")+line.mid(pos+1);
result = CompileIssueType::Warning;
} else if (s == "info") {
mWarningCount += 1;
line = tr("[Info] ")+line.mid(pos+1);
result = CompileIssueType::Info;
} else if (s == "note") {
mWarningCount += 1;
line = tr("[Note] ")+line.mid(pos+1);
result = CompileIssueType::Note;
if (line.startsWith(tr("error:"))) {
mErrorCount += 1;
line = tr("[Error] ")+line.mid(tr("error:").length());
result = CompileIssueType::Error;
} else if (line.startsWith(tr("warning:"))) {
mWarningCount += 1;
line = tr("[Warning] ")+line.mid(tr("warning:").length());
result = CompileIssueType::Warning;
} else {
int pos = line.indexOf(':');
if (pos>=0) {
QString s=line.mid(0,pos);
if (s == "error" || s == "fatal error"
|| s == "syntax error") {
mErrorCount += 1;
line = tr("[Error] ")+line.mid(pos+1);
result = CompileIssueType::Error;
} else if (s.startsWith("warning")
|| s.startsWith(tr("warning"))) {
mWarningCount += 1;
line = tr("[Warning] ")+line.mid(pos+1);
result = CompileIssueType::Warning;
} else if (s == "info"
|| s == tr("info")) {
mWarningCount += 1;
line = tr("[Info] ")+line.mid(pos+1);
result = CompileIssueType::Info;
} else if (s == "note"
|| s == tr("note")) {
mWarningCount += 1;
line = tr("[Note] ")+line.mid(pos+1);
result = CompileIssueType::Note;
}
}
}
return result;
}

View File

@ -3747,7 +3747,8 @@ Settings::PCompilerSet Settings::CompilerSets::loadSet(int index)
pSet->setAutoAddCharsetParams(mSettings->mSettings.value("AddCharset", true).toBool());
pSet->setStaticLink(mSettings->mSettings.value("StaticLink", false).toBool());
pSet->setPersistInAutoFind(mSettings->mSettings.value("PersistInAutoFind", false).toBool());
pSet->setForceEnglishOutput(mSettings->mSettings.value("forceEnglishOutput", false).toBool());
bool forceEnglishOutput=QLocale::system().name().startsWith("zh")?false:true;
pSet->setForceEnglishOutput(mSettings->mSettings.value("forceEnglishOutput", forceEnglishOutput).toBool());
pSet->setExecCharset(mSettings->mSettings.value("ExecCharset", ENCODING_SYSTEM_DEFAULT).toString());
if (pSet->execCharset().isEmpty()) {

View File

@ -499,6 +499,34 @@
<source> - Command: %1 &gt; %2</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>warning</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>info</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>note</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>error:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>fatal error:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>syntax error:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>warning:</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CompilerAutolinkWidget</name>

File diff suppressed because it is too large Load Diff

View File

@ -400,6 +400,34 @@
<source> - Command: %1 &gt; %2</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>warning</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>info</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>note</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>error:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>fatal error:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>syntax error:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>warning:</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CompilerAutolinkWidget</name>