There is a newer version of this package available.
See the version list below for details.
Install-Package Toolbelt.Blazor.I18nText -Version
dotnet add package Toolbelt.Blazor.I18nText --version
<PackageReference Include="Toolbelt.Blazor.I18nText" Version="" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Toolbelt.Blazor.I18nText --version
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Toolbelt.Blazor.I18nText,"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install Toolbelt.Blazor.I18nText as a Cake Addin
#addin nuget:?package=Toolbelt.Blazor.I18nText&version=

// Install Toolbelt.Blazor.I18nText as a Cake Tool
#tool nuget:?package=Toolbelt.Blazor.I18nText&version=
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Blazor Internationalization(I18n) Text NuGet Package


This package is an another way to localize text in your Blazor Web App!



  • It works on both Blazor Server and Blazor WebAssembly.
  • In Blazor WebAssembly, it works without the Server-Side process (requires only static contents HTTP server).
  • You can develop with an only plain text editor - No require .resx
  • Static Typing - IntelliSense, Code Hint...
  • It also works well on Blazor components libraries. You can package the library that's localized with "Blazor I18nText" as a NuGet package.


Now, Blazor WebAssembly has been started the localization support officially since v.3.2 preview 4. It is based on .NET Standard IStringLocalizer and satellite assemblies with .resx.

However, I will continue to develop and maintain this package, because this package still has some advantages against .NET standard way.


Supported versions

"Blazor I18n Text" ver.9.x supports following Blazor versions:

  • Blazor Server App v.3.0.0 ~ 3.1.0 GA
  • Blazor WebAssembly App v.3.2.0 Preview 2~5, and Release Candidate 1

Quick Start

Step.1 - Add Package

Add Toolbelt.Blazor.I18nText NuGet package to your Blazor app project, like this.

$ dotnet add package Toolbelt.Blazor.I18nText

Step.2 - Create localized text source files as JSON or CSV

Add localized text source files for each language in an i18ntext folder under the project folder.

The localized text source files must be simple key-value only JSON file like a bellow example,

  "Key1": "Localized text 1",
  "Key2": "Localized text 2",

or, 2 columns only CSV file without header row like a bellow example.

Key1,Localized text 1
Key2,Localized text 2

NOTICE - The encoding of the CSV and JSON file must be UTF-8.

And, the naming rule of localized text source files must be bellow.

<Text Table Name>.<Language Code>.{json|csv}


Step.3 - Build the project whenever localized text source files are created or updated.

After creating or updating those localized text source files, you have to build your Blazor app project.

After building the project, "Typed Text Table class" C# files will be generated in the i18ntext/@types folder, by the building process.

And also, "Localized Text Resource JSON" files will be generated in the output folder, too.


NOTE - If you want to do this automatically whenever those localized text source files (.json or .csv) are changed, you can use dotnet watch command with the following arguments.

$ dotnet watch msbuild -t:CompileI18nText

After entry this dotnet CLI command, the command stay in execution and watch the changing of localized text source files. If it detects the changing of localized text source files, then the dotnet CLI re-compile localized text source files into "Typed Text Table class" and "Localized Text Resource JSON" files.


Step.4 - Configure your app to use I18nText service

Edit the "Startup" class to register "I18nText" service, like this.

// in your Startup.cs
using Toolbelt.Blazor.Extensions.DependencyInjection; // <- Add this, and...
  public void ConfigureServices(IServiceCollection services)
    services.AddI18nText(); // <- Add this.

Your project is Blazor WebAssembly v.3.2+, you should edit "Program" class to do this.

// in your Program.cs
using Toolbelt.Blazor.Extensions.DependencyInjection; // <- Add this, and...
public static async Task Main(string[] args)
  var builder = WebAssemblyHostBuilder.CreateDefault(args);
  builder.Services.AddI18nText(); // <- Add this.

Step.5 - Get the "Text Table" object in your Blazor component

Open your Blazor component file (.razor) in your editor, and do this:

  1. Inject Toolbelt.Blazor.I18nText.I18nText service into the component.
@inject Toolbelt.Blazor.I18nText.I18nText I18nText
  1. Add a filed of the Text Table class generated from localized text source files, and assign the default instance.
