Locan.Core 1.0.5

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

Locan

NuGet

Locan is a strongly typed localization library for .NET. It keeps translations in JSON, generates message classes at compile time, and renders them using the current UI culture.

Why Locan

  • Message keys become discoverable C# types instead of string literals.
  • Placeholder names, types, and formats are captured by the source generator.
  • Culture-aware formatting uses standard .NET format strings.
  • Runtime resources support parent-culture fallback such as ru-RU to ru.
  • Hosting and ASP.NET Core integrations load resources and select the request culture.

Installation

For an ASP.NET Core application with generated messages:

dotnet add package Locan.AspNetCore
dotnet add package Locan.Generator

Two-minute example

Declare the default culture and localization resources in the project file:

<PropertyGroup>
  <LocanDefaultCulture>en</LocanDefaultCulture>
</PropertyGroup>

<ItemGroup>
  <LocanResource Include="Localization/**/*.json"
                 GenerateMessages="true"
                 CopyToOutput="true" />
</ItemGroup>

Declare the namespace for generated message classes:

using Locan.Generator.Attributes;

[assembly: LocalizationModule("MyApplication.Messages")]

Create Localization/localization-en.json:

{
  "culture": "en",
  "messages": {
    "article.not.found": "Article not found.",
    "article.price.updated": "Price updated to {Price|Decimal|F2}."
  }
}

The generator turns article.price.updated into a class with a typed factory:

using Locan.Core.LocalizableMessages;

public partial class ArticlePriceUpdatedMessage : LocalizableMessage
{
    public const string Key = "article.price.updated";

    public ArticlePriceUpdatedMessage() : base(Key, 1) { }

    public static ArticlePriceUpdatedMessage Create(decimal Price)
    {
        var message = new ArticlePriceUpdatedMessage();
        message.WithValue("Price", Price, "F2");
        return message;
    }

    public ArticlePriceUpdatedMessage WithPrice(decimal value)
    {
        WithValue("Price", value, "F2");
        return this;
    }
}

Use the generated class through Locan's contextual localizer:

using Locan.AspNetCore;
using Locan.Core.Interfaces.Localizers;
using MyApplication.Messages;

var builder = WebApplication.CreateBuilder(args);
builder.Services.AddLocanAspNetCore(options =>
{
    options.DefaultCulture = "en";
    options.SupportedCultures = ["en", "ru"];
});

var app = builder.Build();
app.UseLocanRequestLocalization();

app.MapGet("/price", (IContextualLocalizer localizer) =>
    localizer.Get(ArticlePriceUpdatedMessage.Create(12.5m)));

app.Run();

For the English request culture, the result is Price updated to 12.50.. Resources with CopyToOutput="true" are copied to the application's Locan output directory automatically.

Packages

  • Locan.Core — shared contracts, models, and template parsing primitives.
  • Locan — resource loading, culture lookup, and message rendering.
  • Locan.Hosting — dependency injection and hosted initialization.
  • Locan.AspNetCore — request-culture integration for ASP.NET Core.
  • Locan.Generator — build integration and the strongly typed source generator.

Documentation

License

Locan is licensed under the MIT License.

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.  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 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  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 (2)

Showing the top 2 NuGet packages that depend on Locan.Core:

Package Downloads
Locan

JSON-based localization runtime for .NET.

Locan.Generator

Roslyn source generator for strongly typed Locan localization messages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.6 248 9/13/2026
1.0.5 151 9/12/2026
1.0.4 147 9/12/2026
1.0.2 149 9/12/2026
1.0.1 148 9/12/2026
1.0.0 113 9/12/2026