mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-22 14:19:42 +02:00
LCL, DefaultTranslator:
1) Fix translation of captions in different forms, but with the same values (don't take first found translation, check also message name) when using PO files. 2) Create message name according to the rules used for creating it in LRT files after r25431 #99c23d89c7. 3) Impove code readability. 4) Cleanup. git-svn-id: trunk@25440 -
This commit is contained in:
parent
9a50186700
commit
754af06409
@ -1,6 +1,6 @@
|
||||
unit DefaultTranslator;
|
||||
|
||||
{ Copyright (C) 2004 V.I.Volchenko and Lazarus Developers Team
|
||||
{ Copyright (C) 2004-2010 V.I.Volchenko and Lazarus Developers Team
|
||||
|
||||
This library is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Library General Public License as published by
|
||||
@ -243,26 +243,26 @@ begin
|
||||
if (csDesigning in Component.ComponentState) then
|
||||
exit;
|
||||
|
||||
s := FMOFile.Translate(Content);
|
||||
if s = '' then
|
||||
begin
|
||||
if not (Sender is TReader) then
|
||||
Exit;
|
||||
exit;
|
||||
if Component = TReader(Sender).Root then
|
||||
Section := UpperCase(Component.ClassName)
|
||||
Section := Component.ClassName
|
||||
else
|
||||
if Component.Owner = TReader(Sender).Root then
|
||||
Section := UpperCase(Component.Owner.ClassName + '.' + Instance.GetNamePath)
|
||||
Section := Component.Owner.ClassName
|
||||
else
|
||||
Exit;
|
||||
Section := Section + '.' + UpperCase(PropInfo^.Name);
|
||||
exit;
|
||||
Section := UpperCase(Section + '.' + Instance.GetNamePath + '.' + PropInfo^.Name);
|
||||
s := FMoFile.Translate(Section + #4 + Content);
|
||||
end;
|
||||
|
||||
if s = '' then
|
||||
s := FMOFile.Translate(Content);
|
||||
|
||||
if s <> '' then
|
||||
Content := s;
|
||||
end;
|
||||
|
||||
{ TDefaultTranslator }
|
||||
{ TPOTranslator }
|
||||
|
||||
constructor TPOTranslator.Create(POFileName: string);
|
||||
begin
|
||||
@ -304,21 +304,18 @@ begin
|
||||
if (csDesigning in Component.ComponentState) then
|
||||
exit;
|
||||
|
||||
s := FPOFile.Translate(Content, Content);
|
||||
if s = '' then
|
||||
begin
|
||||
if not (Sender is TReader) then
|
||||
Exit;
|
||||
exit;
|
||||
if Component = TReader(Sender).Root then
|
||||
Section := UpperCase(Component.ClassName)
|
||||
Section := Component.ClassName
|
||||
else
|
||||
if Component.Owner = TReader(Sender).Root then
|
||||
Section := UpperCase(Component.Owner.ClassName + '.' + Instance.GetNamePath)
|
||||
Section := Component.Owner.ClassName
|
||||
else
|
||||
Exit;
|
||||
Section := Section + '.' + UpperCase(PropInfo^.Name);
|
||||
s := FPOFile.Translate(Section + #4 + Content, Section + #4 + Content);
|
||||
end;
|
||||
exit;
|
||||
Section := UpperCase(Section + '.' + Instance.GetNamePath + '.' + PropInfo^.Name);
|
||||
s := FPOFile.Translate(Section, Content);
|
||||
|
||||
if s <> '' then
|
||||
Content := s;
|
||||
end;
|
||||
@ -382,7 +379,3 @@ finalization
|
||||
LocalTranslator.Free;
|
||||
|
||||
end.
|
||||
{
|
||||
No revision (not in LOG)
|
||||
2004/10/09 Sent as is to Lazarus Team - VVI
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user