Skip to content

Commit

Permalink
Fix maximize in negotiation
Browse files Browse the repository at this point in the history
  • Loading branch information
zbraniecki committed Jan 29, 2020
1 parent c8b540e commit 4d49c9b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/negotiate/likely_subtags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ static REGION_MATCHING_KEYS: &[&str] = &[
];

pub trait MockLikelySubtags {
fn add_likely_subtags(&mut self) -> bool;
fn maximize(&mut self) -> bool;
}

impl MockLikelySubtags for LanguageIdentifier {
fn add_likely_subtags(&mut self) -> bool {
fn maximize(&mut self) -> bool {
let extended = match self.to_string().as_str() {
"en" => "en-Latn-US",
"fr" => "fr-Latn-FR",
Expand Down
4 changes: 2 additions & 2 deletions src/negotiate/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ pub fn filter_matches<'a, R: 'a + AsRef<LanguageIdentifier>, A: 'a + AsRef<Langu
}

// 3) Try to match against a maximized version of the requested locale
if req.add_likely_subtags() {
if req.maximize() {
test_strategy!(true, false);
}

Expand All @@ -196,7 +196,7 @@ pub fn filter_matches<'a, R: 'a + AsRef<LanguageIdentifier>, A: 'a + AsRef<Langu

// 5) Try to match against the likely subtag without region
req.clear_region();
if req.add_likely_subtags() {
if req.maximize() {
test_strategy!(true, false);
}

Expand Down

0 comments on commit 4d49c9b

Please sign in to comment.