DevExpress WinForm 控件汉化方法 代码(三)

(8) XtraLayout.Localization.LayoutLocalizer


Imports System.Resources
Imports System.Reflection
Imports DevExpress.XtraLayout.Localization

Public Class XLocallizerLayout
    Inherits DevExpress.XtraLayout.Localization.LayoutLocalizer
    Public Overrides ReadOnly Property Language() As String
        Get
            Return "Chinese"
        End Get
    End Property
    Public Overrides Function GetLocalizedString(ByVal id As DevExpress.XtraLayout.Localization.LayoutStringId) As String
        Dim ret As String = ""
        Select Case id
            Case LayoutStringId.AddTabMenuText : Return "增加标签页"   'Add Tab
            Case LayoutStringId.ControlGroupDefaultText : Return "群组"   'Group
            Case LayoutStringId.CreateEmptySpaceItem : Return "创建空白区域项目"   'Create EmptySpace Item
            Case LayoutStringId.CreateTabbedGroupMenuText : Return "创建群组标签页"   'Create Tab Control
            Case LayoutStringId.CustomizationFormTitle : Return "定制"   'Customization
            Case LayoutStringId.DefaultActionText : Return "默认动作"   'DefaultAction
            Case LayoutStringId.DefaultEmptyText : Return "无"   'none
            Case LayoutStringId.DefaultItemText : Return "项目"   'Item
            Case LayoutStringId.EmptyRootGroupText : Return "在这里放置控件"   'Drop controls here
            Case LayoutStringId.EmptySpaceItemDefaultText : Return "空白区域项目"   'Empty Space Item
            Case LayoutStringId.EmptyTabbedGroupText : Return "将群组拖放到群组标签页区域"   'Drag drop groups into the caption area
            Case LayoutStringId.FreeSizingMenuItem : Return "允许改变大小"   'Free sizing
            Case LayoutStringId.GroupItemsMenuText : Return "群组"   'Group
            Case LayoutStringId.HiddenItemsNodeText : Return "隐藏的项"   'Hidden Items
            Case LayoutStringId.HiddenItemsPageTitle : Return "隐藏项目"   'Hidden Items
            Case LayoutStringId.HideCustomizationFormMenuText : Return "隐藏定制表格"   'Hide Customization Form
            Case LayoutStringId.HideItemMenutext : Return "隐藏项目"   'Hide Item
            Case LayoutStringId.HideSpaceMenuItem : Return "折叠文本占位符"   'Collapse Text Placeholder
            Case LayoutStringId.HideTextMenuItem : Return "隐藏文本"   'Hide Text
            Case LayoutStringId.LayoutControlDescription : Return "版面控制"   'Layout control
            Case LayoutStringId.LayoutGroupDescription : Return "版面设计控制器的群组元素"   'Layout control group element
            Case LayoutStringId.LayoutItemDescription : Return "版面设计控制器的项目元素"   'Layout control item element
            Case LayoutStringId.LayoutResetConfirmationDialogCaption : Return "重置确认的布局"   'Layout reset confirmation
            Case LayoutStringId.LayoutResetConfirmationText : Return "您将要重设您的自定义布局。您要继续吗?"   'You are about to reset your layout customizations. Do you want to proceed?
            Case LayoutStringId.LoadButtonHintText : Return "XML 文件加载的布局"   'Load layout from XML file
            Case LayoutStringId.LoadHintCaption : Return "加载(Ctrl+O)"   'Load layout(Ctrl+O)
            Case LayoutStringId.LockHeightMenuItem : Return "锁定高度"   'Lock Height
            Case LayoutStringId.LockItemSizeMenuText : Return "锁定项目大小"   'Lock Item Size
            Case LayoutStringId.LockMenuGroup : Return "强制限定大小"   'Size Constraints
            Case LayoutStringId.LockSizeMenuItem : Return "锁定大小"   'Lock Size
            Case LayoutStringId.LockWidthMenuItem : Return "锁定宽度"   'Lock Width
            Case LayoutStringId.RedoButtonHintText : Return "重做一次操作"   'Redo last action
            Case LayoutStringId.RedoHintCaption : Return "重做(Ctrl+Y)"   'Redo(Ctrl+Y)
            Case LayoutStringId.RenameMenuText : Return "重命名"   'Rename
            Case LayoutStringId.RenameSelected : Return "重命名"   'Rename
            Case LayoutStringId.ResetConstraintsToDefaultsMenuItem : Return "重设为默认值"   'Reset to default
            Case LayoutStringId.ResetLayoutMenuText : Return "重设版面"   'Reset Layout
            Case LayoutStringId.SaveButtonHintText : Return "保存到 XML 文件的布局"   'Save layout to XML file
            Case LayoutStringId.SaveHintCaption : Return "保存(Ctrl+S)"   'Save layout(Ctrl+S)
            Case LayoutStringId.ShowCustomizationFormMenuText : Return "定制版面"   'Customize Layout
            Case LayoutStringId.ShowSpaceMenuItem : Return "显示占位符文本"   'Show Text PlaceHolder
            Case LayoutStringId.ShowTextMenuItem : Return "显示文本"   'Show Text
            Case LayoutStringId.SimpleLabelItemDefaultText : Return "标签"   'Label
            Case LayoutStringId.SimpleSeparatorItemDefaultText : Return "分隔符"   'Separator
            Case LayoutStringId.SplitterItemDefaultText : Return "分隔器版面設計控制器的群組標籤頁項目"   'Splitter
            Case LayoutStringId.TabbedGroupDescription : Return "版面控制器的群组标签页元素"   'Layout control tabbedGroup element
            Case LayoutStringId.TextPositionBottomMenuText : Return "下方"   'Bottom
            Case LayoutStringId.TextPositionLeftMenuText : Return "左边"   'Left
            Case LayoutStringId.TextPositionMenuText : Return "文本位置"   'Text Position
            Case LayoutStringId.TextPositionRightMenuText : Return "右边"   'Right
            Case LayoutStringId.TextPositionTopMenuText : Return "上方"   'Top
            Case LayoutStringId.TreeViewPageTitle : Return "版面设计树状视图"   'Layout Tree View
            Case LayoutStringId.TreeViewRootNodeName : Return "最上层"   'Root
            Case LayoutStringId.UndoButtonHintText : Return "撤消上次操作"   'Undo last action
            Case LayoutStringId.UndoHintCaption : Return "还原(Ctrl+Z)"   'Undo(Ctrl+Z)
            Case LayoutStringId.UnGroupItemsMenuText : Return "解除群组设定"   'Ungroup
            Case LayoutStringId.UnGroupTabbedGroupMenuText : Return "解除群组标签页设定"   'Remove Tab Control
            Case LayoutStringId.UnLockItemSizeMenuText : Return "解除项目大小锁定"   'UnLock Item Size
            Case Else
                ret = id.ToString
        End Select
        Return ret
    End Function

