3.12 $$ Symbol (external resource constant)
Symbols beginning with $$ are identified as external resource constants. External resource constants are described as follows in an XML format file located in the same directory as the CRS file. This file is called a resource file.
<? xml version = "1.0"?>
<resource>
<symbol_1> String Text 1 </ symbol_1>
<cust>
<name> Customer name </ name>
<addr> Customer address </ addr>
</ cust>
::
</ resource>
The symbol can be any name that can be specified as an XML node name consisting only of alphanumericals and an underscore (_) . String Text 1 is a string that replaces $$ symbol_1.
Button1.Title = $$ symbol_1;
Will display “String Text 1” on the button .
To retrieve deeper elements, connect the node names with a period (.) . For example, $$ cust.addr is replaced with “ customer address “ .
$$ Symbols are replaced as string constants. Since it cannot be replaced as an expression or a constant of another type, conversion by CRS script is also used if necessary.
Form1. BgColor = val ($$ color); / * Numerical conversion example * /
If the node corresponding to the symbol is not found in the resource file, the constant is not replaced and it is treated as a normal variable name. It does not result in an error.
The name of the resource file is fixed in resource.lang.xml. The lang part of the file name is replaced with the language identifier at runtime, which is ja in the Japanese environment and resource.ja.xml . With this mechanism, CRS scripts that support different languages can support multiple languages simply by translating resource.lang.xml by writing the string constant part using the $$ symbol . ..
The resource file is downloaded only once when the CRS compiler first detects the $$ symbol and is kept in memory. Even if you run multiple CRS files in the same directory in succession, you only need to download them once . Resource files are also cached according to the same rules as CRS files.
This download and replacement is done at compile time, so the intermediate code stored in the cache will contain the replaced string. Therefore, at the first execution, the resource.lang.xml file is downloaded in addition to the CRS file, so more communication time and more execution time than when “String Text 1” is written directly in the CRS file , It requires a lot of memory, but no overhead is incurred if it is run from the cache a second time or later.
Not supported by Mobile