Fix search condition handling when two conditions have same translation
This prevented one "Numéro" from working in the French locale. Also do a proper collation sort
This commit is contained in:
parent
90d57c4afe
commit
cbdc75df9a
1 changed files with 8 additions and 14 deletions
|
@ -2274,8 +2274,7 @@ Zotero.SearchConditions = new function(){
|
|||
_conditions[conditions[i]['name']] = conditions[i];
|
||||
}
|
||||
|
||||
var sortKeys = [];
|
||||
var sortValues = [];
|
||||
_standardConditions = [];
|
||||
|
||||
var baseMappedFields = Zotero.ItemFields.getBaseMappedFields();
|
||||
|
||||
|
@ -2299,23 +2298,18 @@ Zotero.SearchConditions = new function(){
|
|||
continue;
|
||||
}
|
||||
|
||||
var localized = self.getLocalizedName(i);
|
||||
|
||||
sortKeys.push(localized);
|
||||
sortValues[localized] = {
|
||||
_standardConditions.push({
|
||||
name: i,
|
||||
localized: localized,
|
||||
localized: self.getLocalizedName(i),
|
||||
operators: _conditions[i]['operators'],
|
||||
flags: _conditions[i]['flags']
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
// Alphabetize by localized name
|
||||
// TODO: locale collation sort
|
||||
sortKeys = sortKeys.sort();
|
||||
for each(var i in sortKeys){
|
||||
_standardConditions.push(sortValues[i]);
|
||||
}
|
||||
var collation = Zotero.getLocaleCollation();
|
||||
_standardConditions.sort(function(a, b) {
|
||||
return collation.compareString(1, a.localized, b.localized);
|
||||
});
|
||||
|
||||
_initialized = true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue