Soluling home   Document home

Select Rules

Select Rules

Select rules are used with structured file formats such as XML and JSON. The rules specify what element should be localized. Rules contain one or more select rules. Each rule selects one element type. The rue contains the following properties.

Property Description Example
Value expression XPath expression that specifies the element to be localized. description
//description
//data/description
@description
data@description
Id expression Optional XPath expression that specifies the element giving the id of the element specified in the Value property.
Must be a relative XPath to the value element.
@id
../@key
Give only id, do not localize If checked, the rule specifies the id of the value element but does not make the element for localization.  
Localize expression Optional XPath expression that specifies the element showing if the element specified in the Value property should be localized.
Must be a relative XPath to the value element.
@localize
../@localize
Data format

The data format of the element. By default this is Detect, that means Soluling will detect the format. You can also select the format:

Format Description
Plain text String contains plain text.
Segmented text String contains the segmented text.
Boolean String contains a boolean value. 1/0, true/false, and yes/no are valid values.
Integer number String contains an integer number.
Floating point number String contains a floating-point number. It can be in scientific format (e.g., 1.45E-12). The decimal separator (if any) must be a period (e.g., 1.5).
Color

String contains a color value. Possible formats are [#|$|0x][AA]RRGGBB or [#|$|0x][A]RGB.

Date and time

String contains a date and time value. ISO 8601 (Wikipedia) must be used.

Expression String contains a structured string that is defined using an expression. Regular expressions are used to parse the string.
Defined text String contains the defined text. A text definition (using regular expressions) is used to parse the string.
Script String contains script data. A script/source code parser is used to parse the string.
XML String contains XML data. An XML parser is used to parse the string.
JSON String contains JSON data. A JSON parser is used to parse the string.
YAML String contains YAML data. A YAML parser is used to parse the string.
INI String contains INI data. An INI parser is used to parse the string.
HTML String contains HTML data. An HTML parser is used to parse the string.
SVG String contains SVG data. An SVG parser is used to parse the string.
Base64 encoded binary data String contains base64 encoded data. Encoded data is decoded into original binary data and scanned.
Base32 encoded binary data String contains base32 encoded data. Encoded data is decoded into original binary data and scanned.
Base16/hex encoded binary data String contains base16/hex encoded data. Encoded data is decoded into original binary data and scanned.
URL encoded binary data String contains URL encoded data. Encoded data is decoded into original binary data and scanned.
 

XPath syntax

Use XPath in expressions. Currently, only a subset of XPath is allowed. You can use "/", ".", "..", "@" and element names. For example description selects all elements having description as a name. @caption selects all attributes having caption as a name.

Examples

Let's have an example.

<?xml version="1.0" encoding="utf-8"?>
<products>
  <product id="skimmilk">
    <name>Skim milk</name>
    <price>1.15</price>
    <count>1</count>
  </product>
  <product id="apple">
    <name>Apple</name>
    <price>0.99</price>
    <count>10</count>
  </product>
</products>

We want to localize the name elements in the file. The id attribute of the product element contains a unique id that we can use as an id element. Our rule will be

Value expression name
Id expression ../@id