Guides and Articles

Use this documentation when building your Tekla Structures apps

Localization of plug-in or application strings

Updated: 13 May 2019

The localization of strings can be done through XML-files, used only by your application or plugin.



The localization file must have XML content (like shown below) and must be of UTF-8 format.

<?xml version="1.0" standalone="yes"?>
        <chs>My String 1***</chs>         
        <cht>My String 1***</cht>         
        <csy>My String 1***</csy>         
        <deu>My String 1***</deu>         
        <esp>My String 1***</esp>         
        <fra>My String 1***</fra>         
        <hun>My String 1***</hun>         
        <ita>My String 1***</ita>         
        <jpn>My String 1***</jpn>         
        <nld>My String 1***</nld>         
        <plk>My String 1***</plk>         
        <ptb>My String 1***</ptb>         
        <ptg>My String 1***</ptg>         
        <rus>My String 1***</rus>         
        <enu>My String 1</enu> 
        <chs>My String 2***</chs>         
        <cht>My String 2***</cht>         
        <csy>My String 2***</csy>         
        <deu>My String 2***</deu>         
        <esp>My String 2***</esp> 
        <fra>My String 2***</fra>         
        <hun>My String 2***</hun>
        <ita>My String 2***</ita> 
        <jpn>My String 2***</jpn> 
        <nld>My String 2***</nld> 
        <plk>My String 2***</plk> 
        <ptb>My String 2***</ptb> 
        <ptg>My String 2***</ptg> 
        <rus>My String 2***</rus> 
        <enu>My String 2</enu> 

It is recommended to use Microsoft Visual Studio when creating or making changes (adding, changing or removing strings) to a localization file. Make sure that the XML file is well formed and valid.  

Files open in Microsoft Visual Studio are automatically checked to be well formed, meaning the tags are symmetrical.

Multiple lines

When you have long string that are split into multiple lines make sure that there are no extra new lines or spaces that are easily added by some XML editors. Extra lines and spaces are shown also in the user interface.

For example, the string should NOT look like this:

                     Select parts in the model.
                     Select a master drawing in the list below.
                     Then click this button to create drawings.         

The string should look like this:

<enu>Select parts in the model. 
Select a master drawing in the list below. 
Then click this button to create drawings.</enu>

Microsoft Word and ellipsis

An ellipsis is a row of three periods (…).

Do not use Microsoft Word for adding or editing XML strings because AutoCorrect feature replaces ellipses automatically by a character “†¦”.

If you for example add a string “Loading drawings…” using Word, it looks like this:

<enu>Loading drawings…</enu> 

Step-by-step instructions

A localization file is automatically loaded for plugins (forms that inherit from PluginFormBase) if the filename and path of the XML file is the same as for the plug-in.

To localize an application that inherits from ApplicationFormBase, or a plugin which has a XML file name and a path that doesn’t match the plug-in, you must:

  • Set the language.

  • Load the localization files.

  • Call Localization.Localize() for your form.

Localization.Language = (string)Tekla.Structures.Datatype.Settings.GetValue("language"); 

Note that in case you need many XML files, you can read an arbitrary amount of them by calling Localization.LoadFile() method for each of them.

Message box localization

Message box message strings and titles are localized with the localization property's GetText method like this:

MessageBox.Show(Localization.GetText("MyMessage"), Localization.GetText("MyTitle"));

Strings in message box buttons (like OK and Cancel) cannot be localized. Translations of those buttons come automatically according to the selected language of the operating system.