.NET Based OPC UA Client/Server SDK
LocalizedData Example

The Demo Server contains an example for a variable containing localized data in the folder Objects → Demo → 011_UnicodeTest. The variable IDS_HELLO_WORLD has localizations for display name, description, and the value in English, German, and French.

The variable IDS_HELLO_WORLD is created in the method SetupLocalizedVariable which can be found in the file Demo → DemoNodeManager.cs in the Visual Studio Solution for the Demo Server.

The individual translations have to be added to the ResourceManager as shown in the following code snippet.


Server.ResourceManager.Add("IDS_HELLO_WORLD", "en-US", "Hello World");
Server.ResourceManager.Add("IDS_HELLO_WORLD", "de-DE", "Hallo Welt");
Server.ResourceManager.Add("IDS_HELLO_WORLD", "fr-CA", "Bonjour tout le monde");
Server.ResourceManager.Add("IDS_LIGHT_RED", "en-US", "Red");
Server.ResourceManager.Add("IDS_LIGHT_RED", "de-DE", "Rot");
Server.ResourceManager.Add("IDS_LIGHT_RED", "fr-CA", "Rouge");
Server.ResourceManager.Add("IDS_LIGHT_GREEN", "en-US", "Green");
Server.ResourceManager.Add("IDS_LIGHT_GREEN", "de-DE", "Grün");
Server.ResourceManager.Add("IDS_LIGHT_GREEN", "fr-CA", "Verte");

When in-memory nodes are read, the Translate method of the ResourceManager is called by the SDK automatically.

To test the translations, set the configuration parameter General.LocaleId of UaExpert to de-DE, connect to the .NET Demo Server and read the Variable. The german localizations of DisplayName, Description and Value will show up (see screenshot).