* Added some fileexists() near places where a stream was opened, but

relied on the exception mechanism to handle file not found.
   Makes debugging easier.

git-svn-id: trunk@24274 -
This commit is contained in:
marco 2013-04-20 12:01:42 +00:00
parent b27e03346b
commit 3cc61e6195

View File

@ -331,30 +331,39 @@ procedure TranslateResourceStrings(const AFilename: String);
var
mo: TMOFile;
lang, FallbackLang: String;
fn: String;
begin
GetLanguageIDs(Lang, FallbackLang);
try
mo := TMOFile.Create(Format(AFilename, [FallbackLang]));
try
TranslateResourceStrings(mo);
finally
mo.Free;
end;
except
on e: Exception do;
end;
fn:=Format(AFilename, [FallbackLang]);
lang := Copy(lang, 1, 5);
try
mo := TMOFile.Create(Format(AFilename, [lang]));
try
TranslateResourceStrings(mo);
finally
mo.Free;
if fileexists(fn) then
begin
try
mo := TMOFile.Create(fn);
try
TranslateResourceStrings(mo);
finally
mo.Free;
end;
except
on e: Exception do;
end;
end;
lang := Copy(lang, 1, 5);
fn:=Format(AFilename, [lang]);
if fileexists(fn) then
begin
try
mo := TMOFile.Create(Format(AFilename, [lang]));
try
TranslateResourceStrings(mo);
finally
mo.Free;
end;
except
on e: Exception do;
end;
end;
except
on e: Exception do;
end;
end;