Applies To:
  • CitectSCADA 5.xx

Summary:
I want to create a combo box and have it's list display in multiple languages.  I have entries for item_one etc in my english.dbf and french.dbf but when I execute the statement SetLanguage("French",1) nothing happens.  I have set up my code as follows but at runtime the list always displays as @(item_one), @(item_two), @(item_three).

FormNew("@(Select Item)",20,6,1);
FormComboBox(2 ,2, 15, 5, sBuf, 1);
FormAddList("@(item_one)");
FormAddList("@(Item_two)");
FormAddList("@(Item_three)");
FormRead(0);

 

Solution:
The solution is to use the StrToLocalText() Function. Your code becomes as follows.

FormNew("@(Select Item)",20,6,1);
FormComboBox(2 ,2, 15, 5, sBuf, 1);
FormAddList(StrToLocalText("@(item_one)"));
FormAddList(StrToLocalText("@(Item_two)"));
FormAddList(StrToLocalText("@(Item_three)"));
FormRead(0);

The StrToLocalText function above goes to the current local database as set by the SetLanguage function.  If the last SetLanguage command was SetLanguage("French",1) then the StrToLocalText function will open the database french.dbf and find the french translations referenced by item_one, item_two and item_three.  The french version will then be used when this function is called.  Conversely if we had SetLanguage("English",1) then the file english.dbf would be searched.

Nb. Also if we used the command SetLanguage("hello",1) then item_one etc, would be searched for in the file hello.dbf. Therefore the SetLanguage function could be used for more than simply converting the display between languages.

 

Keywords:
 

Attachments