View Issue Details

IDProjectCategoryView StatusLast Update
0015180LazarusOtherpublic2010-06-16 19:58
Reportercobines Assigned ToMaxim Ganetsky  
Status closedResolutionfixed 
Product Version0.9.29 (SVN) 
Fixed in Version0.9.29 (SVN) 
Summary0015180: Only the last column title of a grid can be localized via .lrt/.po
DescriptionI add columns to a grid in design time with Object Inspector via Columns property. They are represented in LFM file this way:

    Columns = <
        Title.Caption = 'First'
        Title.Caption = 'Second'
        Title.Caption = 'Third'

In the generated LRT file each title has the same identifier:


The result in the .po file is:

msgid "Third"
msgstr ""

Only the last string is saved, but all three strings should be saved and allowed to be translated.
TagsNo tags attached.
Fixed in Revision25431
Attached Files


related to 0016742 closedMattias Gaertner Collections items don't have unique identifiers in LRT file 


2009-11-25 09:58


example.tar.bz2 (2,016 bytes)

2010-05-12 03:13


LRT_fix_r25263.patch (425 bytes)   
Index: main.pp
--- main.pp	(revision 25317)
+++ main.pp	(working copy)
@@ -5069,7 +5069,7 @@
-  FGrubbed.Add(Uppercase(Path)+'='+Content);
+  FGrubbed.Add(Uppercase(Path)+'['+IntToStr(FGrubbed.Count)+']='+Content);
   //DebugLn(['TLRTGrubber.Grub "',FGrubbed[FGrubbed.Count-1],'"']);
LRT_fix_r25263.patch (425 bytes)   

Maxim Ganetsky

2010-05-12 03:16

developer   ~0037466

I propose attached patch to fix this bug.

Its Pros:
- Simple.
- No performance loss (because no searching for duplicates is performed).

- Existing .po files get heavily changed with it.

Any comments?

2010-05-14 01:34


LRT_fix_r25388.patch (805 bytes)   
Index: main.pp
--- main.pp	(revision 25387)
+++ main.pp	(working copy)
@@ -5056,7 +5056,7 @@
   PropInfo: PPropInfo; var Content: string);
   LRSWriter: TLRSObjectWriter;
-  Path: String;
+  Path, WriterRootPath: String;
   if not Assigned(Instance) then exit;
   if not Assigned(PropInfo) then exit;
@@ -5064,7 +5064,8 @@
   if Writer.Driver is TLRSObjectWriter then begin
-    Path:=LRSWriter.GetStackPath(Writer.Root);
+    WriterRootPath:=LRSWriter.GetStackPath(Writer.Root);
+    Path:=Copy(WriterRootPath, 1, Pos('.',WriterRootPath))+Instance.GetNamePath+'.'+PropInfo^.Name;
   end else begin
LRT_fix_r25388.patch (805 bytes)   

Maxim Ganetsky

2010-05-14 01:36

developer   ~0037557

Last edited: 2010-05-14 01:37

I have attached a new patch which doesn't change .po files as heavily as previous one.

My test LRT file contents without this patch:


My test LRT file contents with this new patch:


Please test.

Maxim Ganetsky

2010-05-15 17:52

developer   ~0037623

Please test and close if ok.


2010-05-16 08:37

reporter   ~0037633

It works great, I just came to a problem with saving the default column name, which I reported here:



2010-06-11 20:07

reporter   ~0038484

Hi. Sorry for the long response time.

I have tested the solution (the one committed to SVN) and it indeed works OK for StringGrid, DrawGrid, etc.

But I see this problem is more generic (saving all types of collections to LRT). The current solution with TPersistent.GetNamePath requires overriding GetNamePath, otherwise class name is used which might cause name clashes if there are different properties of the same class. For example TGridColumnTitle does not have GetNamePath overridden, so TGRIDCOLUMNTITLE (property type) is used instead of TITLE (property name):

  should be

If TGridColumn had a second property of type TGridColumnTitle the paths to both would be the same. GetNamePath is indeed implemented for TCollection and TCollectionItem.

Using TPersistent.GetNamePath is I think trying to make the path from bottom to top where each TPersistent uses its Owner as the parent class. This requires Owners to form a hierarchy where each TPersistent is available as a property from its Owner. It is implemented this way for TCollection for example. But this will not always work, e.g., when Owners are set up differently or not assigned. The top to bottom I think should be used like before, which does not require using Owner.

Problem is I think that pre-25431 code is using names of nodes from LRS writer to create path but LRS writer does not number the collections items. The paths in LRT file must be unique, which is not required for LRS. Maybe a different writer is needed, or at least caching the names of properties in a different way.

I don't know, should I make a different bug report, since this is a more general problem?

Maxim Ganetsky

2010-06-12 02:20

developer   ~0038490

Yes, please create a separate bug report.


2010-06-16 19:58

reporter   ~0038588

Closing, since reported case is resolved. More general issue reported as 0016742.

Issue History

Date Modified Username Field Change
2009-11-25 09:58 cobines New Issue
2009-11-25 09:58 cobines File Added: example.tar.bz2
2009-11-25 10:34 Vincent Snijders LazTarget => -
2009-11-25 10:34 Vincent Snijders Status new => acknowledged
2010-05-12 03:13 Maxim Ganetsky File Added: LRT_fix_r25263.patch
2010-05-12 03:16 Maxim Ganetsky Note Added: 0037466
2010-05-14 01:34 Maxim Ganetsky File Added: LRT_fix_r25388.patch
2010-05-14 01:36 Maxim Ganetsky Note Added: 0037557
2010-05-14 01:37 Maxim Ganetsky Note Edited: 0037557
2010-05-14 01:38 Maxim Ganetsky Status acknowledged => assigned
2010-05-14 01:38 Maxim Ganetsky Assigned To => Maxim Ganetsky
2010-05-15 17:52 Maxim Ganetsky Fixed in Revision => 25431
2010-05-15 17:52 Maxim Ganetsky Status assigned => resolved
2010-05-15 17:52 Maxim Ganetsky Fixed in Version => 0.9.29 (SVN)
2010-05-15 17:52 Maxim Ganetsky Resolution open => fixed
2010-05-15 17:52 Maxim Ganetsky Note Added: 0037623
2010-05-16 08:37 Marelis Note Added: 0037633
2010-06-11 20:07 cobines Status resolved => assigned
2010-06-11 20:07 cobines Resolution fixed => reopened
2010-06-11 20:07 cobines Note Added: 0038484
2010-06-12 02:20 Maxim Ganetsky Note Added: 0038490
2010-06-12 02:21 Maxim Ganetsky Status assigned => resolved
2010-06-12 02:21 Maxim Ganetsky Resolution reopened => fixed
2010-06-16 19:58 cobines Status resolved => closed
2010-06-16 19:58 cobines Note Added: 0038588
2011-01-07 09:27 Vincent Snijders Relationship added related to 0016742