Rich Text Editor Localization
- 2 minutes to read
This topic describes how to localize the ASP.NET Core RichEdit control.
Step 1. Download Translated Resources
Download translated resources from the DevExpress Localization Service. See the Localization Service topic to learn more.
Step 2. Add Resource Files to Your Project
Unpack the self-extracting archive to get a folder with the localization resources.
Create a localization-source folder in your project:
node_modules\devexpress-richedit\localization-source
Copy the following extracted resource file to the localization-source folder:
~\DevExpressLocalizedResources_{majorVersion}_{lang}\json resources\dx-rich.{lang}.json
// for example
// ~\DevExpressLocalizedResources_2019.1_de\json resources\dx-rich.de.json
Step 3. Convert Files to DevExtreme Format
The RichEdit control use the DevExtreme localization mechanism. Therefore you should to convert localization resources to DevExtreme format.
Run the command npm run localization
inside the node_modules\devexpress-richedit\
folder:
It converts files from the localization-source folder to DevExtreme format and places them in the localization folder.
Step 4. Register JS File
Register the created javascript file in your page before the control script registration.
<head>
<script src="~/node_modules/devexpress-richedit/localization/dx-rich.{lang}.js"></script>
</head>
Step 5. Add Script
Add the DevExpress.localization.locale("{lang}");
script to your page’s header.
Note
This script affects the localization of all DevExtreme controls on the page. See the DevExtreme Localization topic to learn more.
The code sample below demonstrates the page’s header content.
<script src="~/node_modules/jszip/dist/jszip.min.js"></script>
<link href="~/node_modules/devextreme-dist/css/dx.light.css" rel="stylesheet" />
<script src="~/node_modules/devextreme-dist/js/dx.all.js"></script>
<script src="~/node_modules/devexpress-richedit/localization/dx-rich.de.js"></script>
<link href="~/node_modules/devexpress-richedit/dist/dx.richedit.css" rel="stylesheet" />
<script src="~/node_modules/devexpress-richedit/dist/dx.richedit.js"></script>
<script>DevExpress.localization.locale("de");</script>