Sort strings naturally or alphabetically (#5075)

Hidden setting. If true, use natural collection sorting matching the current behavior. If false, use conventional alphabetic sorting.
This commit is contained in:
PChemGuy 2025-03-07 10:08:11 +03:00 • committed by Dan Stillman
parent c93a0e0e80
commit f4b531e657
2 changed files with 5 additions and 2 deletions

View file

@ -244,12 +244,14 @@ Zotero.Intl = new function () {
}
function getLocaleCollation() {
var naturalSorting = Zotero.Prefs.get('naturalSorting');
try {
// DEBUG: Is this necessary, or will Intl.Collator just default to the same locales we're
// passing manually?
let locales = Services.locale.appLocalesAsBCP47;
var collator = new Intl.Collator(locales, {
numeric: true,
numeric: naturalSorting,
sensitivity: 'base'
});
}
@ -260,7 +262,7 @@ Zotero.Intl = new function () {
try {
Zotero.logError("Falling back to en-US sorting");
collator = new Intl.Collator(['en-US'], {
numeric: true,
numeric: naturalSorting,
sensitivity: 'base'
});
}

View file

@ -38,6 +38,7 @@ pref("extensions.zotero.autoRenameFiles.fileTypes", "application/pdf,application
pref("extensions.zotero.attachmentRenameTemplate", "{{ firstCreator suffix=\" - \" }}{{ year suffix=\" - \" }}{{ title truncate=\"100\" }}");
pref("extensions.zotero.capitalizeTitles", false);
pref("extensions.zotero.launchNonNativeFiles", false);
pref("extensions.zotero.naturalSorting", true);
pref("extensions.zotero.sortNotesChronologically", false);
pref("extensions.zotero.sortNotesChronologically.reader", true);
pref("extensions.zotero.sortAttachmentsChronologically", false);