TestSort

See this thread on the mailing list.

For PHP 7.2 the code would look like:

$PageListSortCmp['namelocalesort'] = 'LocaleSort';

$PageListSortCmp['title'] = // Note: 'titlelocalesort' won't work
  'cb_titlelocalesort';

function cb_titlelocalesort($x, $y) {
  global $PCache;
  return LocaleSort($PCache[$x]['=title'], $PCache[$y]['=title']);
}

function LocaleSort($a, $b){
  $x = array($a, $b);
  ## instead here, setlocale may be set outside of the function
  ## in the global scope, early in config.php
  setlocale(LC_ALL, 'fr_FR.utf8');
  sort($x, SORT_LOCALE_STRING);
  return ($x[0]==$a)? -1:1;
}
!!French locale sort on "title"
(:pagelist group=TestSort list=normal order=title fmt=#title:)

French locale sort on "title"

!!French locale sort on "-title"
(:pagelist group=TestSort list=normal order=-title fmt=#title:)

French locale sort on "-title"

!!French locale sort on "namelocalesort"
(:pagelist group=TestSort list=normal order=namelocalesort:)

French locale sort on "namelocalesort"

TestSort /
Ad  
Ae  
 
 
 
Af  
Ça  
Co  
Éa  
Eb  
Fa  
!!Sort on "name"
(:pagelist group=TestSort list=normal order=name:)

Sort on "name"

TestSort /
Ad  
Ae  
Af  
 
 
 
Co  
Eb  
Fa  
Ça  
Éa