Internationalization support in yFiles WPF (version 2.5)
Tips & TricksSummary
Description
There are basically two parts to i18n support and l10n in an application that uses one of the diagramming libraries of the yFiles product family:
- the graph representation itself: this includes the visual representation of node labels and edge labels, but also their representation when saving a graph to a graph exchange file format like GraphML
- the user interface (UI) of an application: this includes text of UI elements like buttons, etc.
Graph representation
I18n support for displaying the label depends on the actual label style used, as well as on the availability of suitable fonts that contain the correct glyphs for a specific language. The default implementations for the ILabelStyle interface support arbitrary fonts as well as all text orientations that exist for the .NET framework. Saving and loading localized diagrams with GraphML is also fully supported. For interactive label editing, a standard WPF TextBox implementation is used by default, which can be customized with standard .NET framework methods.
User interface
yFiles WPF uses commands for a lot of actions within the library, which can be bound to toolbar buttons, or menu items. The text shown for those commands as well as the default input bindings for invoking them via the keyboard can be changed by including custom resources named either yWorks.Canvas.CanvasResources or yWorks.yFiles.GraphResources to override the defaults.
The default strings and shortcuts are as follows:
yWorks.Canvas.CanvasResources:
| Name | Value |
|---|---|
| Copy | Copy |
| CopyKey | Ctrl+C |
| Cut | Cut |
| CutKey | Ctrl+X |
| DecreaseZoom | Zoom Out |
| Delete | Delete |
| DeleteKey | Delete |
| ExtendSelectionDown | Extend Selection Down |
| ExtendSelectionDownKey | Shift+Down |
| ExtendSelectionLeft | Extend Selection Left |
| ExtendSelectionLeftKey | Shift+Left |
| ExtendSelectionRight | Extend Selection Right |
| ExtendSelectionRightKey | Shift+Right |
| ExtendSelectionUp | Extend Selection Up |
| ExtendSelectionUpKey | Shift+Up |
| FitContent | Fit Content |
| IncreaseZoom | Zoom In |
| MoveDown | Move Down |
| MoveDownKey | Down |
| MoveFocusBack | Move Focus Backward |
| MoveFocusBackKey | Ctrl+Left |
| MoveFocusDown | Move Focus Down |
| MoveFocusDownKey | Ctrl+Down |
| MoveFocusForward | Move Focus Forward |
| MoveFocusForwardKey | Ctrl+Right |
| MoveFocusUp | Move Focus Up |
| MoveFocusUpKey | Ctrl+Up |
| MoveLeft | Move Left |
| MoveLeftKey | Left |
| MoveRight | Move Right |
| MoveRightKey | Right |
| MoveToPageDown | Move Page Down |
| MoveToPageDownKey | PageDown |
| MoveToPageUp | Move Page Up |
| MoveToPageUpKey | PageUp |
| MoveUp | Move Up |
| MoveUpKey | Up |
| New | New |
| NewKey | Ctrl+N |
| Open | Open |
| Paste | Paste |
| PasteKey | Ctrl+V |
| PixelImageExporter.OutOfMemory | Not enough memory for temporary image. |
| PrintJob.Description | Canvas Contents |
| PrintKey | Ctrl+P |
| PrintPreview | PrintPreview |
| PrintPreview.DocumentViewer.Window.Title | Print Preview |
| PrintPreviewKey | Ctrl+F2 |
| Redo | Redo |
| RedoKey | Ctrl+Y |
| Save | Save |
| SaveAs | Save As... |
| ScrollPageDown | Scroll Page Down |
| ScrollPageDownKey | PageDown |
| ScrollPageLeft | Scroll Page Left |
| ScrollPageRight | Scroll Page Right |
| ScrollPageUp | Scroll Page Up |
| ScrollPageUpKey | PageUp |
| SelectAll | Select All |
| SelectAllKey | Ctrl+A |
| Unavailable | Unavailable |
| Undo | Undo |
| UndoKey | Ctrl+Z |
| UpdateContentRect | Update Content Rectangle |
| Zoom | Zoom |
yWorks.yFiles.GraphResources:
| Name | Value |
|---|---|
| AddBend.RedoName | Add Bend |
| AddBend.UndoName | Remove Bend |
| AddLabel | Add Label |
| AddLabel.RedoName | Add Label |
| AddLabel.UndoName | Remove Label |
| AddLabelKey | Shift+F2 |
| AddPort.RedoName | Add Port |
| AddPort.UndoName | Remove Port |
| AdjustGroupNodeSize | Adjust Group Node Size |
| AdjustGroupNodeSize.RedoName | Adjust Group Node Size |
| AdjustGroupNodeSize.UndoName | Adjust Group Node Size |
| AdjustGroupNodeSizeKey | Ctrl+Shift+G |
| AdjustToSizeConstraints.RedoName | Adjust Node Size |
| AdjustToSizeConstraints.UndoName | Adjust Node Size |
| BeginEdgeCreation | Create Edge |
| CollapseGroup | Collapse Group |
| CollapseGroupKey | Ctrl+Subtract;Ctrl+OemMinus |
| CollapseNode.RedoName | Collapse Node |
| CollapseNode.UndoName | Expand Node |
| CreateEdge.RedoName | Add Edge |
| CreateEdge.UndoName | Remove Edge |
| CreateNode.RedoName | Add Node |
| CreateNode.UndoName | Remove Node |
| CreateStripe.RedoName | CreateStripe |
| CreateStripe.UndoName | Add Stripe |
| Cut.RedoName | Redo Cut |
| Cut.UndoName | Undo Cut |
| DeleteSelection.RedoName | Redo Delete |
| DeleteSelection.UndoName | Undo Delete |
| DeselectAll | Deselect All |
| DeselectAllKey | Ctrl+Shift+A |
| DeselectItem | Deselect Item |
| Duplicate | Duplicate |
| Duplicate.RedoName | Redo Duplicate |
| Duplicate.UndoName | Undo Duplicate |
| DuplicateKey | Ctrl+D |
| EditLabel | Edit Label |
| EditLabelKey | F2 |
| EnterGroup | Enter Group |
| EnterGroupKey | Ctrl+Enter |
| ExitGroup | Exit Group |
| ExitGroupKey | Ctrl+Backspace |
| ExpandGroup | Expand Group |
| ExpandGroupKey | Ctrl+Add;Ctrl+Oemplus |
| ExpandNode.RedoName | Expand Node |
| ExpandNode.UndoName | Collapse Node |
| FitGraphBounds | Fit Graph Bounds |
| GraphControl.OpenFileDialog.DefaultExt | graphml |
| GraphControl.OpenFileDialog.Filter | GraphML Files|.graphml|XML Files|.xml|All files|. |
| GraphControl.OpenFileDialog.Title | Open Diagram... |
| GraphControl.SaveFileDialog.DefaultExt | graphml |
| GraphControl.SaveFileDialog.Filter | GraphML Files|.graphml|XML Files|.xml|All files|. |
| GraphControl.SaveFileDialog.Title | Save Diagram... |
| GroupSelection | Group Selection |
| GroupSelectionKey | Ctrl+G |
| Move.RedoName | Move Items |
| Move.UndoName | Move Items |
| MoveHandle.RedoName | Move Handle |
| MoveHandle.UndoName | Move Handle |
| NodeDropInputMode.NodeDropped.RedoName | Add Node |
| NodeDropInputMode.NodeDropped.UndoName | Remove Node |
| OpenFileFailed.Caption | Error Loading File |
| OpenFileFailed.Message | There was a problem during the loading of the file. |
| Paste.RedoName | Redo Paste |
| Paste.UndoName | Undo Paste |
| RemoveBend.RedoName | Remove Bend |
| RemoveBend.UndoName | Add Bend |
| RemoveEdge.RedoName | Remove Edge |
| RemoveEdge.UndoName | Add Edge |
| RemoveLabel.RedoName | Remove Label |
| RemoveLabel.UndoName | Add Label |
| RemoveNode.RedoName | Remove Node |
| RemoveNode.UndoName | Add Node |
| RemovePort.RedoName | Remove Port |
| RemovePort.UndoName | Add Port |
| RemoveStripe.RedoName | Add Stripe |
| RemoveStripe.UndoName | Remove Stripe |
| ReparentStripe.RedoName | Reparent Stripe |
| ReparentStripe.UndoName | Reparent Stripe |
| ResizeNode.RedoName | Resize Node |
| ResizeNode.UndoName | Resize Node |
| ReverseEdge | Reverse Edge |
| ReverseEdge.RedoName | Reverse Edge |
| ReverseEdge.UndoName | Reverse Edge |
| ReverseEdgeKey | Ctrl+R |
| SaveFileFailed.Caption | Error Saving File |
| SaveFileFailed.Message | There was a problem during the saving of the file. |
| SelectItem | Select Item |
| SetCurrentItem | Set Current Item |
| SetEdgeStyle.RedoName | Change Edge Style |
| SetEdgeStyle.UndoName | Change Edge Style |
| SetLabelModelParameter.RedoName | Change Label Position |
| SetLabelModelParameter.UndoName | Change Label Position |
| SetLabelStyle.RedoName | Change Label Style |
| SetLabelStyle.UndoName | Change Label Style |
| SetLabelText.RedoName | Change Label Text |
| SetLabelText.UndoName | Change Label Text |
| SetLeaf.RedoName | Convert Back to Group Node |
| SetLeaf.UndoName | Convert to Normal Node |
| SetLocationModelParameter.RedoName | Change Port Location |
| SetLocationModelParameter.UndoName | Change Port Location |
| SetNodeStyle.RedoName | Change Node Style |
| SetNodeStyle.UndoName | Change Node Style |
| SetNonLeaf.RedoName | Convert Back to Normal Node |
| SetNonLeaf.UndoName | Convert to Group Node |
| SetParent.RedoName | Change Parent |
| SetParent.UndoName | Change Parent |
| SetPorts.RedoName | Reconnect Edge |
| SetPorts.UndoName | Reconnect Edge |
| SetPortStyle.RedoName | Change Port Style |
| SetPortStyle.UndoName | Change Port Style |
| SetPreferredLabelSize.RedoName | Change Preferred Label Size |
| SetPreferredLabelSize.UndoName | Change Preferred Label Size |
| SetStripeInsets.RedoName | Change Stripe Insets |
| SetStripeInsets.UndoName | Change Stripe Insets |
| SetStripeMinimumSize.RedoName | Change Minimum Stripe Size |
| SetStripeMinimumSize.UndoName | Change Minimum Stripe Size |
| SetStripeSize.RedoName | Change Stripe Size |
| SetStripeSize.UndoName | Change Stripe Size |
| SetStripeStyle.RedoName | Change Stripe Style |
| SetStripeStyle.UndoName | Change Stripe Style |
| ToggleGroupState | Toggle Group State |
| ToggleGroupStateKey | Ctrl+Multiply |
| ToggleItemSelection | Toggle Selection |
| ToggleItemSelectionKey | Ctrl+Space |
| Unavailable | Unavailable |
| UngroupSelection | Ungroup Selection |
| UngroupSelectionKey | Ctrl+U |
| ZoomToCurrentItem | Zoom To Current Item |