End Class

(9)XtraNavBar.NavBarLocalizer


Imports System.Resources
Imports System.Reflection
Imports DevExpress.XtraNavBar


Public Class XLocallizerNavBar
    Inherits DevExpress.XtraNavBar.NavBarLocalizer
    Public Overrides ReadOnly Property Language() As String
        Get
            Return "Chinese"
        End Get
    End Property
    Public Overrides Function GetLocalizedString(ByVal id As DevExpress.XtraNavBar.NavBarStringId) As String
        Dim ret As String = ""
        Select Case id
            Case NavBarStringId.NavPaneChevronHint : Return "配置按钮"   'Configure buttons
            Case NavBarStringId.NavPaneMenuAddRemoveButtons : Return "添加或删除按钮(&A)"   '&Add or Remove Buttons
            Case NavBarStringId.NavPaneMenuShowFewerButtons : Return "显示少量按钮(&F)"   'Show &Fewer Buttons
            Case NavBarStringId.NavPaneMenuShowMoreButtons : Return "显示更多按钮(&M)"   'Show &More Buttons
            Case Else
                ret = id.ToString
        End Select
        Return ret
    End Function

End Class

(10)XtraPivotGrid.Localization.PivotGridLocalizer

 


Imports System.Resources
Imports System.Reflection
Imports DevExpress.XtraPivotGrid.Localization

