| Crates.io | locale-rs |
| lib.rs | locale-rs |
| version | 0.1.2 |
| created_at | 2026-01-04 13:21:04.543659+00 |
| updated_at | 2026-01-04 17:52:18.919662+00 |
| description | A strongly-typed locale library for Rust. Provides localized number and datetime formatting backed by Unicode CLDR data. |
| homepage | |
| repository | https://github.com/LowPolyCat1/locale |
| max_upload_size | |
| id | 2021874 |
| size | 1,085,828 |
A comprehensive, strongly-typed Rust library for managing Unicode locales, built directly on the CLDR (Common Locale Data Repository) dataset.
This crate provides a type-safe interface for locale identifiers, ensuring that your application remains compliant with international standards while benefiting from Rust's performance and safety guarantees.
Locale is designed to be the foundational "source of truth" for locale identifiers in the Rust ecosystem. Rather than relying on hardcoded strings, this crate leverages automated generation to stay perfectly in sync with the latest Unicode releases.
enum, preventing typos and invalid locale errors at compile-time.Avoid string-parsing overhead. Use the Locale enum to ensure compile-time validity.
use locale_rs::Locale;
let my_locale = Locale::en_GB;
assert_eq!(my_locale.as_str(), "en-GB");
Supports native numbering systems (e.g., Latin, Arabic-Indic, Devanagari) automatically based on the selected locale.
cargo run --example arabic_nums --features nums
٠
١
٢
٣
٤
٥
٦
٧
٨
[dependencies]
locale-rs = { version = "0.1.0" }
The project is structured as a dual-component workspace:
locale): The lightweight, production-ready crate containing the typed locale definitions and conversion traits.locale-dev): An automated pipeline that fetches, caches, and parses the latest Unicode releases to generate the library's source code.This structure ensures that the library remains updated without requiring manual maintenance of thousands of locale variants.
This project respects and adheres to the licensing requirements of its source data and inspirations:
num-format, which is dual-licensed under Apache-2.0 or MIT.Contributions are welcome! If you find a missing locale or a discrepancy with the CLDR standards, please open an issue. Since the core code is generated, most improvements will be directed toward the logic in the locale-dev component.