The jQuery table sorter can be configured with a custom parser for excluding articles from sorting. Many pages in Koha already include this, but for English only: $.tablesorter.addParser({ id: 'articles', is: function(s) {return false; }, format: function(s) { return s.toLowerCase().replace(/^(the|an|a) /,''); }, type: 'text' }); A system preference should be created to contain the pipe-delimited articles (or other text) for exclusion so that speakers of other languages can include their own.
Owen, could we do something similar with databales?
Created attachment 19380 [details] [review] Bug 5766 - Add configuration for excluding articles from DataTables sorting Client-side table sorting should exclude articles like "a," "an," and "the" when sorting by title. This patch adds a custom sorting plugin for use by DataTables and a configuration line to the DataTables string configuration file which can be translated for any language. As an example, this patch modifies the patron checkout history template to use the new sort on the title column. To test, apply the patch and clear your browser cache to ensure the revised JavaScript file is loaded. Sort the table by title. Titles should be sorted regardless of the presences of "a," "an", or "the" at the beginning of the title.
Created attachment 19438 [details] [review] Bug 5766 - Add configuration for excluding articles from DataTables sorting Client-side table sorting should exclude articles like "a," "an," and "the" when sorting by title. This patch adds a custom sorting plugin for use by DataTables and a configuration line to the DataTables string configuration file which can be translated for any language. As an example, this patch modifies the patron checkout history template to use the new sort on the title column. To test, apply the patch and clear your browser cache to ensure the revised JavaScript file is loaded. Sort the table by title. Titles should be sorted regardless of the presences of "a," "an", or "the" at the beginning of the title. Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Created attachment 19463 [details] [review] [PASSED QA] Bug 5766 - Add configuration for excluding articles from DataTables sorting Client-side table sorting should exclude articles like "a," "an," and "the" when sorting by title. This patch adds a custom sorting plugin for use by DataTables and a configuration line to the DataTables string configuration file which can be translated for any language. As an example, this patch modifies the patron checkout history template to use the new sort on the title column. To test, apply the patch and clear your browser cache to ensure the revised JavaScript file is loaded. Sort the table by title. Titles should be sorted regardless of the presences of "a," "an", or "the" at the beginning of the title. Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz> Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de> Passes all tests and is a good improvement. I have added German articles to the list for testing purposes and it worked nicely.
After giving this some more thought it would be nice if this could be in the configuration. Being able to translate the string and influence sorting this way is a good start, but maybe not flexible enough. For libraries with records in multiple languages they will want to have a longer list they can adjust and not only a translation for one language.
Pushed to master. Thanks, Owen! However, I agree with Katrin that the translation subsystem isn't necessarily the best place to configure this, for a couple reasons. First, the language of the catalog interface does not necessarily reflect all of the languages that may be present in the bib data, and I can see a translator not getting the point of translating a list of articles in Pootle. I would lean towards either a system preference or even a separate table that contains a list of articles (which would be useful in other contexts, e.g., a bib editor plugin that sets the non-filing indicator automatically). However, since such configuration hooks can readily be put in later, I've decided to push the patch as is.
This patch has been pushed to 3.12.x, will be in 3.12.4. Thanks Owen!