anLocales
anLocales — a cross-platform Rust library for working with locales, similar to glibc-locales, but simpler and with C API support.
- Supports LC_TIME, LC_NUMERIC, LC_MONETARY, LC_COLLATE, plural rules
- Date/number formats in
data_format.json - Interface strings in
locale.toml - Caching in
temp/ - C API compatible (
.so/.dll)
📁 Locale Directory Structure
Linux/macOS:
/usr/share/anlocales/
├─ locales/
│ ├─ ru_RU/
│ │ ├─ data_format.json
│ │ └─ locale.toml
│ └─ en_US/
├─ temp/ # cache
└─ settings.json # default_locale, fallback_locale
Windows:
C:\ProgramData\anlocales\
├─ locales\
│ ├─ ru_RU\
│ │ ├─ data_format.json
│ │ └─ locale.toml
│ └─ en_US\
├─ temp\ # cache
└─ settings.json # default_locale, fallback_locale
Example data_format.json:
Example locale.toml:
= "Settings"
= "Exit"
= "Hello"
⚡ Quick Start (Rust)
use AnLocales;
use NaiveDate;
🔗 Using from C
int
🛠 Building
*nix
# Outputs:
# dist/libanLocales.so # Linux
# dist/libanLocales.dylib # macOS
Windows
# Outputs:
# target/x86_64-pc-windows-gnu/release/anLocales.dll
# you can run "make" but if its not working use this method
Linking in C
# Linux
# Windows
💡 Features
- Caching loaded locales in
temp/for fast startup - Fallback locale if a key is missing
- Extendable LC_* structure (add LC_MESSAGES, LC_MONETARY, etc.)
- Cross-platform (
.so/.dll) - Full C API compatible (
anlocales.h)