Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 52 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,53 @@
# Blazor Web App Data Form Localization
The example explore the specifics of localizing data annotations specifically for the Blazor Data Form component in a Blazor web app environment.
## Project prerequisites
Make sure that you have the compatible versions of [Visual Studio 2022](https://visualstudio.microsoft.com/downloads/ ) and [.NET Core SDK 8.0](https://dotnet.microsoft.com/en-us/download/dotnet/8.0) or later version in your machine before starting to work on this project.
# Blazor DataForm Localization

## How to run this application
To run this application, you need to first clone the `blazor-dataform-localization` repository and then open it in Visual Studio 2022. Now, simply build and run your project to view the output.
A compact example showing how to localize data-annotation labels, validation messages, and [DataForm](https://www.syncfusion.com/blazor-components/blazor-data-form) component strings in a Blazor Web App with hybrid rendering.

## Overview

This sample demonstrates a model-driven localization approach for **Syncfusion DataForm** with complete data annotation support. The `UserDetails` model demonstrates how to combine Display attributes with validation error localization to achieve full UI localization without writing localization code in components. The app runs in German (de-DE) by default and shows how all DataForm field labels, validation messages, and component UI strings are resolved from .resx files.

## Features

- **Localized Field Labels and Validation Messages**: Map data model properties to localized display names and validation error messages
- **Component String Localization**: Integrate custom resource provider with DataForm for UI string translation
- **Multi-Language Resource Files**: Support multiple cultures with neutral and culture-specific resource assemblies
- **Application Culture Configuration**: Set global culture for consistent localization across all components
- **Multiple Validation Attributes**: Localize error messages for different validation rules on the same property
- **Hybrid Rendering**: Localization works with both server-side and client-side interactive components

## Prerequisites

- [.NET SDK 8.0](https://dotnet.microsoft.com/download/dotnet/8.0) or later
- [Visual Studio 2022](https://visualstudio.microsoft.com/vs/) or later
- [Visual Studio Code](https://code.visualstudio.com/)

## Getting started

### Clone the repository:

```bash
git clone https://github.com/SyncfusionExamples/blazor-dataform-localization.git
cd blazor-dataform-localization
```

### Run with Visual Studio

1. Open the solution file using Visual Studio 2022 or later.
2. Restore the NuGet packages by rebuilding the solution.
3. Build the project to ensure there are no compilation errors.
4. Run the project.

### Run with .NET CLI

```bash
# Restore dependencies
dotnet restore

# Run the project
dotnet run
```

## References

- https://blazor.syncfusion.com/documentation/common/localization
- https://blazor.syncfusion.com/documentation/data-form/localization