Delta Shell uses standard .NET feature to support multiple languages.

Switching language is done using configuration file where language can be specified in a form of a string "nl-NL". After language is set in the configuration file , all messages and user interface forms will switch to that language during the next start of the program.

The following rules should be followed in order to translate Delta Shell user interface to the new language:

  1. Project: Setting up resources file for Project. Projects --> Properties --> Resources --> Click “This project does not contain a default resources file. Click here to create one."


  2. Forms need to be translated (localized) using Visual Studio designer a) Set Localizable property of the Form to true b) Switch to the required language in the Language property c) Translate all visual elements to the new language.

          

          Do not try to localize Partial WizardDialog classes this way. But put the localization in the constructor.  

          

 

   3.  String constants need to be translated manually using R# 9. Press F6 (Intellij IDEA scheme) or Ctrl+Shift+R (Visual Studio scheme) after selecting the string. Check Resource file. Results will be automatically stored in the Resource file

         

  Avoid using string constants in the source

  4. Properties attribute Category, DisplayName and Description

      For Category use [ResourcesCategory(typeof(Resources), "Category_resource")]

      For DisplayName use [ResourcesDisplayName(typeof(Resources), "DisplayName_resource")]

      For Description use [ResourcesDescription(typeof(Resources), "Description_resource")]

      (namespace DelftTools.Utils)

     

        Reminder: Find usages (ALT-F7 using Rescharper Intellij IDEA scheme or Shift-F12 Resharper Visual Studio scheme) will not find usage because de resource item name is a string. So the best practice  is to start these resource item names with noticeable text. Example Category_ for Category.

       

 

  5. XAML: Localizing Xtensible Application Markup Language (xaml) files. Example Ribbon

      Set a namespace alias. Example:   xmlns:resx="clr-namespace:DeltaShell.Plugins.CommonTools.Gui.Properties"

      Then localize it like: Header="{x:Static resx:Resources.Ribbon_ContextualGroup_Charting}"

     


  6.  Menus and toolbars added using app.config file of the plugin need to be added manually to the corresponding language resource file and translated. Follow the next steps:

        1) Check if you have required resource file in Properties/ folder of the plugin, otherwise add a new resource file to the project called Resource.nl-NL.resx (or any other language, abbreviations for the languages can be found here: http://msdn.microsoft.com/en-us/goglobal/bb896001.aspx)

        2) Move that file into Properties folder

        3) Check your app.conf file for any text="name of the menu item" elements and add name of the item to the resource file as a string resource as shown on the screenshots below:

            

              

              The text can be specified in the app.config at both the item and the command. If specified the text of the item will be used.
               In the Resources file you can use either <itemName>/<commandId> or <itemName>_text/<commandId>_text for the text property. When both are specified <itemName>_text/<commandId>_text is used.
               The tooltip of the command can be specified in the Resources file as <commandId>_tooltip
               In the same way, the category of the command can be specified in the Resources file as <commandId>_category
               See screenshot below

                


ResX Manager TOOL:

     Get "ResX Manager" from NuGet:  Tools --> extensions and updates --> Search for resxmanager

     

 1. Add new language: Open ResX Manager and select button "Add new language" and add a new language.

     

  2. Translating: using "ResX Manager"

      

  3. Translating: using ResxManager Export, Microsoft Excel, ResxManager Import

       a. export to Excel

        

        b. Edit in Microsoft Excel:

       

        c. Delete Delete unused columns so no changes by others will be overwritten and no empty resources files will be created 

       

        d. Import the Excel file (file must be closed in Microsoft Excel)

       


Completely new language

       When Delta Shell needs to be translated to completely new language, the build\tools\PluginPostBuild.cmd also needs to be updated to make sure that resource files are copied into loader/plugins/ folder:

...
rem copying plugin language-specific resource files
rem ============================================================
rem hardcoded for now, make it generic when necessary (ADD MORE LANGUAGES HERE)

if exist %TARGET_DIR%\%PROJECT_NAME%.dll (
  xcopy /D /Y /Q %TARGET_DIR%%PROJECT_NAME%.dll %PLUGIN_HOME% > nul
)

if exist %TARGET_DIR%\nl (
  if not exist %PLUGIN_HOME%\nl md %PLUGIN_HOME%\nl
  xcopy /D /Y /Q %TARGET_DIR%\nl %PLUGIN_HOME%\nl > nul
)

...

   Also MSI setups needs to be modified to include these resource files, currently it is available only for developers or when using DeltaShell.zip artifact.