Spreadsheet Localization
- 2 minutes to read
This topic describes how to localize the ASP.NET Core Spreadsheet 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 the localization-source folder in your project at the following path:
node_modules\devexpress-aspnetcore-spreadsheet\localization-source
Copy the following extracted resource file to the localization-source folder:
~\DevExpressLocalizedResources_{majorVersion}_{lang}\json resources\dx-spreadsheet.{lang}.json
// for example
// ~\DevExpressLocalizedResources_2024.2_fr\json resources\dx-spreadsheet.fr.json
Make sure the localization-source folder contains only one dx-spreadsheet.{lang}.json
file.
Step 3. Convert Files to DevExtreme Format
The Spreadsheet control uses the DevExtreme localization mechanism. Therefore, you should convert localization resources to DevExtreme format.
Run the command npm run localization
inside the node_modules\devexpress-aspnetcore-spreadsheet\
folder:
This command 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.
<script src="~/node_modules/devexpress-aspnetcore-spreadsheet/localization/dx-spreadsheet.{lang}.js"></script>
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/devextreme-dist/js/dx.all.js"></script>
<link href="~/node_modules/devextreme-dist/css/dx.light.css" rel="stylesheet" />
<script src="~/node_modules/devexpress-aspnetcore-spreadsheet/localization/dx-spreadsheet.fr.js"></script>
<script src="~/node_modules/devexpress-aspnetcore-spreadsheet/dist/dx-aspnetcore-spreadsheet.js"></script>
<link href="~/node_modules/devexpress-aspnetcore-spreadsheet/dist/dx-aspnetcore-spreadsheet.css" rel="stylesheet" />
<script>DevExpress.localization.locale("fr");</script>