XLocalizer 1.0.3

There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package XLocalizer --version 1.0.3
                    
NuGet\Install-Package XLocalizer -Version 1.0.3
                    
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="XLocalizer" Version="1.0.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="XLocalizer" Version="1.0.3" />
                    
Directory.Packages.props
<PackageReference Include="XLocalizer" />
                    
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 XLocalizer --version 1.0.3
                    
#r "nuget: XLocalizer, 1.0.3"
                    
#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 XLocalizer@1.0.3
                    
#: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=XLocalizer&version=1.0.3
                    
Install as a Cake Addin
#tool nuget:?package=XLocalizer&version=1.0.3
                    
Install as a Cake Tool

XLocalizer for Asp.Net Core

By Ziya Mollamahmut

Read full docs at: docs.ziya.info.tr

Goodbye "manually creating localization resources", welcome XLocalizer...!

What is XLocalizer

This is a nuget package that offers localization for Asp.Net Core based on .resx, .xml, db or any other custom file/db type. Powered by online translation and auto resource creating. XLocalizer has many powerful features and can be extended with custom tools.

  • Online Translation: Auto translation of missed localized values.
  • Auto Key Adding: Auto adding missing keys to the resources files.
  • Multiple Resource Type Support: Built-in localization support based on .RESX, .XML, DB. Extendable localization support based on any custom file/db type.
  • Export to Resx: Resources from any source type can be exported to .RESX files via built-in exporters.
  • Do it Fast: Custom cache support for speeding up the process of getting localized values from sources.
  • Standard interfaces: Easy to use due to using the standard localization interfaces: IStringLocalizer, IHtmlLocalizer, IStringLocalizerFactory and IHtmlLocalizerFactory.

How it Works

XLocalizer will translate and save localized keys into automatically created resource files. Since XLocalizer modules are implementing the default localization interfaces (IStringLocalizer, etc.) so any text passed into the localization services will be translated automatically and added into the relevant resource file/db.

Additionally, XLocalizer has built-in modules to localize all system error messages like (DataAnnotations, ModelBinding and Identity errors) without any additional workload.

Quick Setup

services.AddRazorPages()
    .AddXLocalizer<LocSource, GoogleTranslateService>(ops =>
    {
        ops.ResourcesPath = "LocalizationResources";
        ops.AutoTranslate = true;
        ops.AutoAddKeys = true;
        ops.UseExpressMemoryCache = true;
        ops.TranslateFromCulture = "en";
    });

For more details see setup instructions based on project type:

See also:

Disclaimer Third Parties

All product and company names of translation services are trademarks� or registered� trademarks of their respective holders. Use of them does not imply any affiliation with or endorsement by them.

During the development of XLocalizer I've used many online translation services with the freemium plan, but it is up to you to use a priced plan from the respective service.

Each translation service has its pros and cons. MyMemory Translate provided the best results for the languages I've been working with (in terms performans and amount of free translation requests). So, in this documentation you will see most samples refering to MyMemory Translate as the translation service. But you are free to use any other service that fits your needs.

Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  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. 
.NET Core netcoreapp2.0 is compatible.  netcoreapp2.1 is compatible.  netcoreapp2.2 is compatible.  netcoreapp3.0 is compatible.  netcoreapp3.1 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on XLocalizer:

Package Downloads
XLocalizer.DB

Database provider for XLocalizer.

XLocalizer.TagHelpers

LocalizeTagHelper for XLocalizer.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.1.0-preview-1 631 3/26/2025
1.0.3 44,920 4/15/2021
1.0.2 1,610 1/6/2021
1.0.1 706 1/1/2021
1.0.0 6,081 11/12/2020
1.0.0-rc.1 406 11/5/2020
1.0.0-preview3 893 8/24/2020
1.0.0-preview2 858 7/27/2020
1.0.0-preview1 816 7/26/2020

Improvements
- Removed deprected property UseExpressValidationAttributes. See https://docs.ziyad.info/en/XLocalizer/v1.0/localizing-validation-attributes-errors.md
- New option LocalizeDefatulCultre: Use to enable/disable localizing default culture
See all docs: https://docs.ziyad.info/en/XLocalizer/v1.0/index.md

Release notes: https://github.com/LazZiya/XLocalizer/releases