View Issue Details

IDProjectCategoryView StatusLast Update
0023820LazarusLCLpublic2013-02-04 11:19
ReporterwpAssigned ToMaxim Ganetsky 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version1.1 (SVN)Product Build 
Target VersionFixed in Version1.1 (SVN) 
Summary0023820: Defaulttranslator does not translate embedded frames
DescriptionIf an application localized to various languages by means of po files switches to a different language all design-time texts are translated except fine for those on embedded frames left at their defaults. The translation uses the DefaultTranslator which accompanies the Lazarus distribution.
Steps To ReproduceSee my forum posting (http://www.lazarus.freepascal.org/index.php/topic,19774.msg113140.html#new)
Additional InformationHere is a patch to fix the issue.
TagsNo tags attached.
Fixed in Revision40164
LazTarget-
Widgetset
Attached Files
  • defaulttranslator.pas.patch (687 bytes)
    Index: defaulttranslator.pas
    ===================================================================
    --- defaulttranslator.pas	(revision 40159)
    +++ defaulttranslator.pas	(working copy)
    @@ -330,6 +330,10 @@
         for i := 0 to TComponent(AnInstance).ComponentCount-1 do
           begin
           StoreStackPath:=FStackPath;
    +      if TComponent(AnInstance).Components[i] is TCustomFrame then begin
    +        UpdateTranslation(TComponent(AnInstance).Components[i]);
    +        FStackPath := StoreStackPath;
    +      end;
           FStackPath:=FStackPath+'.'+TComponent(AnInstance).Components[i].Name;
           IntUpdateTranslation(TComponent(AnInstance).Components[i]);
           FStackPath:=StoreStackPath;
    
  • translate-frames.zip (9,855 bytes)

Activities

wp

2013-02-03 15:15

developer  

defaulttranslator.pas.patch (687 bytes)
Index: defaulttranslator.pas
===================================================================
--- defaulttranslator.pas	(revision 40159)
+++ defaulttranslator.pas	(working copy)
@@ -330,6 +330,10 @@
     for i := 0 to TComponent(AnInstance).ComponentCount-1 do
       begin
       StoreStackPath:=FStackPath;
+      if TComponent(AnInstance).Components[i] is TCustomFrame then begin
+        UpdateTranslation(TComponent(AnInstance).Components[i]);
+        FStackPath := StoreStackPath;
+      end;
       FStackPath:=FStackPath+'.'+TComponent(AnInstance).Components[i].Name;
       IntUpdateTranslation(TComponent(AnInstance).Components[i]);
       FStackPath:=StoreStackPath;

Maxim Ganetsky

2013-02-03 16:07

developer   ~0065428

Please attach small project which could be used to test this patch.

wp

2013-02-03 19:36

developer   ~0065434

Done.

The form contains two versions of a frame (in unit2) with just a label "Text on frame". The first frame is embedded into the form without modification. In the other frame the text is changed to "Modified text on frame". There is another label ("Text on form") which resides in the form directly.

When the language is switched to "German" you see that all strings switch to German language except for the one on the unmodified frame ("Text on frame").

The program uses a modified local copy of the DefaultTranslator unit. When stepping through the method TUpdateTranslator.IntUpdateTranslation the strings of the original frame are not found because the Translator only scans the CustomForms of the application, not the frames.

The attached patch modifies the method such that it forces a scan of the Frame's class when an embedded frame is found.

wp

2013-02-03 19:37

developer  

translate-frames.zip (9,855 bytes)

Maxim Ganetsky

2013-02-03 22:53

developer   ~0065437

Applied with minor changes, thanks.

Please test and close if ok.

wp

2013-02-04 11:19

developer   ~0065461

Thank you

Issue History

Date Modified Username Field Change
2013-02-03 15:15 wp New Issue
2013-02-03 15:15 wp File Added: defaulttranslator.pas.patch
2013-02-03 16:07 Maxim Ganetsky LazTarget => -
2013-02-03 16:07 Maxim Ganetsky Note Added: 0065428
2013-02-03 16:07 Maxim Ganetsky Status new => feedback
2013-02-03 19:36 wp Note Added: 0065434
2013-02-03 19:36 wp Status feedback => new
2013-02-03 19:37 wp File Added: translate-frames.zip
2013-02-03 21:32 Maxim Ganetsky Assigned To => Maxim Ganetsky
2013-02-03 21:32 Maxim Ganetsky Status new => assigned
2013-02-03 22:53 Maxim Ganetsky Fixed in Revision => 40164
2013-02-03 22:53 Maxim Ganetsky Note Added: 0065437
2013-02-03 22:53 Maxim Ganetsky Status assigned => resolved
2013-02-03 22:53 Maxim Ganetsky Fixed in Version => 1.1 (SVN)
2013-02-03 22:53 Maxim Ganetsky Resolution open => fixed
2013-02-04 11:19 wp Note Added: 0065461
2013-02-04 11:19 wp Status resolved => closed