What problem does it solve?
This Skill addresses the complexities of implementing multi-language support, managing resource files, and ensuring correct culture-specific formatting in ASP.NET Core Razor Pages applications, preventing common bugs and maintenance issues.
Core Features & Use Cases
- Resource File Management: Organizes and utilizes
.resx files for translations, supporting feature-specific and shared resources.
- Configuration & Detection: Sets up
RequestLocalizationOptions for automatic culture detection via query strings, cookies, and headers.
- Razor Pages Integration: Demonstrates injecting
IStringLocalizer and IViewLocalizer into PageModels and Views for dynamic text.
- Culture-Specific Formatting: Provides extension methods for consistent formatting of dates, numbers, and currencies based on the current culture.
- Language Switching: Implements a controller and partial view for a user-friendly language switcher.
- RTL Support: Includes guidance on adapting layouts and CSS for right-to-left languages.
- Use Case: A global e-commerce platform needs to display product information, pricing, and dates in English, Spanish, and French, with a user-selectable language switcher. This Skill provides the patterns to achieve that.
Quick Start
Configure ASP.NET Core localization in Program.cs and add resource files to your project.