Soluling home   Document home

Scan Rules

Scan Rules

Soluling uses scan rules with data types to specify what it properties are scanned (e.g. localized) from the user interface resource files. Scan rules are used in the following platforms:

Platform Description Handling of properties
Android Property is an attribute value in a layout file (.xml) Only those properties that have a matching scan property are scanned.
Delphi, VCL Property is a value in a form file (.dfm) All string properties except those that have a matching scan property are scanned. Other but string properties are only scanned if there is a matching scan property.
Delphi, FireMonkey Property is a value in a form file (.fmx) All string properties except those that have a matching scan property are scanned. Other but string properties are only scanned if there is a matching scan property.
Windows Forms Property is an element in a form resource file (.resx) All string properties except those that have a matching scan property are scanned. Other but string properties are only scanned if there is a matching scan property.

WPF

Property is an element value or an attribute value in a XAML file (.xaml) Only those properties that have a matching scan property are scanned.

UWP

Property is an element value or an attribute value in a XAML file (.xaml) Only those properties that have a matching scan property are scanned.

Xamarin

Property is an element value or an attribute value in a XAML file (.xaml) Only those properties that have a matching scan property are scanned.

When scanning Android, QML, or XAML resources only those properties that have a matching value in the scan rules list are scanned. All other properties are skipped. When scanning Delphi (VCL or FireMonkey) or Windows Forms resources the scanning of the property depends on the type of the property. If the type is not a string then the property is scanned based on the scan rules and data type settings. This means that property is scanned only if there is a match in the scan rule list and the data type is not disabled. If the type is a string then scanner behaves in a different way. By default all string properties are scanned except those that have an exclusive match in the scan rules list. The scanning choice is different because Delphi and Windows Forms resources contain type information of each property item unlike Android, QML and XAML resources that do not contain type information. You can change the behaviour of each data type in the data type sheet.

A scan rule is always a combination of component type name and a property name. Both component type names and property names can contain wildcard characters (* or ?) to make them more generic. In addition each scan rule has a flag that specifies the action for the matching properties. The action can be localize, hide, or exclude. For example the following table contains some possible rules:

Component type Property name Action Description
Button Text localize Makes Soluling to localize the Text properties of all instances Button components.
* Text localize Makes Soluling to localize the Text properties of all components.
Button *Text localize Makes Soluling to localize all the properties of all instances Button components where the property name ends with Text.
For example Text, HintText or ActiveText.
MyButton Password exclude Makes Soluling to ignore localization of the Password properties of all instances of MyButton components.
MyButton Information hide Makes Soluling to extract the Information property values of all instances of MyButton component, but it won't be visible in the edit grid.

Use exclude operation to disable certain properties or components in the case you have first turn localization on by using another rule that has * as component type name, or by turning on the data type.

You can attach rules to every node in the project tree. When scanning data the rules closest to the current item are used first. If that rule set does not contain a match then rules of the parent items are used. This is repeated until the root rules (i. e. application rules) are met. A sample cascading path of a component is form node -> source -> group source -> project -> application.

Item Description Default value How to edit
node The rules used by all components of the selected node. Empty Right click a form or dialog node on the project tree and choose Options menu. Select Scan properties rules sheet.
source The rules used by all nodes of the selected source. Empty Right click a source on the project tree and choose Options menu. Select Scan properties rules sheet.
project The rules used by all sources of the current project. Empty Choose Project sheet on the ribbon and in Rules group click the platform whose rules you want to edit.
application The default rules used by all projects using the same platform. Default rules Choose Options sheet on the ribbon and in Platform group click the platform whose rules that you want to edit.

When you create a new project it will contain no rules. Each item of the project (e.g. project, source or form) will have empty rule list. This makes them to use the application rules. Application rules by default contain the default values that work on most projects. Once you have created your project you can add, remove or edit the rules of any items or the project. Add a new rule to the project if you want to use it only on that project. Add a new rule to the application options if you want to use the rule on every project.

By default only scan rules (*) are used to determine if a property should be scanned or not. However you can change this for each data type. Each data type has a flag that specifies how properties of that type are scanned. Possible values are:

Value Description
By rules Default. Scan rules are used to determine if a property is scanned or not.
Yes All properties of this type are scanned no matter the scan rules.
No All properties of this type are ignored no matter the scan rules.

Use Data types sheet to change data type settings.

*) With Delphi and Windows Forms the string type is Yes by default.

In addition of the scan rules, Soluling also uses mapping rules for the visual editor.