Localizing an Add-In
This topic explains how to localize a previously-created RobotStudio Add-In. For information about creating an Add-In, refer Creating an Add-In.
The most common way of creating the user interface of an Add-In is to define the elements of the interface in a separate XML file that gets loaded as a resource by the Add-In's assembly. As with most culture-neutral XML resources in Microsoft's .NET framework, it is possible to add culture-specific resources that get loaded when the assembly detects that the user's RobotStudio environment is running in a language other than English. For more information on localization and preferred practices, refer to Microsoft's Globalizing and Localizing .NET Framework Applications guide.
For defining the user interface, the default name of the XML file is "Ribbon.xml". Other files that are used to define the interface are: "CommandBarControls.xml" and "ControlHelpTexts.xml". Additional culture-specific XML files are automatically added as resources when they adhere to the following naming convention:
"file_name.language_code.xml"
Where file_name is the same name of the XML file processed by the LibraryCompiler (Ribbon, for example), and language_code is the two-letter ISO-639 language code.
For instance, if the developer intended to add Spanish-specific XML files (language-code es) to an Add-In, the XML files will be named: Ribbon.es.xml, ControlHelpTexts.es.xml and CommandBarControls.es.xml.
Adding the localization resource files
- You can start by creating default CommandBarControls.xml, Ribbon.xml and ControlHelpTexts.xml files, which are taken as the default, culture-neutral resources.
CommandBarControls.xml
<?xml version="1.0" encoding="utf-8" ?>
<CommandBarControls xmlns="urn:abb-robotics-robotstudio-commandbarcontrols"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:abb-robotics-robotstudio-commandbarcontrols file:///C:\Program%20Files%20(x86)\ABB\SDK\RobotStudio%202024%20SDK\CommandBarControls.xsd">
<!-- Controls defined by this add-in -->
<!-- The 'Start' button has defaultEnabled set to true which means it will be enabled
even before the add-in is loaded.
When it is clicked the add-in will be loaded and the ExecuteCommand handler will
be called. -->
<CommandBarButton id="SampleAddinUserDoc.StartButton"
caption="Dev - Show SampleAddinUserDoc" defaultEnabled="true"/>
<CommandBarButton id="SampleAddinUserDoc.CloseButton" caption="Close"/>
<CommandBarButton id="SampleAddinUserDoc.Button1" caption="Button 1"/>
<CommandBarButton id="SampleAddinUserDoc.Button2" caption="Button 2"/>
<CommandBarButton id="SampleAddinUserDoc.GalleryButton1"
caption="Gallery Button 1" defaultEnabled="true"/>
<CommandBarComboBox id="SampleAddinUserDoc.ComboBox1" caption="Select: ">
<Items>
<Item tag="1" caption="Item 1"/>
<Item tag="2" caption="Item 2"/>
<Item tag="3" caption="Item 3"/>
</Items>
</CommandBarComboBox>
<CommandBarPopup id="SampleAddinUserDoc.Menu1" caption="Sample Menu">
<Controls>
<Header caption="Header"/>
<Control id="SampleAddinUserDoc.Button1"/>
<Separator/>
<Control id="SampleAddinUserDoc.Button2"/>
</Controls>
</CommandBarPopup>
<CommandBarGalleryPopup id="SampleAddinUserDoc.Gallery1" caption="Sample Gallery"
textPos="Right" imageId="SampleAddinUserDoc.Button2">
<GalleryControls>
<Header caption="Header 1"/>
<Control id="SampleAddinUserDoc.GalleryButton1"/>
<Header caption="Header 2"/>
</GalleryControls>
<Controls>
<Control id="SampleAddinUserDoc.Button1"/>
</Controls>
</CommandBarGalleryPopup>
</CommandBarControls>
Ribbon.xml
<?xml version="1.0" encoding="utf-8" ?>
<Ribbon xmlns="urn:abb-robotics-robotstudio-ribbon"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:abb-robotics-ribbon file:///C:\Program%20Files%20(x86)\ABB\SDK\RobotStudio%202024%20SDK\Ribbon.xsd">
<Tabs>
<!-- Add a button to an existing ribbon tab -->
<Tab id="Home">
<!-- It is possible to add a button to an existing group, but note that
standard groups may change. In this sample we create a new group -->
<Group id="SampleAddinUserDoc" caption="SampleAddinUserDoc">
<Control id="SampleAddinUserDoc.StartButton" layout="Large"/>
</Group>
</Tab>
<!-- Create a new ribbon tab -->
<!-- #region SampleTab -->
<Tab id="SampleAddinUserDoc.Tab1" caption="Table" visible="false">
<Group id="Group1" caption="Group 1">
<Control id="SampleAddinUserDoc.Button1" layout="Large"/>
<Control id="SampleAddinUserDoc.Gallery1" layout="Large"/>
</Group>
<Group id="Group2" caption="Group 2">
<Control id="SampleAddinUserDoc.ComboBox1" layout="Small"/>
<Control id="SampleAddinUserDoc.Menu1" layout="Small"/>
</Group>
<Group id="Group3" caption="Group 3">
<Control id="SampleAddinUserDoc.CloseButton" layout="Large"/>
</Group>
</Tab>
<!-- #endregion -->
</Tabs>
</Ribbon>
ControlHelpText.xml
<?xml version="1.0" encoding="utf-8"?>
<Controls xmlns="urn:abb-robotics-robotstudio-controlhelptexts"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:abb-robotics-robotstudio-controlhelptexts file:///C:\Program%20Files%20(x86)\ABB\SDK\RobotStudio%202024%20SDK\ControlHelpTexts.xsd">
<!-- Help texts for controls specified in CommandBarControls.xml -->
<Control id="SampleAddinUserDoc.StartButton">For loading SampleAddinUserDoc</Control>
<Control id="SampleAddinUserDoc.CloseButton">Close the ribbon tab</Control>
<Control id="SampleAddinUserDoc.Button1">This button performs one thing</Control>
<Control id="SampleAddinUserDoc.Button2">This button performs another thing</Control>
<Control id="SampleAddinUserDoc.GalleryButton1">Placeholder text.</Control>
</Controls>
- Add three resources called CommandBarControls.es.xml, Ribbon.es.xml and ControlHelpTexts.es.xml to the project. These resources will contain the labels, captions, descriptions and other text elements from the user interface in Spanish, hence the es language code.
CommandBarControls.es.xml
<?xml version="1.0" encoding="utf-8" ?>
<CommandBarControls xmlns="urn:abb-robotics-robotstudio-commandbarcontrols"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:abb-robotics-robotstudio-commandbarcontrols file:///C:\Program%20Files%20(x86)\ABB\SDK\RobotStudio%202024%20SDK\CommandBarControls.xsd">
<!-- Controls defined by this add-in -->
<!-- The 'Start' button has defaultEnabled set to true which means it will be enabled
even before the add-in is loaded.
When it is clicked the add-in will be loaded and the ExecuteCommand handler will
be called. -->
<CommandBarButton id="SampleAddinUserDoc.StartButton"
caption="Dev - Mostrar SampleAddinUserDoc" defaultEnabled="true"/>
<CommandBarButton id="SampleAddinUserDoc.CloseButton" caption="Cerrar"/>
<CommandBarButton id="SampleAddinUserDoc.Button1" caption="Botón 1"/>
<CommandBarButton id="SampleAddinUserDoc.Button2" caption="Botón 2"/>
<CommandBarButton id="SampleAddinUserDoc.GalleryButton1" caption="Botón de Galería 1"
defaultEnabled="true"/>
<CommandBarComboBox id="SampleAddinUserDoc.ComboBox1" caption="Seleccionar: ">
<Items>
<Item tag="1" caption="Objecto 1"/>
<Item tag="2" caption="Objecto 2"/>
<Item tag="3" caption="Objecto 3"/>
</Items>
</CommandBarComboBox>
<CommandBarPopup id="SampleAddinUserDoc.Menu1" caption="Menú de Muestra">
<Controls>
<Header caption="Encabezado"/>
<Control id="SampleAddinUserDoc.Button1"/>
<Separator/>
<Control id="SampleAddinUserDoc.Button2"/>
</Controls>
</CommandBarPopup>
<CommandBarGalleryPopup id="SampleAddinUserDoc.Gallery1" caption="Galería de Muestra"
textPos="Right" imageId="SampleAddinUserDoc.Button2">
<GalleryControls>
<Header caption="Encabezado 1"/>
<Control id="SampleAddinUserDoc.GalleryButton1"/>
<Header caption="Encabezado 2"/>
</GalleryControls>
<Controls>
<Control id="SampleAddinUserDoc.Button1"/>
</Controls>
</CommandBarGalleryPopup>
</CommandBarControls>
Ribbon.es.xml
<?xml version="1.0" encoding="utf-8" ?>
<Ribbon xmlns="urn:abb-robotics-robotstudio-ribbon"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:abb-robotics-ribbon file:///C:\Program%20Files%20(x86)\ABB\SDK\RobotStudio%202024%20SDK\Ribbon.xsd">
<Tabs>
<!-- Add a button to an existing ribbon tab -->
<Tab id="Home">
<!-- It is possible to add a button to an existing group, but note that standard
groups may change. In this sample we create a new group. -->
<Group id="SampleAddinUserDoc" caption="SampleAddinUserDoc">
<Control id="SampleAddinUserDoc.StartButton" layout="Large"/>
</Group>
</Tab>
<!-- Create a new ribbon tab -->
<!-- #region SampleTab -->
<Tab id="SampleAddinUserDoc.Tab1" caption="Tabla" visible="false">
<Group id="Group1" caption="Grupo 1">
<Control id="SampleAddinUserDoc.Button1" layout="Large"/>
<Control id="SampleAddinUserDoc.Gallery1" layout="Large"/>
</Group>
<Group id="Group2" caption="Grupo 2">
<Control id="SampleAddinUserDoc.ComboBox1" layout="Small"/>
<Control id="SampleAddinUserDoc.Menu1" layout="Small"/>
</Group>
<Group id="Group3" caption="Grupo 3">
<Control id="SampleAddinUserDoc.CloseButton" layout="Large"/>
</Group>
</Tab>
<!-- #endregion -->
</Tabs>
</Ribbon>
ControlHelpText.es.xml
<?xml version="1.0" encoding="utf-8"?>
<Controls xmlns="urn:abb-robotics-robotstudio-controlhelptexts"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:abb-robotics-robotstudio-controlhelptexts file:///C:\Program%20Files%20(x86)\ABB\SDK\RobotStudio%202024%20SDK\ControlHelpTexts.xsd">
<!-- Help texts for controls specified in CommandBarControls.xml -->
<Control id="SampleAddinUserDoc.StartButton">For loading SampleAddinUserDoc</Control>
<Control id="SampleAddinUserDoc.CloseButton">Close the ribbon tab</Control>
<Control id="SampleAddinUserDoc.Button1">This button performs one thing</Control>
<Control id="SampleAddinUserDoc.Button2">This button performs another thing</Control>
<Control id="SampleAddinUserDoc.GalleryButton1">Placeholder text.</Control>
</Controls>
- Once the necessary resource files have been added, build the Add-In and add the assembly in a directory accessible by RobotStudio. Changing RobotStudio's language to Spanish will display the user interface in Spanish.