mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-30 20:50:39 +02:00
LCLTranslator: small refactor, ensured setting SetDefaultLang and TranslateLCLResourceStrings results to empty values on exceptions
git-svn-id: trunk@61615 -
This commit is contained in:
parent
00e57d2560
commit
5e5045ebd1
@ -529,14 +529,18 @@ var
|
|||||||
LCLPath: string;
|
LCLPath: string;
|
||||||
begin
|
begin
|
||||||
Result:='';
|
Result:='';
|
||||||
LCLPath:=FindLocaleFileName('.po', Lang, ExtractFilePath(Dir), 'lclstrconsts', Result);
|
try
|
||||||
if LCLPath<>'' then
|
LCLPath:=FindLocaleFileName('.po', Lang, ExtractFilePath(Dir), 'lclstrconsts', Result);
|
||||||
Translations.TranslateUnitResourceStrings('LCLStrConsts', LCLPath)
|
|
||||||
else
|
|
||||||
begin
|
|
||||||
LCLPath:=FindLocaleFileName('.mo', Lang, ExtractFilePath(Dir), 'lclstrconsts', Result);
|
|
||||||
if LCLPath<>'' then
|
if LCLPath<>'' then
|
||||||
GetText.TranslateResourceStrings(UTF8ToSys(LCLPath));
|
Translations.TranslateUnitResourceStrings('LCLStrConsts', LCLPath)
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
LCLPath:=FindLocaleFileName('.mo', Lang, ExtractFilePath(Dir), 'lclstrconsts', Result);
|
||||||
|
if LCLPath<>'' then
|
||||||
|
GetText.TranslateResourceStrings(UTF8ToSys(LCLPath));
|
||||||
|
end;
|
||||||
|
except
|
||||||
|
Result:='';
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -563,24 +567,20 @@ begin
|
|||||||
begin
|
begin
|
||||||
Translations.TranslateResourceStrings(lcfn);
|
Translations.TranslateResourceStrings(lcfn);
|
||||||
LocalTranslator := TPOTranslator.Create(lcfn);
|
LocalTranslator := TPOTranslator.Create(lcfn);
|
||||||
end;
|
end
|
||||||
except
|
else
|
||||||
lcfn := '';
|
begin
|
||||||
end;
|
// try now with MO translation resources
|
||||||
|
|
||||||
if lcfn='' then
|
|
||||||
begin
|
|
||||||
// try now with MO translation resources
|
|
||||||
try
|
|
||||||
lcfn := FindLocaleFileName('.mo', Lang, Dir, LocaleFileName, Result);
|
lcfn := FindLocaleFileName('.mo', Lang, Dir, LocaleFileName, Result);
|
||||||
if lcfn <> '' then
|
if lcfn <> '' then
|
||||||
begin
|
begin
|
||||||
GetText.TranslateResourceStrings(UTF8ToSys(lcfn));
|
GetText.TranslateResourceStrings(UTF8ToSys(lcfn));
|
||||||
LocalTranslator := TDefaultTranslator.Create(lcfn);
|
LocalTranslator := TDefaultTranslator.Create(lcfn);
|
||||||
end;
|
end;
|
||||||
except
|
|
||||||
lcfn := '';
|
|
||||||
end;
|
end;
|
||||||
|
except
|
||||||
|
Result := '';
|
||||||
|
lcfn := '';
|
||||||
end;
|
end;
|
||||||
|
|
||||||
DefaultLang := Result;
|
DefaultLang := Result;
|
||||||
|
Loading…
Reference in New Issue
Block a user