Skip to content

POSIX locale alignment for .NET CultureInfo on Unix-like systems

License

Notifications You must be signed in to change notification settings

rameel/ramstack.localealignment

Repository files navigation

Ramstack.LocaleAlignment

NuGet MIT

A small library for aligning .NET culture settings with POSIX locale user overrides on Unix-like systems.

screenshot

Problem

On Unix-like systems, .NET determines the process culture using only a subset of locale-related environment variables (LC_ALL, LC_MESSAGES, LANG).

Category-specific overrides such as LC_NUMERIC, LC_TIME, and LC_MONETARY are not applied during CultureInfo initialization.

This behavior is documented and discussed in the .NET runtime repository:

Project structure

This repository contains two packages:

Ramstack.LocaleAlignment

A small runtime library that explicitly applies POSIX locale category overrides to .NET CultureInfo.

It is intended to be called manually during application startup and can be used from any .NET language (C#, F#, Nemerle, etc.).

Ramstack.LocaleAlignment.Generator

A dependency-free Roslyn source generator that enables automatic locale alignment at application startup.

The generator injects the equivalent of a LocaleAlignment.Apply() call directly into the compiled output, without introducing any runtime dependency or requiring any configuration.

Supported versions

Version
.NET 6, 7, 8, 9, 10

Contributions

Bug reports and contributions are welcome.

License

This package is released as open source under the MIT License.
See the LICENSE file for more details.

About

POSIX locale alignment for .NET CultureInfo on Unix-like systems

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages