Re: [Tiki-devel] A Unicode-aware replacement for the natcasesort() function

Volker Wysk <post-hhF2Jplw28UoZk/[email protected]>
Newsgroups gmane.comp.cms.tiki.devel
Message-ID <[email protected]>
Am Samstag, dem 08.07.2023 um 14:22 +0200 schrieb Jean-Marc Libs:
> Hi Volker,
> 
> This is how tiki-check.php does it:
> 
> // intl
> $s=extension_loaded('intl');

Okay.

> if($s){
>   $php_properties['intl']=array(
>     'fitness'=> tra('good'),
>     'setting'=>'Loaded',
>     'message'=> tra("The intl extension is required for Tiki 15 and
> newer.")
>   );
> }else{
>   $php_properties['intl']=array(
>     'fitness'=> tra('unsure'),
>     'setting'=>'Not available',
>     'message'=> tra("intl extension is preferred for Tiki 15 and newer.
> Because is not available, the filters for text will not be able to detect
> the language and will use a generic range of characters as letters.")
>   );
> }

That's interesting. It says "The intl extension is required for Tiki 15 and
newer." and "intl extension is preferred for Tiki 15 and newer...".

So, can we assume that the intl extension is available? The two messages
contradict each other.

Cheers,
Volker


> 
> 
> 
> 
> 
> On Sat, Jul 8, 2023 at 1:59 PM Volker Wysk <post-hhF2Jplw28UoZk/[email protected]> wrote:
> > Hi.
> > 
> > Does anyone know how to check if the intl PHP extension is available?
> > 
> > Bye
> > V.W.
> > 
> > Am Freitag, dem 07.07.2023 um 13:31 +0200 schrieb Volker Wysk:
> > > Hi!
> > > 
> > > Here it is:
> > > 
> > > ----------------------------------------------------------------------
> > > ------
> > > // Do a natural, locale aware sort of an array of strings.
> > > //
> > > // "Natural" means that numbers are sorted by their value, not by the
> > > digits
> > > // they contain. For instance, "10" is ordered after "2".
> > > //
> > > // The "lang" argument is the language for which to order. Accented
> > > // characters, like "ä", are ordered with their non-accented
> > > counterpart, 
> > > // like "a". In the non-locale aware natcasesort() function, accented 
> > > // characters get ordered at the end. That's not right for non-
> > > English 
> > > // languages.
> > > //
> > > // For the "lang" argument, "false" can be specified. In this case,
> > > the 
> > > // function investigates the language of the current user and uses
> > > that.
> > > //
> > > // mb_natcasesort() depends on the "intl" PHP extension.
> > > 
> > > function mb_natcasesort(string $lang, array &$array): bool
> > > {
> > >      if ($lang == false) {
> > >          $tikilib  = TikiLib::lib('tiki');
> > >          $loginlib = TikiLib::lib('login');
> > > 
> > >          $user = $loginlib->getUser();
> > >          $lang = $tikilib->get_language($user);
> > >      }
> > > 
> > >      $coll = collator_create($lang);
> > >      collator_set_attribute($coll, Collator::NUMERIC_COLLATION, 
> > >                             Collator::ON);
> > >      collator_set_attribute($coll, Collator::CASE_FIRST, 
> > >                             Collator::LOWER_FIRST);
> > >      collator_set_attribute($coll, Collator::ALTERNATE_HANDLING, 
> > >                             Collator::SHIFTED);
> > > 
> > >      return collator_asort($coll, $array);
> > > }
> > > ----------------------------------------------------------------------
> > > ------
> > > 
> > > Any comments are welcome.
> > > 
> > > Regards,
> > > Volker
> > > _______________________________________________
> > > TikiWiki-devel mailing list
> > > [email protected]
> > > https://lists.sourceforge.net/lists/listinfo/tikiwiki-devel
> > 
> > _______________________________________________
> > TikiWiki-devel mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/tikiwiki-devel
> _______________________________________________
> TikiWiki-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/tikiwiki-devel

_______________________________________________
TikiWiki-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-devel
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEE6QXGh82Ov3+2nrxp+K4ydFOsHoUFAmSpWcAACgkQ+K4ydFOs
HoW3hw/7BNo4TyL8S/gvNY2QOZbCnwQZKFASQoIUspRa64/SZt4LdrIAE9BGKnaS
PQ1iwptEmy90I5zJe0deO49aO2b4zwKFccSUfthHQh2rT5KKPx7OjcBWv9RO5yG7
fGGKUp1UwqTO3gswjJA4yu3b34+Tv3ZHwtLyuJOJCyt8/hLocBZbgHs3Ph3Lf7Hr
Y1u+7OPA/YAEaXQlLCxhQQfOr3v+fnCWgWcBBzejJlQCyCw9mYA9cG6S28Ub6b1o
nOm7qFDjgWwdKDwUNqXMdELq9d+WZmWMm9E5lSqfA4wvKj8FiPN+IxZJVyIjIEfT
8/haekkQuTlwfw6A/f/jLonKCZRC2UHd2ZBtmQktKohMHWaSTVyrQPGSX5JhhTUe
XkhVedU7mc+5VKHyA8vyqg3ZHr5HuINkdpBBYTw/naZJ+0/ZJaujKwF/GjMYG+lT
UYmT3Y7WGyPvuQR9EzfjRYygLMH8u5aJR7mMqAfRUeP7HFC2a+odpNCEqeo1y1ck
GIkYnvPEgmkq3UVQ7k7NQUVBmTVUGUkbpPVeZXBUmUqguuYQAEc9Fpku0D3VVJ9n
UJJUeGsoduGmUl7/1dZSYaHgjLCSlNxwhxdVMqA6MLW3AAB5+IJKRgyF7zIeTIb8
j4ciaA7y3B3sLVRYirZ9unVovMQkkihaAIpyw2YyUvcRZd1lmxk=
=5g+k
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.