Patch level : 4.0 622
Files correlati : ba2.exe Ricompilazione Demo : [ ] Commento : Mofiicata procedura di filtro git-svn-id: svn://10.65.10.50/trunk@14392 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
7f76e284e5
commit
c649bd2bf7
@ -146,25 +146,32 @@ bool TDictionary::read(const char* fname)
|
||||
if (line.starts_with("<ita>"))
|
||||
{
|
||||
const int eoi = line.find("</ita>");
|
||||
ita = xml2txt(line.sub(5, eoi));
|
||||
|
||||
ita = xml2txt(line.sub(5, eoi));
|
||||
} else
|
||||
if (line.starts_with("<eng>") && ita.not_empty())
|
||||
{
|
||||
const int eoe = line.find("</eng>");
|
||||
const TString& eng = xml2txt(line.sub(5, eoe));
|
||||
set_translation(ita, eng);
|
||||
TString& eng = xml2txt(line.sub(5, eoe));
|
||||
|
||||
if (eng.blank())
|
||||
set_translation(ita, "???");
|
||||
else
|
||||
set_translation(ita, eng.trim());
|
||||
}
|
||||
if (line.starts_with("<max>") && ita.not_empty())
|
||||
{
|
||||
const int eom = line.find("</max>");
|
||||
const int len = atoi(line.sub(5, eom));
|
||||
update_max_length(ita, len);
|
||||
|
||||
update_max_length(ita, len);
|
||||
}
|
||||
if (line.starts_with("<src>") && ita.not_empty())
|
||||
{
|
||||
TDictionary_entry& entry = get_entry(ita);
|
||||
const int eos = line.find("</src>");
|
||||
entry.set_sources(xml2txt(line.sub(5, eos)));
|
||||
|
||||
entry.set_sources(xml2txt(line.sub(5, eos)));
|
||||
}
|
||||
}
|
||||
_save_needed = false;
|
||||
@ -656,8 +663,6 @@ bool TDictionary_mask::check_translation(const TString & ita, const TString & en
|
||||
|
||||
bool TDictionary_mask::good_translation(const TString & ita, const TString & eng, const TString & src)
|
||||
{
|
||||
if (eng == "???")
|
||||
return false;
|
||||
if (ita.find('#') >= 0 || eng.find('#') >= 0)
|
||||
return false;
|
||||
if (ita.find('&') >= 0 || eng.find('&') >= 0)
|
||||
@ -681,23 +686,36 @@ void TDictionary_mask::fill_chapter()
|
||||
for (int i = 0; i < ref.items(); i++)
|
||||
{
|
||||
const TDictionary_entry& e = (const TDictionary_entry&)ref[i];
|
||||
|
||||
if (toupper(e._ita[0]) == letter)
|
||||
{
|
||||
const bool good = good_translation(e._ita, e._eng, e._src);
|
||||
const bool translated = e._eng != "???";
|
||||
const bool not_error = good || translated;
|
||||
|
||||
if (_filtered)
|
||||
{
|
||||
if (_errors && good)
|
||||
continue;
|
||||
|
||||
bool skip = false;
|
||||
|
||||
if (_errors)
|
||||
skip |= !chk_modules && good && translated;
|
||||
else
|
||||
skip |= !good;
|
||||
if (_new)
|
||||
skip = !_errors && e._eng != "???";
|
||||
{
|
||||
if (_errors)
|
||||
skip |= !chk_modules && good && translated;
|
||||
else
|
||||
skip |= !chk_modules && translated;
|
||||
}
|
||||
else
|
||||
skip |= !translated;
|
||||
if (!skip && chk_modules)
|
||||
{
|
||||
FOR_EACH_TOKEN(_modules, m)
|
||||
{
|
||||
const int p = e._src.find(m);
|
||||
|
||||
skip = p < 0 || (p > 0 && e._src[p - 1] != ',' && e._src[p] != '.');
|
||||
if (!skip)
|
||||
break;
|
||||
@ -711,10 +729,10 @@ void TDictionary_mask::fill_chapter()
|
||||
row.add(e._eng);
|
||||
row.add(e._max_length);
|
||||
row.add(e._src);
|
||||
if (good)
|
||||
s.set_back_and_fore_color(NORMAL_BACK_COLOR, NORMAL_COLOR, s.items() - 1);
|
||||
else
|
||||
if (!good || !translated)
|
||||
s.set_back_and_fore_color(REQUIRED_BACK_COLOR, COLOR_RED, s.items() - 1);
|
||||
else
|
||||
s.set_back_and_fore_color(NORMAL_BACK_COLOR, NORMAL_COLOR, s.items() - 1);
|
||||
}
|
||||
}
|
||||
s.force_update();
|
||||
@ -794,7 +812,7 @@ bool TDictionary_mask::on_field_event(TOperable_field& o, TField_event e, long j
|
||||
_dictionary.set_translation(ita, eng);
|
||||
if (len > 0 && eng.len() > len)
|
||||
warning_box("La traduzione e' lunga %d caratteri (max. %d)!", eng.len(), len);
|
||||
if (!good_translation(ita, eng, src))
|
||||
if (!good_translation(ita, eng, src) || eng == "???")
|
||||
s.set_back_and_fore_color(REQUIRED_BACK_COLOR, COLOR_RED, jolly);
|
||||
else
|
||||
s.set_back_and_fore_color(NORMAL_BACK_COLOR, NORMAL_COLOR, jolly);
|
||||
|
Loading…
x
Reference in New Issue
Block a user