My.Extensions.Localization.Json 4.1.0

dotnet add package My.Extensions.Localization.Json --version 4.1.0
                    
NuGet\Install-Package My.Extensions.Localization.Json -Version 4.1.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="My.Extensions.Localization.Json" Version="4.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="My.Extensions.Localization.Json" Version="4.1.0" />
                    
Directory.Packages.props
<PackageReference Include="My.Extensions.Localization.Json" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add My.Extensions.Localization.Json --version 4.1.0
                    
#r "nuget: My.Extensions.Localization.Json, 4.1.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.
#:package My.Extensions.Localization.Json@4.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=My.Extensions.Localization.Json&version=4.1.0
                    
Install as a Cake Addin
#tool nuget:?package=My.Extensions.Localization.Json&version=4.1.0
                    
Install as a Cake Tool

My.Extensions.Localization.Json

JSON Localization Resources for ASP.NET Core.

NuGet Package: NuGet

Build Status: Build status

Installation

dotnet add package My.Extensions.Localization.Json

Usage

1. Register JSON Localization Services

Adds the JSON localization services into DI by adding AddJsonLocalization in Program.cs or Startup.cs, as follows:

builder.Services.AddJsonLocalization(options => 
{
    options.ResourcesPath = new[] { "Resources" };
    options.ResourcesType = ResourcesType.TypeBased;
});

2. Create Resource Files

Your localization resource should be placed based on the ResourcesPath folder, similar to the default .resx-based localization, but using JSON files instead. The file naming convention depends on the ResourcesType configuration.

The resource file should be valid JSON objects with key-value pairs, each representing a localized string:

{
  "Hello": "Bonjour",
  "WelcomeMessage": "Bienvenue sur notre application !"
}
2.1 Type-Based

The resource files are named based on the types that use the IStringLocalizer. For more information, please refer to the Resource file naming in the ASP.NET Core Globalization and localizations docs.

2.2 Culture-Based

The resource files are named based on the supported cultures, for example, ar.json.

3. Use in Your Application

You can use the IStringLocalizer normally in your application.

public class HomeController : Controller
{
    private readonly IStringLocalizer<HomeController> _localizer;

    public HomeController(IStringLocalizer<HomeController> localizer)
    {
        _localizer = localizer;
    }

    public IActionResult Index()
    {
        ViewData["Message"] = _localizer["WelcomeMessage"];

        return View();
    }
}
Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (17)

Showing the top 5 NuGet packages that depend on My.Extensions.Localization.Json:

Package Downloads
HiP.Mvc

Hi-P MVC相关基础包,含基础后台管理功能

Dignite.Abp.Localization

Package Description

Dignite.Abp.MultiTenancyLocalization

Package Description

ZhonTai.Admin.Core

中台Admin权限管理核心库

Dignite.Abp.TenantLocalization

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
4.1.0 153 6/4/2026
4.0.0 27,816 12/10/2025
3.4.0 227,149 1/5/2025
3.3.0 109,653 3/25/2024
3.2.0 17,706 12/2/2023
3.1.0 22,140 2/28/2023
3.0.1 13,840 1/31/2023
3.0.0 142,232 7/24/2021
2.1.0 97,340 4/7/2020
2.0.0 9,696 3/4/2020
1.0.0 9,355 11/5/2017