https://github.com/rameel/ramstack.localealignment
POSIX locale alignment for .NET CultureInfo on Unix-like systems
https://github.com/rameel/ramstack.localealignment
cultureinfo freebsd icu linux locale posix
Last synced: 4 months ago
JSON representation
POSIX locale alignment for .NET CultureInfo on Unix-like systems
- Host: GitHub
- URL: https://github.com/rameel/ramstack.localealignment
- Owner: rameel
- License: mit
- Created: 2026-01-23T22:53:48.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2026-02-04T14:09:07.000Z (4 months ago)
- Last Synced: 2026-02-05T01:29:57.615Z (4 months ago)
- Topics: cultureinfo, freebsd, icu, linux, locale, posix
- Language: C#
- Homepage:
- Size: 410 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Ramstack.LocaleAlignment
[](https://nuget.org/packages/Ramstack.LocaleAlignment)
[](https://github.com/rameel/ramstack.localealignment/blob/main/LICENSE)
A small library for aligning .NET culture settings with POSIX locale user overrides on Unix-like systems.

## 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:
* [https://github.com/dotnet/runtime/issues/110095](https://github.com/dotnet/runtime/issues/110095)
## 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](https://github.com/rameel/ramstack.localealignment/blob/main/LICENSE) file for more details.