mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-07 21:38:00 +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;
|
||||
begin
|
||||
Result:='';
|
||||
LCLPath:=FindLocaleFileName('.po', Lang, ExtractFilePath(Dir), 'lclstrconsts', Result);
|
||||
if LCLPath<>'' then
|
||||
Translations.TranslateUnitResourceStrings('LCLStrConsts', LCLPath)
|
||||
else
|
||||
begin
|
||||
LCLPath:=FindLocaleFileName('.mo', Lang, ExtractFilePath(Dir), 'lclstrconsts', Result);
|
||||
try
|
||||
LCLPath:=FindLocaleFileName('.po', Lang, ExtractFilePath(Dir), 'lclstrconsts', Result);
|
||||
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;
|
||||
|
||||
@ -563,24 +567,20 @@ begin
|
||||
begin
|
||||
Translations.TranslateResourceStrings(lcfn);
|
||||
LocalTranslator := TPOTranslator.Create(lcfn);
|
||||
end;
|
||||
except
|
||||
lcfn := '';
|
||||
end;
|
||||
|
||||
if lcfn='' then
|
||||
begin
|
||||
// try now with MO translation resources
|
||||
try
|
||||
end
|
||||
else
|
||||
begin
|
||||
// try now with MO translation resources
|
||||
lcfn := FindLocaleFileName('.mo', Lang, Dir, LocaleFileName, Result);
|
||||
if lcfn <> '' then
|
||||
begin
|
||||
GetText.TranslateResourceStrings(UTF8ToSys(lcfn));
|
||||
LocalTranslator := TDefaultTranslator.Create(lcfn);
|
||||
end;
|
||||
except
|
||||
lcfn := '';
|
||||
end;
|
||||
except
|
||||
Result := '';
|
||||
lcfn := '';
|
||||
end;
|
||||
|
||||
DefaultLang := Result;
|
||||
|
Loading…
Reference in New Issue
Block a user