Thanks to all for the suggestions. After I got Natural Sort mostly working, I ran into problems using the sorted titles with Views grouping due to accented letters (no fault of Natural Sort). For example, I'd get a group with "A" as the group heading and another group with "Á" (accented A).
To solve this problem, I did the following:
- Add a field named
sort_title to the content type and hide it from users.
- Add a
node_presave() hook for the content type to a custom module.
- Create a
sortable_title function in the hook to
- Replace accented letters and other international characters in the title with close English equivalents.
- Force the entire title to uppercase.
- Strip all non-alphanumeric characters from the front of the title.
- Add a ~ character to titles that begin with a number (because I want them to sort after titles beginning with letters).
- Save this sortable title in the
sortable_title field for the node.
- Use the
sortable_title field for sorting and grouping in the view, instead of the regular title field, which I was using (and which is still the one that gets displayed).
- I also subthemed the views-view-list.html.twig template to replace the ~ with # in the grouped heading (I had already subthemed the file for another reason anyway).
This approach isn't the most general, but it's giving me exactly the outcome I want, so I'm no longer using Natural Sort. It's only about 30 lines of code in the hook function (most of that being a table of international characters and their replacements) and of course, there's the hidden duplicate of the title field.