File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -61,12 +61,14 @@ struct Locale {
61
61
62
62
[[nodiscard]] int matchScore (const Locale& other) const {
63
63
if (this ->language != other.language ) return 0 ;
64
- auto territoryMatches = !this ->territory .isEmpty () && this ->territory == other.territory ;
65
- auto modifierMatches = !this ->modifier .isEmpty () && this ->modifier == other.modifier ;
64
+
65
+ if (!other.modifier .isEmpty () && this ->modifier != other.modifier ) return 0 ;
66
+ if (!other.territory .isEmpty () && this ->territory != other.territory ) return 0 ;
66
67
67
68
auto score = 1 ;
68
- if (territoryMatches) score += 2 ;
69
- if (modifierMatches) score += 1 ;
69
+
70
+ if (!other.territory .isEmpty ()) score += 2 ;
71
+ if (!other.modifier .isEmpty ()) score += 1 ;
70
72
71
73
return score;
72
74
}
You can’t perform that action at this time.
0 commit comments