Localize Inventor .NET AddIn

By Adam Nagy

There are three things related to this:
1) Localizing the AddIn registration information that shows up in the Add-In Manager dialog
2) Localizing resources used by the Add-In assembly 
3) Localizing data for the installer of your Autodesk Exchange Apps store AddIn

In order to test the localization you would need a localized version of Inventor. You can download language packs from the Autodesk site for that: Autodesk Inventor 2014 Language Packs

Some information about this in the online help: Installing Language Packs

Localizing the AddIn registration information

This basically means adding translated texts inside the *.addin file that provides information about the AddIn. You can simply add a Language attribute to the tags that you want to localize. You should list the language spacific resources first and then the default resource which does not contain the Language tag. Like this:

Teste de localização
  Localization Test
  Un simples AddIn para testar a localização
  A simple AddIn to test localization

In this case I added a Brazilian Portuguese version of the DisplayName and Description tags. One way to get the number that you need to use for the tag is by checking the LCID Dec column on this site: Locale IDs Assigned by Microsoft 

Now when I check the AddIn information then depending on the language version of Inventor I started I get the appropriate text:

Addins

Local-enpt

Localizing resources used by the Add-In assembly 

You can take advantage of the .NET Framework localization to implement this. There are many articles that discuss this topic, but here are two of them:
Retrieving Resources in Satellite Assemblies
Creating Satellite Assemblies for Desktop Apps

To test things I simply created a new C# AddIn using the Inventor AddIn Wizard that is part of the SDK that comes with the Inventor 2014 installation and then followed the steps that are also listed in this article: Registering AutoCAD commands with localized names using .NET, and added the strings I wanted to use: TestString and TestCommand.

Then I created a button definition and a form, both of which rely on localized content. In case of the form I just modified its InitializeComponent function so that the assigned strings are coming from the resource files and did the same when creating the ButtonDefinition object. 

Visual Studio automatically created a wrapper class called Resources for my resources which makes it very easy to access the strings I want to use – e.g. when creating the button definition:

m_button = mgr.ControlDefinitions.AddButtonDefinition(
        Resources.TestCommand, "Autodesk:Adam:TestCommand", 
        CommandTypesEnum.kNonShapeEditCmdType);

Here is the result when running the AddIn in the English and the Brazilian version of Inventor:

Form-enpt

You can download the test project from here:
Download LocalizationTest 

Localizing data for the installer of your Autodesk Exchange Apps store AddIn

It's the same for all AddIn's on the Exhange Apps store: AutoCAD, Inventor, etc, so you can just follow the information provided in this blog post: About Exchange App Installer automatic Localization


Comments

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading