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 22:21 +0200 schrieb Jean-Marc Libs: > I wouldn't say the messages contradict each other. They are never shown > together. > > The first message is in case the intl extension is present. Nothing needs > to be done. There is no need for detailed explanations. > The second one is besides an orange warning (not a red issue). It explains > one should install the extension but if one can't, nothing is going to > blow up. Tiki will still work, just not as well. Yes, I understand what those two messages are saying. If the intl extension is available, it's required. If not, it's merely preferred? That's a contradiction to me. Cheers, Volker > > Cheers, > J-M > > On Sat, Jul 8, 2023 at 2:43 PM Volker Wysk <post-hhF2Jplw28UoZk/[email protected]> wrote: > > 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 <[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 > _______________________________________________ > 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+K4ydFOsHoUFAmSqKIMACgkQ+K4ydFOs HoVlOw/+PB3QBPrk8mGyZg06l0ipGVNZYkxjsgg0yX4hW6EUkAoX+/mUFZVPbZEK VRfORnCHVr7A54LyorvM2xzQd33V1Zv7Dt2qvcXF2z/84y+KU7QqbwNU8B0RoG63 aBTjg+41d6PeH51Bp3VykjQkNJPUiSQhJltQu/5v1p9/2fTUZZw5Ttd5SNjlJiGH gRrpj1QAmXb3RgqIZBXxalfDEJciUwPO7NMd+NH0CCN2L36q5dEOaoV+sahTMwF4 gFL43zwQNXmuA4ZYVyZ9H827lfxh7LqcpVRTOwwuBKn6PzXuHNWDjzGKxwUrmKBy DPdJsUBnfmr3568sWvBaxVvkbNrNbO0qUKtdumbfVkl+nTwbZxXK0QBDNpNUO3cX A4kQppeZUMaky44n4+wCNchYxkLl0130TASX05tT4zIbe+LL/GPCZhf/lGUbL8iS 9dR0U0Z6m/udxJyLlBneJxzFjuUfwev/Nu7AQiWJ3chKSKa3KMDoIPyAZolCYkaq D0UKIehLbfBI4G/Hd537AiPWRDlRiSKOL0/U+GfPoYy98QFfB/m8VlDpeTMdIR16 0hXgvhlcV/4tiF32TyywcaAYlc0lw/99WxYtC9czdtNJeqDZ9kvnChv53wTwI6ti shtL5uUonTeq2fOWS0AiqnCrNlmpL/ncHZrcR2JJa5vk7BljUBQ= =n1uW -----END PGP SIGNATURE-----