Localization in TypeScript Diagram control
18 Nov 20181 minute to read
The EJ2 Diagram component supports localization. In the Diagram component, the symbol palette search box and context menu items can be localized based on the selected culture. By using the locale property of the diagram, you can change the culture.
Localize Diagram context menu
To localize the diagram context menu, we need to define the locale property of the diagram with our preferred culture. In the example below, we use de-DE, which is the locale code for German as used in Germany.
Next, we need to call the setCulture('de') function, which sets the default culture for all EJ2 components. This method takes one parameter, cultureName, which specifies the culture name to be set as the default.
We also need to define the text we want to render in the context menu instead of the default English, as shown below.
The following code example summarizes the locale settings for the context menu.
Localize Symbol palette
You can enable the search option in the symbol palette to search for symbols by using the enableSearch option. This search box can also be localized.
To localize the symbol palette search box, we need to define the locale property of the symbol palette with our preferred culture. In the example below, we use de-DE, which is the locale code for German as used in Germany.
The following code shows how to localize symbol palette.
The following code example summarizes the locale settings for the symbol palette.
Refer localization for more information.