Toolbelt.ComponentModel.Annotations.Resources 1.0.0

dotnet add package Toolbelt.ComponentModel.Annotations.Resources --version 1.0.0
NuGet\Install-Package Toolbelt.ComponentModel.Annotations.Resources -Version 1.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Toolbelt.ComponentModel.Annotations.Resources" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Toolbelt.ComponentModel.Annotations.Resources --version 1.0.0
#r "nuget: Toolbelt.ComponentModel.Annotations.Resources, 1.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Toolbelt.ComponentModel.Annotations.Resources as a Cake Addin
#addin nuget:?package=Toolbelt.ComponentModel.Annotations.Resources&version=1.0.0

// Install Toolbelt.ComponentModel.Annotations.Resources as a Cake Tool
#tool nuget:?package=Toolbelt.ComponentModel.Annotations.Resources&version=1.0.0

Toolbelt.ComponentModel.Annotations.Resources NuGet Package

Built-in validation error messages for validation attributes such as [Required], [StringLength], etc., on your ASP.NET Core and Blazor apps will be shown localized after installing this NuGet package.

Warning
⚠️ This library touches undocumented areas and private implementations of the .NET runtime, using the "Reflection" technology. So please remember that it might not be working on future .NET versions.

Usage

  1. Install the NuGet package for the language you want to localize. The following command example shows the case for localizing standard validation error messages to Japanese.
dotnet add package Toolbelt.ComponentModel.Annotations.Resources.ja
  1. Call the AddSystemComponentModelAnnotationsLocalization() extension method for a service collection at the startup of your apps.
// Program.cs
...
using Toolbelt.Extensions.DependencyInjection;
...
builder.Services.AddSystemComponentModelAnnotationsLocalization();
...

After doing the above steps, you will see localized validation error messages on your ASP.NET Core and Blazor apps.

alternate text is missing from this package README image

Notice

Please remember to set the current thread culture on your apps the way you want. On a Blazor server app case, for example, you may have to implement your startup code like this:

// Program.cs
...
using Toolbelt.Extensions.DependencyInjection;
...
var builder = WebApplication.CreateBuilder(args);
...
// 👇 Register services to the DI container involved with the localization feature.
builder.Services.AddLocalization(); 
...
builder.Services.AddSystemComponentModelAnnotationsLocalization();
...
var app = builder.Build();
...
// 👇 Configure the Request Localization middleware.
app.UseRequestLocalization(options =>
{
    var supportedCultures = new[] { "en", "ja" };
    options.AddSupportedCultures(supportedCultures);
    options.AddSupportedUICultures(supportedCultures);
});
...
app.Run();

See also: 🔗 "ASP.NET Core Blazor globalization and localization" | Microsoft Docs

Release Note

Release notes

License

Mozilla Public License Version 2.0

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Toolbelt.ComponentModel.Annotations.Resources:

Package Downloads
Toolbelt.ComponentModel.Annotations.Resources.ja

この NuGet パッケージをインストールすると、ASP.NET Core および Blazor アプリに組み込みの [Required] や [StringLength] などの検証属性に対する検証エラーメッセージが、日本語化されて表示されるようになります。

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.0 536 7/20/2022

v.1.0.0
- 1st release;

To see all the change logs, please visit the following URL.
- https://github.com/jsakamoto/Toolbelt.ComponentModel.Annotations.Resources/blob/main/RELEASE-NOTES.txt