Known issues - EtheaDev/SVGIconImageList GitHub Wiki
TSvgIconImageCollection and Gettext
Gettext for Delphi has two procedures TranslateComponent
and RetranslateComponent
, which are called when a form is created and when the UI language changes. These procedures translate all string properties of all components on a form. Since each SVG Icon has a Name
property, Gettext tries to translate the icon names for all icons in the collection, which is normally not what we want.
- You may want to access the icon by name instead of by index, so you don't want the name to change.
- Assigning the names of all icons at runtime causes a massive slowdown of the application during initialization.
See https://github.com/EtheaDev/SVGIconImageList/issues/197. - There is another side effect of Gettext which translates the item names in TVirtualImageList.
See: https://github.com/EtheaDev/SVGIconImageList/issues/198
There are two possible solutions for this problem:
- Don't assign a name to your svg icon items. If they don't have a name, they won't be translated by accident.
- Add
TP_GlobalIgnoreClass(...);
instructions to your .dpr file before any forms are created or to the initialization section of any unit that is called before Gettext does it's magic. There are two alternatives:
- This excludes all TSVGIconImageCollections and TVirtualImageLists from translation.
TP_GlobalIgnoreClass(TSVGIconImageCollection); TP_GlobalIgnoreClass(TVirtualImageList);
- This excludes the ImageName property of all objects, since ImageName should not be translated in any component.
TP_GlobalIgnoreClassProperty(TObject,'ImageName');`
Choose whichever approach suits you best.