Skip to content
Unic crates for locale management implementing Unicode UTS #35
Rust
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
unic-langid-impl Switch Locale to TinyStr Aug 23, 2019
unic-langid-macros-impl
unic-langid-macros
unic-langid
unic-locale-impl
unic-locale-macros-impl
unic-locale-macros
unic-locale unic-* 0.4.2 Aug 2, 2019
.gitignore
.travis.yml Add travis Jun 16, 2019
Cargo.toml
LICENSE-APACHE Update licenses May 14, 2019
LICENSE-MIT Update licenses May 14, 2019
README.md

README.md

Build Status Coverage Status

This meta-crate contains two basic crates for Unicode Language Identifier and Locale manipulation.

unic-langid crates.io

Unic crate for Unicode Language Identifiers management.

Language Identifier describes a combination of language, region, script and variants. Examples: "en-US", "sr-Cyrl-RU", "de-AT", "zh-Hans".

unic-locale crates.io

Unic crates for Unicode Locale Identifiers management.

Locale Identifiers extend Language Identifiers with a set of extensions for unicode, transform and private.

This allows the user to encode additional data. Examples: "en-US-u-hc-h24", "pl-u-ca-buddhist".

Status

The unic-langid crate is fully functional and should parse/manipulate/serialize in conformance with the standard. The Rust API is still rough and will change as we progress toward 1.0, and performance can be improved.

The unic-locale crate is incomplete with only several examples of extensions handled at the moment. The goal is to advance the coverage as the API progresses. The API shadows that of unic-langid and is intended to be a drop-in replacement for unic-langid so that users can start with a simple Language Identifier coverage and extend it to use unic-locale once needed.

Unicode Conformance

All code implements (parts) of Unicode UTS #35 Language and Locale Identifiers.

The API is intended to function similarly to ICU Locale and ECMA402 Intl.Locale.

Performance

In early tests the performance of parsing a set of language identifiers into a well formed struct, unic-langid is ~50 times faster than ICU Locale.

There's a lot of room for improvement since at the moment the crates use String fields which can be replaced with variants tailored for short strings, and the parser uses naive parsing, which can also be optimized later.

Meta-crate

Whoa, I can see you saying, what is it about with all those crates here?

Well, that's an excelent question!

Unless you want a deep dive into procedural macro and proc-macro-hack, let me just give you a tl;dr:

  • unic-{langid|locale} - User facing public crates that you should use. Potentially with features = ["macros"]
  • unic-{langid|locale|-impl - The real code behind all of this.
  • unic-{langid|locale}-macro-impl - Actual implementations of the procedural macros
  • unic-{langid|locale}-macro - Declaration crates for the macros

In result, there's a little bit of hackery here to get everything work nicely for you, but all you should care about are the two top crates with optional features if you want.

The rest will hopefully go away one day once we mature the macros ecosystem in Rust.

You can’t perform that action at this time.