@code {
  I18nText.MyText MyText = new I18nText.MyText();

NOTE - The namespace of the Text Table class is <default namespace of your Blazor project> + "I18nText".

  1. Override OnInitiallizedAsync() method of the Blazor component, and assign a Text Table object that's a return value of GetTextTableAsync<T>() method of I18nText service instance to the Text Table field.
protected override async Task OnInitializedAsync()
  MyText = await I18nText.GetTextTableAsync<I18nText.MyText>(this);


Step.6 - Use the Text Table

After doing these steps, you can reference a field of the Text Table object to get localized text.

If you are using Visual Studio in Windows OS and Blazor extensions is installed in that Visual Studio, you can get "IntelliSense" and "Document comment" support.


Note: Text Table object allows you to get localized text by key string dynamically, with indexer syntax, like this.


If you make some mistakes that typo of key string, it will just return the key string as is without any runtime exceptions.

Step.7 - Run it!

Build and run your Blazor app.

The I18nText service detects the language settings of the Web browser, and reads the localized text resource JSON which is most suitable for the language detected.


More information for in case of Blazor server app

I recommend enabling "Request Localization" middleware on the Blazor server app, by like the following code.

// in the Startup class
public void ConfigureServices(IServiceCollection services)
  services.Configure<RequestLocalizationOptions>(options => {
    var supportedCultures = new[] { "en", "ja" };
    options.DefaultRequestCulture = new RequestCulture("en");

public void Configure(IApplicationBuilder app, IWebHostEnvironment env)

This code makes the result of server-side pre-rendering to be suitable for "Accept-Language" header value in a request from clients.


The following features are not supported in this version of I18Text library.

  • Integration with ASP.NET Core localization (IStringLocalizer<T> support)
  • Localize validation message
  • Plural form support
  • Text formatting by place holder.
  • Integration with System.Globalization.Culture.CurrentUICulture.

The following features will not be supported forever, because these features are not the scope of this library, I think.

  • Formatting of date, time, currency. (These features will be provided by System.Globalization.Culture.)


API Reference

Please see also "API Reference" on GitHub.

Release Notes

Release notes is here.


Mozilla Public License Version 2.0

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Toolbelt.Blazor.I18nText:

Package Downloads

This NuGet package allows you to localize your Blazor app even validation messages based on .NET Core localization infrastructure such as "IStringLocalizer".

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on Toolbelt.Blazor.I18nText:

Repository Stars
The class library that provides the ability to localize texts on your Blazor app!
Version Downloads Last updated
11.0.0-preview.2 124 10/9/2021
11.0.0-preview.1 189 8/21/2021
10.0.0-preview.1 204 8/16/2021
9.4.1 467 8/14/2021
9.4.1-preview.1.3 262 5/16/2021
9.4.0 4,866 1/15/2021
9.3.1 955 11/29/2020
9.3.0 3,764 9/14/2020
9.2.0 9,568 8/5/2020
9.1.1 3,242 6/18/2020
9.1.0 412 6/11/2020 3,212 4/26/2020
9.0.1 4,660 4/6/2020 2,252 3/14/2020 684 2/14/2020
7.1.0 6,716 1/9/2020 3,913 10/9/2019 642 10/3/2019
6.0.0 1,155 9/5/2019 495 8/18/2019
4.0.0 901 7/27/2019 630 6/17/2019
2.0.0 365 5/1/2019 333 3/21/2019

- Just added package icon.
- Fix: Localized Resource JSON files aren't published.
- BREAKING CHANGE: Support Blazor v.3.2.0 Preview 2 (not compatible with v.3.2.0 Preview 1 or before.)
- Add sub-namespace to Typed Text Table class from the relative location where localized text source files are.
- Fix: auto loading JavaScript file is failed sometimes.
- Minify JavaScript file.
- Remove type parameter from "AddI18nText()" because no longer used it.
- Change "// Auto generated..." mark comment to "// <auto-generated .../>" tag for avoid Stylecop warning.
- Fix: Problem with new lines in localized text source JSON files
- BREAKING CHANGE: Support server-side Blazor server app v.3.0.0 (not compatible with v.3.0.0 Preview 8 or before.)
- BREAKING CHANGE: Support Blazor v.3.0.0 Preview 9 (not compatible with v.3.0.0 Preview 8 or before.)
- BREAKING CHANGE: Support Blazor v.3.0.0 Preview 8 (not compatible with v.3.0.0 Preview 7 or before.)
- BREAKING CHANGE: Support Blazor v.3.0.0 Preview 7 (not compatible with v.3.0.0 Preview 6 or before.)
- BREAKING CHANGE: Support Blazor v.3.0.0 Preview 6 (not compatible with v.3.0.0 Preview 5 or before.)
- BREAKING CHANGE: Support Blazor v.3.0.0 Preview 4 (not compatible with v.0.9.0 or before.)
- 1st release.