Skip to content

Known issues

Lübbe Onken edited this page Aug 17, 2021 · 7 revisions

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.

There are two possible solutions for this problem:

  1. Don't assign a name to your svg icon items. If they don't have a name, they won't be translated by accident.
  2. Add two 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. This excludes all TSVGIconImageCollections and TVirtualImageLists from translation.
TP_GlobalIgnoreClass(TSVGIconImageCollection);
TP_GlobalIgnoreClass(TVirtualImageList);
Clone this wiki locally