2.4 KiB
| title | caption | description | image | order |
|---|---|---|---|---|
| Localizing SOLIDWORKS add-ins using xCAD.NET framework | Localization | How to support multi language SOLIDWORKS add-ins by using of localized resources in xCAD framework | menu-localized.png | 7 |
xCAD frameworks supports resources in .NET applications to enable localization of the add-in, e.g. supporting multiple languages.
This technique allows to load localized string at runtime based on the Windows settings in the control panel.
Resources should be added to the corresponding localized .resx file (e.g. Resources.resx for default, Resources.ru.resx for Russian, Resources.fr.resx for French, etc.)
In order to reference the string from the resource, use the overloads of the constructors for the TitleAttribute and SummaryAttribute which allows to define title, tooltips, hint string for all elements across xCAD framework (i.e. menu commands, property page controls, macro feature, etc.)
Below is an example which demonstrates this technique. Text is localized as per resources below:
Menu
Two commands in menu are localized for Russian and English versions of the add-in.
{% code-snippet { file-name: ~LocalizationAddIn.*, regions: [Commands] } %}
Property Manager Page
Property Manager page title and tooltips for the controls are localized for Russian and English versions of the add-in.
{% code-snippet { file-name: ~LocalizationAddIn.*, regions: [PMPage] } %}
Macro Feature
Macro feature base name is localized to Russian and English versions of the add-in.
Note. Base name is only assigned while feature creation, feature won't be renamed after locale has changed.
In a similar way it is possible to use strings from the resources to return another data, e.g. text of the error for macro feature.
{% code-snippet { file-name: ~LocalizationAddIn.*, regions: [MacroFeature] } %}






