LMP.Localize 8.1.0

dotnet add package LMP.Localize --version 8.1.0
                    
NuGet\Install-Package LMP.Localize -Version 8.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="LMP.Localize" Version="8.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="LMP.Localize" Version="8.1.0" />
                    
Directory.Packages.props
<PackageReference Include="LMP.Localize" />
                    
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 LMP.Localize --version 8.1.0
                    
#r "nuget: LMP.Localize, 8.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 LMP.Localize@8.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=LMP.Localize&version=8.1.0
                    
Install as a Cake Addin
#tool nuget:?package=LMP.Localize&version=8.1.0
                    
Install as a Cake Tool

LMP.Localize

A lightweight, thread-safe text localization library for .NET. It supports hierarchical culture fallback, on-the-fly hot reloading, and zero-allocation logging.

Features

  • 🌲 Culture Inheritance (Fallback): Automatically resolves missing keys through the culture hierarchy (e.g., en-US → en).
  • 🔄 Hot Reloading: Monitors folders using FileSystemWatcher and instantly updates dictionaries without blocking reader threads.
  • 🛡️ Thread-Safe: Designed from the ground up for high-concurrency environments using ConcurrentDictionary and atomic references.
  • 📊 Production-Ready: Natively integrates with ILoggerFactory using high-performance, compile-time generated LoggerMessage methods.

File Format

The library expects plain text files with a simple key=value structure. Keys are case-insensitive.

Example file: C:\Localization\en\strings.txt

welcome_message = Welcome to our application!
error_unknown = An unexpected error occurred.
button_save = Save changes

Quick Start

1. Initialize Options and Path Provider

using YourLibrary.Localization;
using Microsoft.Extensions.Logging;

// 1. Configure options
var options = new LanguageManagerOptions(
    BaseFolder: @"C:\Localization", 
    TrackChanges: true // Enables hot reloading via FileSystemWatcher
);

// 2. Choose a path provider (Default structure: {BaseFolder}/{Culture}/{FileName})
// By default, it looks for {YourAssemblyName}.txt, or you can specify a custom name:
ILanguagePathProvider pathProvider = new DefaultLanguagePathProvider("strings.txt");

// 3. Create the manager (ILoggerFactory parameter is optional)
ILoggerFactory loggerFactory = LoggerFactory.Create(builder => builder.AddConsole());
using var manager = new LanguageManager(options, pathProvider, loggerFactory);

2. Access Localized Strings

You can easily retrieve translations via indexers using either culture string names or CultureInfo objects:

// Access via string indexer (culture names are case-insensitive and trimmed)
ILanguage english = manager["en-US"];
Console.WriteLine(english["welcome_message"]); // Output: Welcome to our application!

// Access via CultureInfo indexer
ILanguage russian = manager[CultureInfo.GetCultureInfo("ru")];
Console.WriteLine(russian["button_save"]); // Output: Save changes

Culture Fallback Mechanics

The library utilizes the Chain of Responsibility design pattern. If a specific region file (e.g., en-US) does not contain the requested key, the system recursively looks for it in the parent culture file (en).

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
8.1.0 120 8/25/2026
8.0.1 109 8/7/2026
8.0.0 118 7/30/2026