几何尺寸与公差论坛

 找回密码
 注册
查看: 3020|回复: 0

How to determine the current language in SolidWorks is running

[复制链接]
发表于 2008-8-27 10:05:24 | 显示全部楼层 |阅读模式
//GetLocalizedMenuName.bas

'--------------------------------------------
' How to determine the current language in SolidWorks is running
'
' Problem:
'       SolidWorks is now localised for many different languages.
'       This means the menu names are presented in the local language.
'       For addins which add to the SW menus, they need to know the
'       names of various menus in their call to:
'
'           SldWorks/Frame::AddMenuItem
'
'       This sample code shows how to determine the current language
'       and retrieve the local menu names for several of the standard
'       SolidWorks menus.
'
' Preconditions:
'       none
'
' Postconditions:
'       none
Option Explicit
Public Enum swMenuIdentifiers_e
    swFileMenu = 0
    swEditMenu = 1
    swViewMenu = 2
    swInsertMenu = 3
    swToolsMenu = 4
    swWindowMenu = 5
    swHelpMenu = 6
    swDeveloperToolsMenu = 7
    swViewToolbarsMenu = 8
End Enum
Sub main()
    Dim swApp                       As SldWorks.SldWorks
   
    Set swApp = CreateObject("SldWorks.Application")
   
    Debug.Print "Language = " + swApp.GetCurrentLanguage
    Debug.Print "  FileMenu             = " + swApp.GetLocalizedMenuName(swFileMenu)
    Debug.Print "  EditMenu             = " + swApp.GetLocalizedMenuName(swEditMenu)
    Debug.Print "  ViewMenu             = " + swApp.GetLocalizedMenuName(swViewMenu)
    Debug.Print "  InsertMenu           = " + swApp.GetLocalizedMenuName(swInsertMenu)
    Debug.Print "  ToolsMenu            = " + swApp.GetLocalizedMenuName(swToolsMenu)
    Debug.Print "  WindowMenu           = " + swApp.GetLocalizedMenuName(swWindowMenu)
    Debug.Print "  HelpMenu             = " + swApp.GetLocalizedMenuName(swHelpMenu)
    Debug.Print "  DeveloperToolsMenu   = " + swApp.GetLocalizedMenuName(swDeveloperToolsMenu)
    Debug.Print "  ViewToolbarsMenu     = " + swApp.GetLocalizedMenuName(swViewToolbarsMenu)
End Sub

' English OS + English SW 2001 SP13
'Language = english
'FileMenu = &File
'EditMenu = &Edit
'ViewMenu = &View
'InsertMenu = &Insert
'ToolsMenu = &Tools
'WindowMenu = &Window
'HelpMenu = &Help
'DeveloperToolsMenu = &DeveloperTools
'ViewToolbarsMenu = &Toolbars

' Spanish OS + Spanish SW 2001 SP11
'       SPR 119300 - "SldWorks::GetLocalizedMenuName returns incorrect strings on Spanish OS"
'Language = spanish
'FileMenu = &File                               <---- BUG
'EditMenu = &Edit                               <---- BUG
'ViewMenu = &View                               <---- BUG
'InsertMenu = &Insert                           <---- BUG
'ToolsMenu = &Tools                             <---- BUG
'WindowMenu = &Window                           <---- BUG
'HelpMenu = &Help                               <---- BUG
'DeveloperToolsMenu = &DeveloperTools           <---- BUG
'ViewToolbarsMenu = Barras de &herramientas

' French OS + French SW 2001 SP11
'Language = french
'FileMenu = &Fichier
'EditMenu = &Edition
'ViewMenu = Affic&hage
'InsertMenu = &Insertion
'ToolsMenu = &Outils
'WindowMenu = Fe&nêtre
'HelpMenu = &?
'DeveloperToolsMenu = &DeveloperTools           <---- BUG
'ViewToolbarsMenu = &Barre d'outils

' German OS + German SW 2001 SP11
'Language = german
'FileMenu = &Datei
'EditMenu = &Bearbeiten
'ViewMenu = &Ansicht
'InsertMenu = &Einfügen
'ToolsMenu = E&xtras
'WindowMenu = &Fenster
'HelpMenu = &Hilfe
'DeveloperToolsMenu = En&twickler
'ViewToolbarsMenu = S&ymbolleisten

' Italian OS + Italian SW 2001 SP11
'Language = italian
'FileMenu = &File
'EditMenu = &Modifica
'ViewMenu = &Visualizza
'InsertMenu = &Inserisci
'ToolsMenu = &Strumenti
'WindowMenu = Fi&nestra
'HelpMenu = &?
'DeveloperToolsMenu = &DeveloperTools       <---- BUG
'ViewToolbarsMenu = &Barre degli strumenti

' Japanese OS + Japanese SW 2001 SP11
'Language = japanese
'FileMenu = &Igrave;§&sup2;&Ugrave;(&F)
'EditMenu = &#8226;&Ograve;&#143;W(&E)
'ViewMenu = &#8226;\&#381;&brvbar;(&V)
'InsertMenu = ‘}“ü(&I)
'ToolsMenu = &Acirc;°&Ugrave;(&T)
'WindowMenu = &sup3;¨&Yacute;&Auml;&THORN;&sup3;(&W)
'HelpMenu = &Iacute;&Ugrave;&Igrave;&szlig;(&H)
'DeveloperToolsMenu = &#352;J”&shy;&Acirc;°&Ugrave;(&D)
'ViewToolbarsMenu = &Acirc;°&Ugrave;&Ecirc;&THORN;°(&T)
'--------------------------------------------
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|小黑屋|几何尺寸与公差论坛

GMT+8, 2024-12-23 00:19 , Processed in 0.035179 second(s), 19 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表