Declaring variables

Translation variables are not protected from variables in other xlates.

You must declare all variables before using them and explicitly set the variable values; otherwise, the variable values are not as expected.

In this example, the scope of variable z is in the xlate tcl interp, which is in an xlate <br>thread .

Then, in another xlate file that is located in the same xlate thread, you can get the variables value. test1.xlt and test2.xlt to use the <br>same TCL interpreter, so that the variable in test1.xlt is visible in test2.xlt.

For example, there are two xlate files, test1.xlt and test2.xlt. In test1.xlt,there is a variable z.

In test2.xlt, there is no variable to declare. However, you can echo the z variable. This variable is not protected. You can use the variable z (declared in test1.xlt) in test2.xlt.

If you use variable z in test2.xlt, and the value of z is not the same as the value in test1.xlt, then you must reset it.

  1. On the Translation Configurator , for Action, select "COPY".
  2. On the Pre Proc tab, select Tcl.
  3. In the field, add:
    set z xxxx
    puts "xlate1 $z"
    set in $xlateInVals
    foreach a $in {
      if {$a ne {}} {
       lappend liz $a
     }
    }
  4. To <br>same to use the same variable name in test2.xlt, you must reset it. To do this, in the field, add:
    puts "xlate2 -- $z"
    set in $xlateInVals
    foreach a $in {
      if {$a ne {}} {
       lappend liz $a
     }
    }