Skip to content

Commit 335d9e7

Browse files
author
Zibi Braniecki
committed
fluent-locale 0.5.0
1 parent 451986d commit 335d9e7

File tree

6 files changed

+20
-39
lines changed

6 files changed

+20
-39
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44

55
-
66

7+
## fluent-locale 0.5.0 (June 16, 2019)
8+
9+
- Separate out `unic-langid` and `unic-locale` into new crates.
10+
- Switch from BCP47 conformance to Unicode Locale Identifier.
11+
- Update to Rust 2018.
12+
713
## fluent-locale 0.4.1 (August 6, 2018)
814

915
- Separate out requested from available to allow for different mixes of Vec and &[].

Cargo.toml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
[package]
22
name = "fluent-locale"
33
description = """
4-
A library for parsing, serializing, manipulating and negotiating locales and language tags.
4+
A library for language and locale negotiation.
55
"""
6-
version = "0.4.1"
6+
version = "0.5.0"
77
authors = ["Zibi Braniecki <gandalf@mozilla.com>"]
88
homepage = "http://projectfluent.org/"
99
license = "Apache-2.0"
@@ -19,9 +19,9 @@ coveralls = { repository = "projectfluent/fluent-locale-rs", branch = "master",
1919
maintenance = { status = "actively-developed" }
2020

2121
[dependencies]
22-
unic-locale = { path = "../../unic-locale/unic-locale" }
22+
unic-locale = "^0.1"
2323

2424
[dev-dependencies]
25-
serde = "1.0"
26-
serde_json = "1.0"
27-
serde_derive = "1.0"
25+
serde = "^1.0"
26+
serde_json = "^1.0"
27+
serde_derive = "^1.0"

README.md

Lines changed: 6 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Fluent Locale
22

3-
**Fluent Locale is a library for language tags manipulations and negotiation.**
3+
**Fluent Locale is a library for language and locale identifier negotiation.**
44

55
[![crates.io](http://meritbadge.herokuapp.com/fluent-locale)](https://crates.io/crates/fluent-locale)
66
[![Build Status](https://travis-ci.org/projectfluent/fluent-locale-rs.svg?branch=master)](https://travis-ci.org/projectfluent/fluent-locale-rs)
@@ -11,43 +11,21 @@ Introduction
1111

1212
This is a Rust implementation of fluent-locale library which is a part of Project Fluent.
1313

14-
The library allows for parsing of unicode locale identifiers into `Locale` objects, operating on them
15-
and serializing the result back to locale identifier strings.
16-
17-
On top of that, it allows for simple operations like comparing `Locale` objects and
18-
negotiating between lists of language tags.
19-
14+
The library uses [unic-langid](https://github.com/zbraniecki/unic-locale) and [unic-locale](https://github.com/zbraniecki/unic-locale) to retrieve and operate on Unicde Language and Locale Identifiers.
15+
The library provides algorithm for negotiating between lists of locales.
2016

2117
Usage
2218
-----
2319

2420
```rust
25-
extern crate fluent_locale;
26-
27-
use fluent_locale::Locale;
21+
use fluent_locale::negotiate::NegotiationStrategy;
2822
use fluent_locale::negotiate_languages;
2923

30-
let loc = Locale::from("fr-CA");
31-
println!("Language: {}", loc.get_language());
32-
println!("Script: {}", loc.get_script());
33-
println!("Region: {}", loc.get_region());
34-
println!("Variants: {}", loc.get_variants());
35-
println!("Extensions: {}", loc.get_extensions());
36-
37-
let loc2 = Locale::new("fr-FR");
38-
39-
loc2.set_region("ca")?;
40-
41-
// The second and third parameters allow for range matching
42-
if loc.matches(loc2, false, false) {
43-
println!("Locales are matching!");
44-
}
45-
4624
let supported = negotiate_languages(
4725
&["de-DE", "fr-FR", "en-US"],
4826
&["de-DE", "de-AT", "fr-CA", "fr", "en-GB", "en", "en-US", "it"],
49-
"en-US",
50-
fluent_locale::NegotiationStrategy::Filtering
27+
Some("en-US"),
28+
&NegotiationStrategy::Filtering
5129
);
5230
```
5331

benches/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#![feature(test)]
22

3-
extern crate fluent_locale;
43
extern crate test;
54

65
use fluent_locale::negotiate_languages;

examples/negotiate.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
extern crate fluent_locale;
2-
31
use fluent_locale::negotiate::NegotiationStrategy;
42
use fluent_locale::negotiate_languages;
53

src/negotiate/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,8 +333,8 @@ pub fn negotiate_languages<'a, R: AsRef<str>, A: AsRef<str>>(
333333
strategy: &NegotiationStrategy,
334334
) -> Vec<&'a str> {
335335
let mut supported = filter_matches(
336-
&requested.into_iter().map(AsRef::as_ref).collect::<Vec<_>>(),
337-
&available.into_iter().map(AsRef::as_ref).collect::<Vec<_>>(),
336+
&requested.iter().map(AsRef::as_ref).collect::<Vec<_>>(),
337+
&available.iter().map(AsRef::as_ref).collect::<Vec<_>>(),
338338
strategy,
339339
);
340340

0 commit comments

Comments
 (0)