问题
I have written a class that is declared like this in the private section piaces: TCompStar; and I am using the following code on the form create event:
begin
pieces.Items[0].insert('string 1');
pieces.Items[0].insert('string 2');
pieces.Items[0].insert('string 3');
//I am adding other 12 elements
end;
This is under firemonkey. Now I have only 15 elements (just debug) but soon I could have (worst case) 12509 items. We have a delphi unit that contains all the strings that must be added with the insert(const pieceDesrc: string);. We need the pieces to be written in english and german (then worst case is 12509*2) so we have a lot of strings.
I have read about resourcestring and I have seen that they are optimized strings that are good for localization. Also there are a few topics on stack overflow about them.
We care about the optimization because we want to be able to load 25018 strings quickly when the form creates. My question is: does it makes sense if we created a unit containing only resourcestrings and then we add them to the class? Like:
resourcestring
str1 = 'text';
str2 = 'text';
str3 = 'text';
pieces.Items[0].insert(str1);
pieces.Items[0].insert(str2);
pieces.Items[0].insert(str3);
Or it's better if I use the approach you see in the first block above?
来源:https://stackoverflow.com/questions/44422811/delphi-resource-string-optimization