Public Class XLocallizerPivotGrid
    Inherits DevExpress.XtraPivotGrid.Localization.PivotGridLocalizer
    Public Overrides ReadOnly Property Language() As String
        Get
            Return "Chinese"
        End Get
    End Property
    Public Overrides Function GetLocalizedString(ByVal id As DevExpress.XtraPivotGrid.Localization.PivotGridStringId) As String
        Dim ret As String = ""
        Select Case id
            Case PivotGridStringId.Alt_BottomPanelOnly1by4Layout : Return "[Bottom Panel Only 1 by 4 Layout]"   '[Bottom Panel Only 1 by 4 Layout]
            Case PivotGridStringId.Alt_BottomPanelOnly2by2Layout : Return "[Bottom Panel Only 2 by 2 Layout]"   '[Bottom Panel Only 2 by 2 Layout]
            Case PivotGridStringId.Alt_Collapse : Return "[折叠]"   '[Collapse]
            Case PivotGridStringId.Alt_ColumnAreaHeaders : Return "[列区标题]"   '[Column Area Headers]
            Case PivotGridStringId.Alt_DataAreaHeaders : Return "[数据区标题]"   '[Data Area Headers]
            Case PivotGridStringId.Alt_DragHideField : Return "隐藏"   'Hide
            Case PivotGridStringId.Alt_Expand : Return "[展开]"   '[Expand]
            Case PivotGridStringId.Alt_FieldListHeaders : Return "[隐藏字段的标题]"   '[Hidden Field's Headers]
            Case PivotGridStringId.Alt_FilterAreaHeaders : Return "[过滤区标题]"   '[Filter Area Headers]
            Case PivotGridStringId.Alt_FilterButton : Return "[筛选]"   '[Filter]
            Case PivotGridStringId.Alt_FilterButtonActive : Return "[已筛选]"   '[Filtered]
            Case PivotGridStringId.Alt_FilterWindowSizeGrip : Return "[调整大小]"   '[Resize]
            Case PivotGridStringId.Alt_LayoutButton : Return "[布局按钮]"   '[Layout Button]
            Case PivotGridStringId.Alt_RowAreaHeaders : Return "[行区标题]"   '[Row Area Headers]
            Case PivotGridStringId.Alt_SortedAscending : Return "(升序)"   '(Ascending)
            Case PivotGridStringId.Alt_SortedDescending : Return "(降序)"   '(Descending)
            Case PivotGridStringId.Alt_StackedDefaultLayout : Return "[默认层叠布局]"   '[Stacked Default Layout]
            Case PivotGridStringId.Alt_StackedSideBySideLayout : Return "[并排层叠布局]"   '[Stacked Side By Side Layout]
            Case PivotGridStringId.Alt_TopPanelOnlyLayout : Return "[只上面板布局]"   '[Top Panel Only Layout]
            Case PivotGridStringId.CannotCopyMultipleSelections : Return "此命令不能多次选择"   'This command cannot be used on multiple selections.
            Case PivotGridStringId.CellError : Return "错误"   'Error
            Case PivotGridStringId.ColumnArea : Return "列区"   'Column Area
            Case PivotGridStringId.ColumnHeadersCustomization : Return "拖动列至此"   'Drop Column Fields Here
            Case PivotGridStringId.CustomizationFormAddTo : Return "添加到"   'Add To
            Case PivotGridStringId.CustomizationFormBottomPanelOnly1by4 : Return "Areas Section Only (1 by 4)"   'Areas Section Only (1 by 4)
            Case PivotGridStringId.CustomizationFormBottomPanelOnly2by2 : Return "Areas Section Only (2 by 2)"   'Areas Section Only (2 by 2)
            Case PivotGridStringId.CustomizationFormCaption : Return "PivotGrid字段列表"   'PivotGrid Field List
            Case PivotGridStringId.CustomizationFormDeferLayoutUpdate : Return "更新延迟布局"   'Defer Layout Update
            Case PivotGridStringId.CustomizationFormHiddenFields : Return "隐藏字段"   'Hidden Fields
            Case PivotGridStringId.CustomizationFormHint : Return "拖动自动在区域下方之间:"   'Drag fields between areas below:
            Case PivotGridStringId.CustomizationFormLayoutButtonTooltip : Return "自定义布局"   'Customization Form Layout
            Case PivotGridStringId.CustomizationFormListBoxText : Return "拖动字段到此自定义布局"   'Drag a field here to customize layout
            Case PivotGridStringId.CustomizationFormStackedDefault : Return "字段区和区域层叠"   'Fields Section and Areas Section Stacked
            Case PivotGridStringId.CustomizationFormStackedSideBySide : Return "字段区和区域并排"   'Fields Section and Areas Section Side-By-Side
            Case PivotGridStringId.CustomizationFormText : Return "拖动数据项至PivotGrid"   'Drag Items to the PivotGrid
            Case PivotGridStringId.CustomizationFormTopPanelOnly : Return "字段区域"   'Fields Section Only
            Case PivotGridStringId.CustomizationFormUpdate : Return "(更新)"   'Update
            Case PivotGridStringId.DataArea : Return "数据区"   'Data Area
            Case PivotGridStringId.DataFieldCaption : Return "数据"   'Data
            Case PivotGridStringId.DataHeadersCustomization : Return "拖动数据项至此"   'Drop Data Items Here
            Case PivotGridStringId.EditPrefilter : Return "编辑过虑器"   'Edit Prefilter
            Case PivotGridStringId.FilterArea : Return "筛选区"   'Filter Area
            Case PivotGridStringId.FilterBlank : Return "(空)"   '(Blank)
            Case PivotGridStringId.FilterCancel : Return "取消"   'Cancel
            Case PivotGridStringId.FilterHeadersCustomization : Return "拖动筛选字段至此"   'Drop Filter Fields Here
            Case PivotGridStringId.FilterHideAll : Return "(隐藏所有)"   '(Hide All)
            Case PivotGridStringId.FilterHideBlanks : Return "(隐藏空)"   '(Hide Blanks)
            Case PivotGridStringId.FilterInvert : Return "反向过滤"   'Invert Filter
            Case PivotGridStringId.FilterOk : Return "确定"   'OK
            Case PivotGridStringId.FilterPopupToolbarFilterTypeExcluded : Return "过滤器类型: 排除"   'Filter Type: Excluded
            Case PivotGridStringId.FilterPopupToolbarIncrementalSearch : Return "渐进式搜索"   'Incremental Search
            Case PivotGridStringId.FilterPopupToolbarInvertFilter : Return "反相筛选器"   'Invert Filter
            Case PivotGridStringId.FilterPopupToolbarMultiSelection : Return "多重选择"   'Multi-Selection
            Case PivotGridStringId.FilterPopupToolbarRadioMode : Return "无线电模式"   'Radio Mode
            Case PivotGridStringId.FilterPopupToolbarShowOnlyAvailableItems : Return "显示唯一可用的项目"   'Show Only Available Items
            Case PivotGridStringId.FilterShowAll : Return "显示全部"   '(Show All)
            Case PivotGridStringId.FilterShowBlanks : Return "显示空白"   '(Show Blanks)
            Case PivotGridStringId.FilterType : Return "过滤类型"   'Filter Type
            Case PivotGridStringId.FilterTypeExcluded : Return "隐藏所选值"   'Hide selected values
            Case PivotGridStringId.FilterTypeIncluded : Return "显示所选值"   'Show selected values
            Case PivotGridStringId.GrandTotal : Return "总计"   'Grand Total
            Case PivotGridStringId.OLAPDrillDownFilterException : Return "当在一个报表的筛选字段中选择了多个项目时显示明细命令将无法执行。在执行之前请在报表筛选区域为每一个筛选选择一个单独项目。"   'Show Details command cannot be executed when multiple items are selected in a report filter field. Select a single item for each field in the report filter area before performing a drillthrough.
            Case PivotGridStringId.OLAPMeasuresCaption : Return "量度"   'Measures
            Case PivotGridStringId.OLAPNoOleDbProvidersMessage : Return "为了使用 PivotGrid OLAP 功能,您应该 MS OLAP OleDb 提供程序安装在您的 system.\r\n 可以在这里下载:"   'In order to use the PivotGrid OLAP functionality, you should have a MS OLAP OleDb provider installed on your system.\r\nYou can download it here:
            Case PivotGridStringId.PopupMenuClearSorting : Return "取消排序"   'Clear Sorting
            Case PivotGridStringId.PopupMenuCollapse : Return "收缩"   'Collapse
            Case PivotGridStringId.PopupMenuCollapseAll : Return "全部收缩"   'Collapse All
            Case PivotGridStringId.PopupMenuExpand : Return "展开"   'Expand
            Case PivotGridStringId.PopupMenuExpandAll : Return "全部展开"   'Expand All
            Case PivotGridStringId.PopupMenuFieldOrder : Return "排序"   'Order
            Case PivotGridStringId.PopupMenuHideField : Return "隐藏"   'Hide
            Case PivotGridStringId.PopupMenuHideFieldList : Return "隐藏字段列表"   'Hide Field List
            Case PivotGridStringId.PopupMenuHidePrefilter : Return "隐藏过滤器"   'Hide Prefilter
            Case PivotGridStringId.PopupMenuMovetoBeginning : Return "移到开头"   'Move to Beginning
            Case PivotGridStringId.PopupMenuMovetoEnd : Return "移到最后"   'Move to End
            Case PivotGridStringId.PopupMenuMovetoLeft : Return "移到左边"   'Move to Left
            Case PivotGridStringId.PopupMenuMovetoRight : Return "移到右边"   'Move to Right
            Case PivotGridStringId.PopupMenuRefreshData : Return "更新数据"   'Reload Data
            Case PivotGridStringId.PopupMenuRemoveAllSortByColumn : Return "移除所有排序"   'Remove All Sorting
            Case PivotGridStringId.PopupMenuShowExpression : Return "表达式编辑器..."   'Expression Editor...
            Case PivotGridStringId.PopupMenuShowFieldList : Return "显示字段列表"   'Show Field List
            Case PivotGridStringId.PopupMenuShowPrefilter : Return "显示过滤器"   'Show Prefilter
            Case PivotGridStringId.PopupMenuSortAscending : Return "升序"   'Sort A-Z
            Case PivotGridStringId.PopupMenuSortDescending : Return "降序"   'Sort Z-A
            Case PivotGridStringId.PopupMenuSortFieldByColumn : Return "按列'{0}'排序"   'Sort \"{0}\" by This Column
            Case PivotGridStringId.PopupMenuSortFieldByRow : Return "按行'{0}'排序"   'Sort \"{0}\" by This Row
            Case PivotGridStringId.PrefilterFormCaption : Return "PivotGrid过滤器"   'PivotGrid Prefilter
            Case PivotGridStringId.PrefilterInvalidCriteria : Return "过滤条件错误。"   'An error occurs in the Prefilter criteria. Please detect invalid property captions inside the criteria operands and correct or remove them.
            Case PivotGridStringId.PrefilterInvalidProperty : Return "(无效的属性)"   '(invalid property)
            Case PivotGridStringId.PrintDesigner : Return "打印设计"   'Print Designer
            Case PivotGridStringId.PrintDesignerCategoryDefault : Return "默认"   'Default
            Case PivotGridStringId.PrintDesignerCategoryFieldValues : Return "字段值"   'Field Values
            Case PivotGridStringId.PrintDesignerCategoryHeaders : Return "标题"   'Headers
            Case PivotGridStringId.PrintDesignerCategoryLines : Return "线"   'Lines
            Case PivotGridStringId.PrintDesignerColumnHeaders : Return "列标题"   'Column Headers
            Case PivotGridStringId.PrintDesignerDataHeaders : Return "数据标题"   'Data Headers
            Case PivotGridStringId.PrintDesignerFilterHeaders : Return "筛选标题"   'Filter Headers
            Case PivotGridStringId.PrintDesignerHeadersOnEveryPage : Return "标题在每一个页面"   'Headers On Every Page
            Case PivotGridStringId.PrintDesignerHorizontalLines : Return "水平线"   'Horizontal Lines
            Case PivotGridStringId.PrintDesignerMergeColumnFieldValues : Return "合并列字段值"   'Merge Column Field Values
            Case PivotGridStringId.PrintDesignerMergeRowFieldValues : Return "合并行字段值"   'Merge Row Field Values
            Case PivotGridStringId.PrintDesignerPageBehavior : Return "状态"   'Behavior
            Case PivotGridStringId.PrintDesignerPageOptions : Return "选项"   'Options
            Case PivotGridStringId.PrintDesignerRowHeaders : Return "行标题"   'Row Headers
            Case PivotGridStringId.PrintDesignerUnusedFilterFields : Return "未使用过滤字段"   'Unused Filter Fields
            Case PivotGridStringId.PrintDesignerUsePrintAppearance : Return "使用打印版面"   'Use Print Appearance
            Case PivotGridStringId.PrintDesignerVerticalLines : Return "垂直线"   'Vertical Lines
            Case PivotGridStringId.RowArea : Return "行区"   'Row Area
            Case PivotGridStringId.RowHeadersCustomization : Return "拖动行至此"   'Drop Row Fields Here
            Case PivotGridStringId.SearchBoxText : Return "搜索"   'Search
            Case PivotGridStringId.StatusBad : Return "坏"   'Bad
            Case PivotGridStringId.StatusGood : Return "好"   'Good
            Case PivotGridStringId.StatusNeutral : Return "中立"   'Neutral
            Case PivotGridStringId.SummaryAverage : Return "平均"   'Average
            Case PivotGridStringId.SummaryCount : Return "计数"   'Count
            Case PivotGridStringId.SummaryCustom : Return "自定义"   'Custom
            Case PivotGridStringId.SummaryMax : Return "最大"   'Max
            Case PivotGridStringId.SummaryMin : Return "最小"   'Min
            Case PivotGridStringId.SummaryStdDev : Return "标准差估计"   'StdDev
            Case PivotGridStringId.SummaryStdDevp : Return "扩展标准差"   'StdDevp
            Case PivotGridStringId.SummarySum : Return "总数"   'Sum
            Case PivotGridStringId.SummaryVar : Return "变异数估计"   'Var
            Case PivotGridStringId.SummaryVarp : Return "扩展变异数"   'Varp
            Case PivotGridStringId.TopValueOthersRow : Return "其它"   'Others
            Case PivotGridStringId.Total : Return "合计"   'Total
            Case PivotGridStringId.TotalFormat : Return "{0} 合计"   '{0} Total
            Case PivotGridStringId.TotalFormatAverage : Return "{0} 平均"   '{0} Average
            Case PivotGridStringId.TotalFormatCount : Return "{0} 计数"   '{0} Count
            Case PivotGridStringId.TotalFormatCustom : Return "{0} 自定义"   '{0} Custom
            Case PivotGridStringId.TotalFormatMax : Return "{0} 最大"   '{0} Max
            Case PivotGridStringId.TotalFormatMin : Return "{0} 最小"   '{0} Min
            Case PivotGridStringId.TotalFormatStdDev : Return "{0} 标准差估计"   '{0} StdDev
            Case PivotGridStringId.TotalFormatStdDevp : Return "{0} 扩展标准差"   '{0} StdDevp
            Case PivotGridStringId.TotalFormatSum : Return "{0} 总数"   '{0} Sum
            Case PivotGridStringId.TotalFormatVar : Return "{0} 变异数估计"   '{0} Var
            Case PivotGridStringId.TotalFormatVarp : Return "{0} 扩展变异数"   '{0} Varp
            Case PivotGridStringId.TrendGoingDown : Return "下沉"   'Going Down
            Case PivotGridStringId.TrendGoingUp : Return "上升"   'Going Up
            Case PivotGridStringId.TrendNoChange : Return "不改变"   'No Change
            Case PivotGridStringId.ValueError : Return "错误"   'Error
            Case Else
                ret = id.ToString
        End Select
        Return ret
    End Function

End Class

你可能感兴趣的:(DevExpress)