Skip to content

Commit

Permalink
fluent-langneg 0.12.0
Browse files Browse the repository at this point in the history
  • Loading branch information
zbraniecki committed Jan 28, 2020
1 parent ab44ba0 commit c8b540e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

-

## fluent-langneg 0.12.0 (January 28, 2020)

- Update `unic-langid` to 0.8.

## fluent-langneg 0.11.1 (November 17, 2019)

- Improve handling of `und` in requested to match Unicode TR35.
Expand Down
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "fluent-langneg"
description = """
A library for language and locale negotiation.
"""
version = "0.11.1"
version = "0.12.0"
authors = ["Zibi Braniecki <[email protected]>"]
homepage = "http://projectfluent.org/"
license = "Apache-2.0"
Expand All @@ -19,13 +19,13 @@ coveralls = { repository = "projectfluent/fluent-langneg-rs", branch = "master",
maintenance = { status = "actively-developed" }

[dependencies]
unic-langid = "0.7"
unic-langid = "0.8"

[dev-dependencies]
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
unic-langid = { version = "0.7", features = ["macros"] }
unic-locale = { version = "0.7", features = ["macros"] }
unic-langid = { version = "0.8", features = ["macros"] }
unic-locale = { version = "0.8", features = ["macros"] }
criterion = "0.3"

[[bench]]
Expand Down
8 changes: 4 additions & 4 deletions src/negotiate/likely_subtags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ impl MockLikelySubtags for LanguageIdentifier {
"zh-GB" => "zh-Hant-GB",
"zh-US" => "zh-Hant-US",
_ => {
let lang = self.get_language();
let lang = self.language();

for subtag in REGION_MATCHING_KEYS {
if lang == *subtag {
Expand All @@ -31,13 +31,13 @@ impl MockLikelySubtags for LanguageIdentifier {
}
};
let langid: LanguageIdentifier = extended.parse().expect("Failed to parse langid.");
self.set_language(langid.get_language()).unwrap();
if let Some(subtag) = langid.get_script() {
self.set_language(langid.language()).unwrap();
if let Some(subtag) = langid.script() {
self.set_script(subtag).unwrap();
} else {
self.clear_script();
}
if let Some(subtag) = langid.get_region() {
if let Some(subtag) = langid.region() {
self.set_region(subtag).unwrap();
} else {
self.clear_region();
Expand Down
2 changes: 1 addition & 1 deletion src/negotiate/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ pub fn filter_matches<'a, R: 'a + AsRef<LanguageIdentifier>, A: 'a + AsRef<Langu

// Per Unicode TR35, 4.4 Locale Matching, we don't add likely subtags to
// requested locales, so we'll skip it from the rest of the steps.
if req.get_language() == "und" {
if req.language() == "und" {
continue;
}

Expand Down

0 comments on commit c8b540e

Please sign in to comment.