Skip to content
Snippets Groups Projects
Commit 35401214 authored by Adriaan de Groot's avatar Adriaan de Groot
Browse files

[locale] Prefer non-empty country matches

Prefer "en_US" over "en" even when asking for "en".
parent a422fd80
Branches
No related tags found
No related merge requests found
......@@ -84,7 +84,7 @@ LocaleNameParts::similarity( const LocaleNameParts& other ) const
return 0;
}
const auto matched_region = ( region == other.region ? 30 : 0 );
const auto matched_country = ( country == other.country ? 20 : 0 );
const auto matched_country = ( country == other.country ? ( country.isEmpty() ? 10 : 20 ) : 0 );
const auto no_other_country_given = ( ( country != other.country && other.country.isEmpty() ) ? 10 : 0 );
return 50 + matched_region + matched_country + no_other_country_given;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment