Internationalization Support
Questions & AnswersSummary
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.
yFiles for Java
-
graph representation:
i18n support for displaying labels is provided by the Java Runtime Environment in conjunction with a suitable font that contains the correct glyphs for a specific language. With Java version 5.0 and greater, Java's logical font "Dialog" covers most glyphs available on current operating system installations.
The following figure shows a simple graph created using the yEd graph editor on a default Windows XP installation with JRE 6.Saving and loading of localized diagrams with GraphML is fully supported. The GraphML file that encodes this graph is available as a resource to this article, see below.
From the following excerpt, you can see that the GraphML file contains the localized label text encoded in UTF-8 (Unicode Transformation Format). Carefully observe that the glyphs of any label text are stored left-to-right, the proper direction for the text is recognized by the JRE and is accounted for when the text is actually rendered.
This other Knowledge Base article explains further aspects of using Unicode representation in labels.
-
user interface:
i18n support in and l10n of the user interface of a Java application in general is described in the Java Tutorial, for example. The Java Internationalization page and the Internationalization FAQ provide extensive information on all aspects of i18n support in Java.
The settings dialogs and components that come as part of yFiles for Java provide i18n support as described in the yFiles for Java Developer's Guide: Internationalization and Localization
In particular, l10n is achieved by means of.propertiesfiles as presented in the OptionHandlerDemo.
Note that exporting the visual representation of a graph using the yFiles extension package yExport currently yields incorrect results for languages that are written right-to-left, like, e.g., Hebrew or Arabic.
yFiles.NET
-
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 theILabelStyleinterface 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 Windows FormsTextBoxBaseimplementation is used by default, which can be customized with standard .NET framework methods. -
user interface:
The OptionHandler framework provides i18n support through interfaceyWorks.Option.I18N.I18NFactory. There is a default implementation that can use the .NETResourceManagerclass for l10n. Since the available interactive editors are based on either .NETLabels or the .NETPropertyGrid, display support for vertical text orientations is limited by the capabilities of these components.
yFiles WPF
In addition to the i18n support in yFiles.NET, yFiles WPF also provides several predefined command bindings. To change the text for these bindings, you need to wrap these bindings by your own commands that use the localized text instead.
Please note that support for vertical text orientations in yFiles WPF is currently rather limited due to limitations in the WPF framework itself.
yFiles FLEX
-
graph representation:
i18n support for displaying labels is provided by the Flash Player in conjunction with a suitable font that contains the correct glyphs for a specific language. If you need to embed a font for a specific language in your yFiles FLEX-based application, please see this Knowledge Base article. -
user interface:
i18n support and l10n for UI elements is described in this technical article from Adobe Labs: Flex 3: Runtime Localization
yFiles AJAX
-
graph representation:
in a yFiles AJAX client/server application the client displays image tiles generated by a yFiles for Java servlet, i.e., the i18n support and l10n techniques of Java as described above are relevant. -
user interface:
yFiles AJAX uses the Dojo toolkit on the client, which provides i18n support for UI elements as described here: Internationalization Quickstart.