Fix diacritic sorting (and possible other locale-specific collation issues) for bibliographies
This commit is contained in:
parent
2f423da309
commit
d369e5f571
|
@ -989,6 +989,12 @@ Zotero.CSL.prototype._serializeElement = function(name, element) {
|
||||||
* handles sorting of items
|
* handles sorting of items
|
||||||
*/
|
*/
|
||||||
Zotero.CSL.prototype._compareItem = function(a, b, opt) {
|
Zotero.CSL.prototype._compareItem = function(a, b, opt) {
|
||||||
|
var localeService = Components.classes["@mozilla.org/intl/nslocaleservice;1"]
|
||||||
|
.getService(Components.interfaces.nsILocaleService);
|
||||||
|
var collationFactory = Components.classes["@mozilla.org/intl/collation-factory;1"]
|
||||||
|
.getService(Components.interfaces.nsICollationFactory);
|
||||||
|
var collation = collationFactory.CreateCollation(localeService.getApplicationLocale());
|
||||||
|
|
||||||
for(var i in this._bib.sortOrder) {
|
for(var i in this._bib.sortOrder) {
|
||||||
var sortElement = this._bib.sortOrder[i];
|
var sortElement = this._bib.sortOrder[i];
|
||||||
|
|
||||||
|
@ -1020,10 +1026,9 @@ Zotero.CSL.prototype._compareItem = function(a, b, opt) {
|
||||||
var bValue = formattedStringB.get().toLowerCase();
|
var bValue = formattedStringB.get().toLowerCase();
|
||||||
//Zotero.debug(aValue+" vs "+bValue);
|
//Zotero.debug(aValue+" vs "+bValue);
|
||||||
|
|
||||||
if(bValue > aValue) {
|
var cmp = collation.compareString(0, aValue, bValue);
|
||||||
return -1;
|
if(cmp != 0) {
|
||||||
} else if(bValue < aValue) {
|
return cmp;
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user